Skip to content

Terminal: support synchronized output (DEC mode 2026) - #3066

Open
insjang wants to merge 1 commit into
eclipse-platform:masterfrom
insjang:synchronized-output
Open

insjang wants to merge 1 commit into
eclipse-platform:masterfrom
insjang:synchronized-output

Conversation

@insjang

@insjang insjang commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

A program that redraws its screen in many writes can bracket each screen with CSI ? 2026 h and CSI ? 2026 l (Claude Code, Codex and other TUIs do). The view polls the text every 50 ms and used to paint whatever it found, often a screen half drawn, which shows as flicker and as a cursor jumping over the screen.

While a program is between the two, the canvas model skips its polls, and the next poll after the end paints the finished screen. A program that begins a screen and never ends it does not freeze the view: the skip lasts at most 200 ms, and a full reset or the end of the connection ends it. As with DECTCEM, the flag is kept on the control and copied to the new canvas model under the same lock when the tab is moved to another view.

Split out of #2902 as asked in its review.

How to test, in a bash terminal:

  • printf '\e[2J\e[H\e[?2026hfirst'; sleep 0.15; printf ' second\e[?2026l\n'
    "first second" appears at once; without the change "first" shows alone for a moment.
  • printf '\e[?2026hstill shown'; sleep 1; printf '\n'
    "still shown" appears after about 200 ms although the end never comes; the view does not freeze.
  • Run Claude Code or Codex and scroll or resize: no half drawn screens.

Tests: 2 new cases in VT100EmulatorTest (mode on and off, full reset ends it).

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   38m 44s ⏱️ +55s
 5 024 tests +2   5 002 ✅ +2   22 💤 ±0  0 ❌ ±0 
12 963 runs  +6  12 809 ✅ +6  154 💤 ±0  0 ❌ ±0 

Results for commit d359f3d. ± Comparison against base commit 30dafa8.

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Synchronized-output edge cases can expose partial frames during viewport changes, freeze redraws indefinitely, and leave buffered output undisplayed after disconnect.

3 open issues
What changed in this PR

Adds DEC mode 2026 synchronized output to the terminal, aiming to reduce flicker by deferring canvas polling while programs redraw their screens.

Changes:

  • Handles synchronized-output start, end, and reset sequences.
  • Adds a 200-ms polling grace period and preserves the mode when moving terminal tabs.
  • Extends the mock control and emulator tests to cover mode toggling and resets.
File Description
terminal/​tests/​org.eclipse.terminal.test/​src/​org/​eclipse/​terminal/​internal/​emulator/​VT100EmulatorTest.java Tests mode toggling and reset behavior.
terminal/​tests/​org.eclipse.terminal.test/​src/​org/​eclipse/​terminal/​internal/​emulator/​MockTerminalControlForText.java Tracks synchronized-output state for tests.
terminal/​bundles/​org.eclipse.terminal.control/​src/​org/​eclipse/​terminal/​internal/​textcanvas/​PollingTextCanvasModel.java Defers polling during the redraw grace period.
terminal/​bundles/​org.eclipse.terminal.control/​src/​org/​eclipse/​terminal/​internal/​emulator/​VT100TerminalControl.java Stores and transfers synchronization state to canvas models.
terminal/​bundles/​org.eclipse.terminal.control/​src/​org/​eclipse/​terminal/​internal/​emulator/​VT100Emulator.java Handles DEC mode 2026 and clears it on reset.
terminal/​bundles/​org.eclipse.terminal.control/​src/​org/​eclipse/​terminal/​internal/​control/​impl/​ITerminalControlForText.java Adds the synchronized-output control hook.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved races in polling and unconditional snapshot copying during tab moves can expose partially redrawn screens while synchronized output is active.

2 open issues
3 resolved since last review

Review effort: Balanced

@insjang
insjang force-pushed the synchronized-output branch 2 times, most recently from 2ded62d to db09d12 Compare November 13, 2026 04:12
@SougandhS
SougandhS requested a balanced review from Copilot November 13, 2026 06:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Synchronized output can display cached rows at incorrect positions when scrolling, and its wall-clock-based safety timeout can leave the display frozen after a backward clock adjustment.

2 open issues
2 resolved since last review

Review effort: Balanced

@insjang
insjang force-pushed the synchronized-output branch from db09d12 to 02ad410 Compare November 13, 2026 07:16
A program that redraws its screen in many writes can bracket each
screen with CSI ? 2026 h and CSI ? 2026 l. The view polls the text
every 50 ms and used to paint whatever it found, often a screen half
drawn, which shows as flicker and as a cursor jumping over the screen.

While a program is between the two, the canvas model does not look at
the text, and the next poll after the end paints the finished screen.
The check and the copy of the text are one locked step, so a screen
cannot begin between them, and a scroll or a resize waits like a poll:
the view moves with the next copy, not over the lines held back.
A program that never ends a screen, or begins the next one right after,
does not freeze the view: it is held back at most 200 ms
since it last looked, on a clock that does not move with the time of
day. A full reset or a disconnect ends the mode, and
the last poll then shows what the program had drawn. As with DECTCEM,
the flag is kept on the control and copied to the new canvas model
under the same lock when the tab is moved to another view.

Split out of eclipse-platform#2902 as asked in its review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the synchronized-output change.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@SougandhS
SougandhS requested a review from laeubi November 13, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants