Skip to content

Terminal: DEC private mode lists, DECTCEM and bracketed paste - #2901

Open
insjang wants to merge 2 commits into
eclipse-platform:masterfrom
insjang:dec-modes
Open

insjang wants to merge 2 commits into
eclipse-platform:masterfrom
insjang:dec-modes

Conversation

@insjang

@insjang insjang commented Sep 3, 2026 •

Copy link
Copy Markdown

DEC private mode sequences may carry several modes at once, and ncurses does exactly that when it turns the mouse on: CSI ? 1006 ; 1000 h. The emulator looked at the first parameter only and dropped the rest, so a program could end up with half of what it asked for. Every parameter is now set or reset.

DECTCEM (mode 25) lets a program hide the cursor while it draws, or for good; a full screen program that hides it, such as htop, showed a cursor wandering over its screen. The request is passed to the view, which keeps its own blinking and focus handling and simply does not draw the cursor while a program has hidden it.

Bracketed paste (mode 2004) marks pasted text with CSI 200~ and CSI 201~ so that a program can take it as text rather than as keys typed - a shell does not run every line of a pasted snippet, an editor does not auto-indent it. Programs that ask for it and do not get it misread multi-line pastes. An end marker inside the text is removed so the paste cannot close its own bracket early.

@insjang insjang changed the title Terminal: take every mode in a DEC private set/reset, hide the cursor… Terminal: DEC private mode lists, DECTCEM and bracketed paste Sep 3, 2026
… on request, and support bracketed paste

DEC private mode sequences may carry several modes at once, and
ncurses does exactly that when it turns the mouse on: CSI ? 1006 ; 1000 h.
The emulator looked at the first parameter only and dropped the rest,
so a program could end up with half of what it asked for. Every
parameter is now set or reset.

DECTCEM (mode 25) lets a program hide the cursor while it draws, or for
good; a full screen program that hides it, such as htop, showed a
cursor wandering over its screen. The request is passed to the view,
which keeps its own blinking and focus handling and simply does not
draw the cursor while a program has hidden it.

Bracketed paste (mode 2004) marks pasted text with CSI 200~ and
CSI 201~ so that a program can take it as text rather than as keys
typed - a shell does not run every line of a pasted snippet, an editor
does not auto-indent it. Programs that ask for it and do not get it
misread multi-line pastes. An end marker inside the text is removed so
the paste cannot close its own bracket early.
A program that hid the cursor (CSI ? 25 l) or asked for bracketed paste
(CSI ? 2004 h) and was cut off, by a disconnect or a crash, left both
set for whatever ran on the next connection: a shell without a cursor,
and pastes wrapped in markers it does not expect. resetState(), which
runs before every connection, now shows the cursor and turns bracketed
paste off.
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.

1 participant