Repository navigation
Terminal: clear a stale wrap mark, and copy and paint a selection whole - #2905
Conversation
08f9168 to
1e5d1de
Compare
1e5d1de to
3f96987
Compare
|
Rebased on master, now that #2894 is in: one commit, 3f96987; all terminal tests pass. How to test, in a runtime Eclipse with this org.eclipse.terminal.control, Terminal view, local shell:
Unit tests: testWrappedLineMarkComesOff in VT100EmulatorBackendTest; clearWrappedLine in AbstractITerminalTextDataTest and TerminalTextDataWindowTest for every data implementation. |
436f1fc to
4227a36
Compare
4227a36 to
eaf3ad0
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Outstanding defects drop selected whitespace, add incorrect newlines after partial overwrites, break word/line selection during edge dragging, and leave snapshots with stale wrap markers.
4 open issues
What changed in this PR
This PR improves terminal wrap tracking, copying, and selection display, building on the East Asian character-width support in #2894.
Changes:
- Adds
clearWrappedLineacross terminal data implementations, with emulator and model tests. - Trims copied selection text and fills the full selected cell range.
- Adds continuous scrolling during selection drags and redraws when the grid narrows.
| File | Description |
|---|---|
| terminal/tests/org.eclipse.terminal.test/src/org/eclipse/terminal/internal/model/TerminalTextDataWindowTest.java | Tests clearing wrap marks inside and outside the window. |
| terminal/tests/org.eclipse.terminal.test/src/org/eclipse/terminal/internal/model/AbstractITerminalTextDataTest.java | Tests wrap-mark clearing across data implementations. |
| terminal/tests/org.eclipse.terminal.test/src/org/eclipse/terminal/internal/emulator/VT100EmulatorBackendTest.java | Tests clearing wrap marks after overwrites and erasure. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/model/ITerminalTextData.java | Adds the default clearWrappedLine API. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/TextLineRenderer.java | Fills the full selection background before drawing text. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/TextCanvas.java | Adds drag scrolling and redraws after grid narrowing. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/AbstractTextCanvasModel.java | Trims trailing whitespace from copied selection rows. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/model/TerminalTextDataWindow.java | Delegates wrap clearing for rows within the window. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/model/TerminalTextDataStore.java | Clears the stored wrap flag. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/model/TerminalTextDataFastScroll.java | Maps wrap clearing to the underlying row position. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/model/TerminalTextData.java | Delegates wrap clearing to its backing data. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/model/SynchronizedTerminalTextData.java | Provides synchronized wrap clearing. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/emulator/VT100EmulatorBackend.java | Clears wrap marks on short writes and erase-to-end operations. |
Review effort: Balanced
42fc4eb to
afcde2d
Compare
afcde2d to
4ddd69e
Compare
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 erases a row before it draws it again, 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 what ran on to the margin is erased or moved off it: erasing to the end of the line, as xterm and Ghostty do, erasing characters as far as the margin (Ghostty clears it on any such erase), or deleting characters (xterm). Writing over part of the line leaves it, since the line still runs on. Setting or clearing the mark tells snapshots, so a reader sees it without another change to the line. ITerminalTextData gains clearWrappedLine, a default method. 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, by characters, words or lines as the drag began. ITerminalTextData.clearWrappedLine is a new default method (@SInCE 1.2), within the 1.2.0 bundle and the 1.1.0 org.eclipse.terminal.model export that master already has.
4ddd69e to
5d8e26a
Compare
|
Drag past the edge keeps scrolling is a very nice improvement. In the future when you open new PRs make them as small as possible - e.g. this one fixes 5 things but should be one. |
… (EL 0, ECH to the margin), not when part of the line is written over; setting or clearing it tells snapshots; copying keeps written trailing spaces; a drag past the edge extends the selection by characters, words or lines as it began. As reviewed for eclipse-platform/eclipse.platform#2905.
…the compiler's null analysis asks (eclipse-platform/eclipse.platform#2905).

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.