Skip to content

Terminal: clear a stale wrap mark, and copy and paint a selection whole - #2905

Open
insjang wants to merge 3 commits into
eclipse-platform:masterfrom
insjang:selection-copy
Open

Terminal: clear a stale wrap mark, and copy and paint a selection whole#2905
insjang wants to merge 3 commits into
eclipse-platform:masterfrom
insjang:selection-copy

Conversation

@insjang

@insjang insjang commented Sep 3, 2026

Copy link
Copy Markdown

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.

  • Wrap mark comes off. 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 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 on erase to end of line. ITerminalTextData.clearWrappedLine is added as a default method (@since 1.2, bundle 1.2.0).
  • Copy without the room a fold left. Copying a folded line included the never-written cells past its last character — on a folded line the room the fold left, on an ended one the rest of the screen. They are left out, so a folded line copies as the one line it is.
  • Selection painted whole. The selection colour was drawn only where text was drawn, leaving cells past the last character and gaps under narrow glyphs in ordinary colours. The selected range on each line is filled first.
  • Narrower grid redraws. The canvas uses NO_REDRAW_RESIZE; when the grid got narrower, what was drawn in the columns now past its edge stayed on screen.
  • Drag past the edge keeps scrolling, so a selection can reach beyond the visible page.

Tests: wrap mark on/off in VT100EmulatorBackendTest; clearWrappedLine in AbstractITerminalTextDataTest for every data implementation.

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.
@insjang insjang changed the title Terminal: keep the wrap mark honest, copy a folded line whole, paint a selection whole, and scroll while a drag goes past the edge Terminal: clear a stale wrap mark, and copy and paint a selection whole Sep 3, 2026
New @SInCE 1.2 API was added to the package without bumping its
Export-Package version, which API Tools flags as an error.
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