Terminal: clear a stale wrap mark, and copy and paint a selection whole - #2905
Open
insjang wants to merge 3 commits into
Open
Terminal: clear a stale wrap mark, and copy and paint a selection whole#2905insjang wants to merge 3 commits into
insjang wants to merge 3 commits into
Conversation
The emulator assumed every character occupies one cell, so Hangul, Han and Kana text, fullwidth forms and emoji were placed one column short per character and the screen fell apart as soon as a program laid text out for a real terminal (line editors, curses UIs, Ink based CLIs). Add CharWidth, a UAX eclipse-platform#11 East Asian Width lookup: Wide and Fullwidth count as two columns, combining marks and controls as zero, Ambiguous as one, as UAX eclipse-platform#11 recommends outside an East Asian legacy context. The emulator advances the cursor by that width and stores a NUL filler in the second cell of a wide character, never splits one across the right margin, blanks the other half when either half is overwritten and counts insert mode in cells. The renderer skips the fillers so a fixed width font draws a wide glyph over both cells, falls back to placing each character at its own cell when the font does not advance exactly one cell per column, and draws a character beyond the BMP whole. A partial repaint that starts on the second cell of a wide character is widened to its first, and copying drops the fillers. Tests cover the width table, placement, the margin, overwriting halves and insert mode.
…t, paint a selection whole, and keep scrolling while a drag goes past the edge The mark that says a line runs on to the next (set when the terminal folds a line at the margin) could only be set, never cleared. A program that draws its own screen writes the same row over and over, and a row that was folded in one frame is a row of its own in the next; the stale mark then joined unrelated rows when copying. The mark now comes off when a row is drawn over shorter than the margin, and when the line is erased to its end. ITerminalTextData gains clearWrappedLine, a default method (hence the version bump). Copying a folded line included the cells past its last character, which were never written to: on a line that ran on they are the room the fold left, on one that ended they are the rest of the screen. They are left out, so a folded line copies as the one line it is. The selection colour was drawn only where text was drawn, leaving the cells past the last character on a line and the gaps under narrow glyphs in the ordinary colours. The selected range on each line is now filled first. The canvas is created with NO_REDRAW_RESIZE, which repaints only what a resize uncovers; when the grid got narrower, what was drawn in the columns now past its edge stayed on screen until something else repainted it. A narrower grid now redraws. And a drag that goes past the top or bottom edge keeps scrolling while the pointer stays there, so a selection can reach beyond the visible page. Builds on the East Asian Width change for the filler handling in the copy path.
New @SInCE 1.2 API was added to the package without bumping its Export-Package version, which API Tools flags as an error.
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.
Depends on #2894 (East Asian Width) for the filler handling in the copy path. This PR shows that commit as well until #2894 is merged; only the second commit is new here.
ITerminalTextData.clearWrappedLineis added as a default method (@since 1.2, bundle 1.2.0).NO_REDRAW_RESIZE; when the grid got narrower, what was drawn in the columns now past its edge stayed on screen.Tests: wrap mark on/off in
VT100EmulatorBackendTest;clearWrappedLineinAbstractITerminalTextDataTestfor every data implementation.