Repository navigation
Conversation
vt100's Row::insert moves the wide-continuation flag onto the inserted blank, so with the cursor on the second column of a wide character `CSI @` kept the character whole and inserted after it. xterm's InsertChar (util.c 1887) clears the character the cursor splits with RepairInsertChar first. ICH now reaches the emulator as a Motion event. With the cursor on a wide continuation, the sequence is replaced by one vte ignores, the character is erased with ECH from its first half, and the ICH is fed again from the cursor's column. Otherwise the final byte goes to vt100 as before. Closes #822 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
termlens handed DECSTBM, CUD, CUU, CNL, CPL, RI and VPA to vt100, which differs from xterm in five places: - DECSTBM homed to the top margin; xterm's CASE_DECSTBM (charproc.c 4773) homes with CursorSet, to row 0 outside origin mode. - An invalid DECSTBM removed the region; xterm sets one only if its bottom is below its top and otherwise ignores the sequence. - CUD and CUU (and CNL, CPL) from outside the region went to the screen's edge; xterm's CursorDown and CursorUp (cursor.c 251, 271) stop at the near margin unless the cursor starts beyond it. - RI at row 0 above the region scrolled the region; xterm's RevIndex (cursor.c 319) is CursorUp there. - VPA ignored origin mode; xterm's CASE_VPA counts from the top margin and clamps to the bottom one. The tracker now reads DECSTBM by xterm's rule, which set_margins and so the cursor report follow, and names each of these as a Motion. The emulator feeds the final byte to vt100 where vt100 agrees, and where it does not, replaces it with a sequence vte ignores and moves the cursor with VPA and CHA, which vt100 takes as absolute in every mode. Closes #821 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
vt100 keeps a cursor, a scroll region and origin mode per grid, and `?1049h` clears the alternate grid's, so `?1049h` and `?47h` put the cursor at the alternate screen's top-left with no region, and `?47l` put it back where the main screen last had it. In xterm all three belong to the terminal: SwitchBufs (charproc.c 9564) swaps the line buffers and moves neither the cursor nor top_marg and bot_marg, and ORIGIN is one of its flags. Every child enters through smcup, which is `?1049h`, so the cursor after start-up differed from xterm's. The tracker now carries the margins and origin mode across 47 and 1049, and the emulator feeds the switch's final byte alone, then sets the new grid's region and origin mode from the tracker and puts the cursor back: where it was, or for `?1049h` on the last column with the wrap reset by ClearScreen, or for `?1049l` where vt100 restored it. Two corners stay apart from xterm and are listed in LIMITATIONS: a pending wrap carried by `?47` onto a blank last column, and a list that names origin mode with the switch. Closes #820 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
After a character in the last column xterm keeps the cursor on that column with its wrap flag set, and CursorUp, CursorDown, CursorSet and CursorBack (cursor.c), InsertChar and DeleteChar (util.c) and the line feed, xtermIndex through CursorDown, reset the flag and work from that column. vt100 keeps the cursor one column past the margin, so CUU, CUD, VPA, RI and a line feed left the wrap pending, CUB and BS landed a column right of xterm's, and ICH and DCH changed nothing. CUB, DCH, LF (and VT, FF) and BS join the Motion events. At a pending wrap the CSIs are replaced by moves from the last column, the controls are preceded by a CHA to it, and IND cancels the wrap before its line feed. A line feed or backspace is checked against the grid only when a byte since the last carriage return could have left a wrap pending, so the common CR LF costs no split feed. The other way round, as the issue's comments note: xterm keeps the wrap through HT, CHT and CBT (set_cur_col never resets it) and through a resize (ScreenResize clamps with set_cur_col). HT and CHT at a pending wrap now move nothing, and a resize to a screen no wider draws the last column again to put the wrap back. CBT counts back from the last column but cannot keep the wrap on an earlier one, which vt100 cannot hold; that, a wider resize, a DECRC after a resize, and BS or LF inside an escape sequence are listed in LIMITATIONS. Closes #814 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four emulator issues about the cursor, the scroll region and the pending wrap, one commit each, each with tests that fail without the fix. All of them are behaviour changes, so they are Changed entries with migration sentences.
CSI @) with the cursor on the second half of a wide character keeps the character; xterm blanks it #822: ICH on the second half of a wide character erases the character first (CSI <col> G CSI 2 X), then inserts, as xterm'sRepairInsertChardoes.set_margins, which the cursor report reads, follows the same rule.?1049h,?47h/l) move the cursor and drop the scroll region; xterm keeps both #820:?1049h,?47hand?47lkeep the cursor, the scroll region and origin mode, as xterm's screen-wide state does.?1049lrestores the cursor?1049hsaved.xtermIndexgoes throughCursorDown, which resets the wrap; this is the case noted, unverified, in fix: eight v0.11.12 emulator issues (IND/NEL, DECRQM, OSC lists, designations) #887.Documented rather than approximated, in LIMITATIONS: vt100 holds a pending wrap only as the column past the last.
?47andCSI ? 6 ; 1049 h.Cost: a release build fed 100k lines of CR LF takes 227 ms here, against 209 ms on main; 100k full-width lines take 409 ms against 372 ms. That is the per-byte check for a pending wrap; a plain CR LF never splits the feed.
Local: the full suite passed twice, and the emulator tests compare whole streams against bytewise ones. Stress is dispatched.
Closes #822
Closes #821
Closes #820
Closes #814