Skip to content

fix: eight v0.11.12 emulator issues (IND/NEL, DECRQM, OSC lists, designations) - #887

Merged
vyncint merged 10 commits into
mainfrom
fix/01112-emu
Dec 2, 2026
Merged

vyncint merged 10 commits into
mainfrom
fix/01112-emu

Conversation

@vyncint

@vyncint vyncint commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Eight emulator issues from the v0.11.12 milestone, one commit each, each with tests that fail without the fix.

terminal.rs gains only responder arms for #830 and #833; the rest is src/emu/, tests and docs (DESIGN, LIMITATIONS, screen.rs rustdoc).

Not fixed, noted while working: at a pending wrap, vt100's line feed leaves the wrap pending (abcdefghij LF X on 10 columns puts X at row 2). This looks like #814's family, but it has not been checked against xterm yet, so it is not filed.

Local: cargo test --workspace --all-features --no-fail-fast passes, and fmt and clippy are clean. Stress is dispatched.

Closes #827
Closes #823
Closes #816
Closes #826
Closes #830
Closes #832
Closes #833
Closes #824

vte hands an omitted parameter on as 0, and the record dropped that 0
only when it was the sole parameter, so `CSI 22 ; t` was listed as
`^[[22;0t` and `CSI ; 5 h` as `^[[0;5h`, with a 0 the application never
wrote.

The tracker now notes which parameters of a CSI had nothing written in
them, and the emulator tells the record so between the bytes before the
final byte and that byte, fed alone, as it does for the `SP`
intermediates (#764). The record leaves those parameters empty. A `0`
the application wrote is still listed.

Closes #827

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
vt100 returns from the whole SGR when an extended colour's index or
channel does not fit a byte, so in `CSI 38;5;256;1 m` the bold was lost,
and nothing was listed in `Screen::unsupported()`. xterm's
`parse_extended_colors` consumes the colour's values, leaves the colour
as it was, and goes on to the next parameter.

The colour normalizer in front of vt100 now drops such a colour, in the
semicolon and the colon form, so the parameters after it apply. An SGR
left with no parameter becomes a stand-in vte ignores, since an empty
SGR would be a reset.

Closes #823

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
vt100 has no arm for `ESC D` or `ESC E`, and the tracker ended them as
plain two-character escapes, so the text after either went on along the
row it meant to leave and `Screen::unsupported()` listed both. The
xterm-256color entry every child is handed advertises `nel`.

xterm's `CASE_IND` is `xtermIndex`, which is what a line feed does, and
`CASE_NEL` is that and a carriage return. The tracker now reports both,
and the emulator hands vt100 a CSI vte ignores in place of the final
byte, as it does for REP, then feeds both parsers the line feed (with a
CR for NEL), which scrolls at the bottom margin.

The unsupported() tests that used `ESC D` as an escape nobody honours
use `ESC 6` now.

Closes #816

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
On a change of size the tracker cleared both screens' margins and kept
origin mode, following vt100. xterm's ScreenResize clears both
together (`resetMargins(xw); UIntClr(*flags, ORIGIN);`), so after a
resize and a new region, `CUP 1;1` drew at the region's top here and at
the screen's corner in xterm.

The tracker now clears origin mode on both screens with the margins and
says which had it on. The emulator resets it in those vt100 grids with
`CSI ? 6 l`, putting a hidden grid on display for it as the resize
does, and moves the cursor back where it was, since vt100 homes it.
Being bytes, the reset waits while the stream is inside a sequence and
is carried out where that sequence ends.

Closes #826

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
The tracker classified `CSI Ps $ p` as a question it cannot answer, so
an application that asked for an ANSI mode got no reply and waited out
its own timeout, though xterm answers every ANSI-mode request
(`do_ansi_rqm`, misc.c 5408). And `CSI ? 6 $ p` reported origin mode as
not recognized, though the tracker follows it per screen and the
position report reads it.

The request is now its own query, answered from a new emulator method:
insert mode from the tracker, every other ANSI mode "not recognized",
as an unknown private mode already is. `mode_state` reports mode 6 from
the tracker. The responder in terminal.rs gains the one arm that writes
the reply, and the shape a timeout would name.

Closes #830

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
Since #693 a reset of any of 9, 1000, 1002 and 1003 turns reporting
off, and click, drag, scroll and mouse_move refuse. The reset took out
only the mode it named from the requested set DECRQM answers from, so
after `?1003h ?1000l` DECRQM said any-event tracking was on while
termlens's own input path sent nothing. xterm sets `MOUSE_OFF` on a
reset of any of the four, and its DECRQM then answers each one reset.

The tracker now empties the set on such a reset, so DECRQM answers 2
for every tracking mode until one is set again, and
`Screen::mouse_modes()` stops listing a mode nothing reports in. The
tests that pinned the old rule, and the rustdoc and DESIGN text that
stated it, follow. DECRQM while two modes are both set is #151's design
and is left as it is.

Closes #832

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
The tracker took an OSC colour string as a query only when its whole
body was `10;?`, `11;?` or `12;?`, and had no arm for `ESC Z`. So
`OSC 10;?;?`, `OSC 17;?`, `OSC 10;?;rgb:…` and `ESC Z` got no reply and
were not named in a timeout, though xterm answers each: OSC 10 to 19 go
to `ChangeColorsRequest`, which answers each `?` for the code it stands
at, and `CASE_DECID` falls through to `CASE_DA1`.

An OSC 10 to 19 string is now read as a list from its code. The
foreground and background are answered wherever they stand, as they
were alone; from 10 or 11 they come first, so the replies are in the
order asked. Any other colour asked for is named in the next timeout.
`ESC Z` is answered with the DA1 reply. The record leaves these out as
the responder's, and still lists a string that also sets a colour,
which nobody models. The responder in terminal.rs gains the arms that
write the replies and name a list's remainder.

Closes #833

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
The tracker designated a set only after a single intermediate of `(`,
`)`, `*` or `+`. A second intermediate cleared it, and `-`, `.` and `/`
named no slot, so `ESC ( % 5` and `ESC - A` changed nothing: a slot
holding DEC Special Graphics went on drawing lines, and both were
listed in `Screen::unsupported()`. xterm's `xtermDecodeSCS` replaces
the slot for each designation its tables take.

The tracker now reads `ESC - A`, `ESC . A` and `ESC / A` as G1 to G3,
and `ESC ( % F` (and the `)`, `*`, `+` forms) for the finals xterm's
`scs_pct_table` takes (`0`, `2`, `3`, `5`, `6`, `=`), each as a set read
as ASCII, as LIMITATIONS says of every designation but `0` and `A`. The
finals xterm does not take at its default VT420 level, and the VT5xx
`"` and `&` sets, still change nothing. The record leaves out the forms
the tracker takes.

Closes #824

Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
@vyncint
vyncint merged commit 7606699 into main Dec 2, 2026
17 checks passed
@vyncint
vyncint deleted the fix/01112-emu branch December 2, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment