Repository navigation
Conversation
Same cross-bundle package-private access problem as mouseReport in eclipse-platform#2902 -- the test bundle is a separate OSGi bundle, so package-private static does not reach it even under the same package name.
Same cross-bundle package-private access problem as mouseReport in eclipse-platform#2902 -- the test bundle is a separate OSGi bundle, so package-private static does not reach it even under the same package name.
341beec to
ff61a3f
Compare
Same cross-bundle package-private access problem as mouseReport in eclipse-platform#2902 -- the test bundle is a separate OSGi bundle, so package-private static does not reach it even under the same package name.
ff61a3f to
8044536
Compare
8044536 to
bb94bf9
Compare
|
Rebased on master (with #2894 in) on top of the rebased #2901, so this PR shows two commits until #2901 is merged; its own is bb94bf9, the three earlier commits squashed. All terminal tests pass. How to test, in a runtime Eclipse with this org.eclipse.terminal.control, Terminal view, local shell:
Unit tests: MouseReportTest (both encodings, modifiers, columns past 223) and the mode handling in VT100EmulatorTest. |
749285c to
ffb9ea9
Compare
c367d52 to
b535cd1
Compare
b535cd1 to
8aab65c
Compare
akurtakov
left a comment
There was a problem hiding this comment.
Thanks, clicking and scrolling in htop, mc and Vim is a big step, and Shift keeping the mouse for the terminal's own selection is the right convention. One scope request inline, plus a question and some small things:
- Question: while a program listens, a middle-click is reported to it and also pastes (
TabFolderManagerhas its own button-2 listener), and a right-click is reported and also opens the context menu. In Vim withmouse=aa middle-click moves the cursor and pastes. xterm and GNOME Terminal give these clicks to the program alone while it listens, and Shift gets the terminal's behaviour back; should it be the same here? fMouseModeandfSgrMouseEncodingare written by the reader job and read on the display thread, likefBracketedPastein #2901; please make themvolatiletoo.- Nits:
@since 5.6on the newITerminalControlForTextmethods names a version that doesn't exist (the bundle is at 1.2, and it's an internal interface, so the tag can go), andfFocusReportingwould read better with the other fields at the top.
8aab65c to
a3ff4e5
Compare
|
Thanks for the review. Pushed as a3ff4e5:
While going over it I also fixed: positions are now the program's screen, not the view (with history above the screen the view rarely starts on a whole line, so a click near the bottom of a row went one row down), a click over history the user scrolled back to stays with the terminal, a release lost to a dialog no longer leaves the next click half reported, and the legacy encoding reports nothing past column 223, as xterm. On macOS, Shift+wheel arrives as a horizontal scroll, so there history can only be scrolled with the scroll bar while a program listens. |
a3ff4e5 to
77dc7d0
Compare
|
The one failing check was SeparateVMTests.testExtensionPointType in the Ant UI tests on macOS ("Console is not closed"), which passed on the previous push and on Linux and Windows here; it looks unrelated to this change, and the macOS job is running again. All terminal tests pass. |
|
@akurtakov, a short status so this one does not get lost among the others:
Could you take another look when you have time? After this one I would suggest #3059 (parser rules) and then #2904 (grapheme clusters). If #2904 is too large to review in one go, I can split it into smaller PRs. |
|
I'm a bit overloaded right now, I'll get back to your PRs when time permits. Maybe someone else decides to jump int too . |
A program that redraws its screen in many writes can bracket each screen with CSI ? 2026 h and CSI ? 2026 l. The view polls the text every 50 ms and used to paint whatever it found, often a screen half drawn, which shows as flicker and as a cursor jumping over the screen. While a program is between the two, the canvas model does not look at the text, and the next poll after the end paints the finished screen. The guard is in the model's update(), so a scroll or a resize waits like a poll. A program that never ends a screen, or begins the next one right after, does not freeze the view: it is held back at most 200 ms since it last looked. A full reset or a disconnect ends the mode, and the last poll then shows what the program had drawn. As with DECTCEM, the flag is kept on the control and copied to the new canvas model under the same lock when the tab is moved to another view. Split out of eclipse-platform#2902 as asked in its review.
A program that redraws its screen in many writes can bracket each screen with CSI ? 2026 h and CSI ? 2026 l. The view polls the text every 50 ms and used to paint whatever it found, often a screen half drawn, which shows as flicker and as a cursor jumping over the screen. While a program is between the two, the canvas model does not look at the text, and the next poll after the end paints the finished screen. The guard is in the model's update(), so a scroll or a resize waits like a poll. A program that never ends a screen, or begins the next one right after, does not freeze the view: it is held back at most 200 ms since it last looked. A full reset or a disconnect ends the mode, and the last poll then shows what the program had drawn. As with DECTCEM, the flag is kept on the control and copied to the new canvas model under the same lock when the tab is moved to another view. Split out of eclipse-platform#2902 as asked in its review.
77dc7d0 to
527edb0
Compare
|
@akurtakov all checks are green now (the macOS failure was the Ant UI test SeparateVMTests.testExtensionPointType, which passed on the re-run; nothing changed in the code). Your review comments are addressed and synchronized output is out in #3066. @SougandhS, if you have time to look at this one, that would be much appreciated too. |
There was a problem hiding this comment.
🟡 Changes recommended
Mouse reporting corrupts legacy bytes under UTF-8 and drops release modifiers, while clearing selection loses the click anchor needed for subsequent Shift-drag.
3 open issues
What changed in this PR
Adds mouse reporting to Eclipse’s terminal so full-screen applications can receive clicks, drags, pointer movement, and wheel events. It builds on the DEC private-mode parsing changes described in #2901.
Changes:
- Handles mouse modes 1000, 1002, 1003, and SGR encoding mode 1006, including reset behavior.
- Routes mouse input to applications while preserving Shift-based terminal interaction.
- Adds encoding, mode-handling, and mouse-event routing tests.
| File | Description |
|---|---|
| terminal/tests/org.eclipse.terminal.test/src/org/eclipse/terminal/test/AutomatedTestSuite.java | Registers mouse UI tests. |
| terminal/tests/org.eclipse.terminal.test/src/org/eclipse/terminal/internal/textcanvas/TextCanvasMouseUITest.java | Tests event consumption and Shift handling. |
| terminal/tests/org.eclipse.terminal.test/src/org/eclipse/terminal/internal/emulator/VT100EmulatorTest.java | Tests mouse modes and reset behavior. |
| terminal/tests/org.eclipse.terminal.test/src/org/eclipse/terminal/internal/emulator/MouseReportTest.java | Tests report encoding and screen coordinates. |
| terminal/tests/org.eclipse.terminal.test/src/org/eclipse/terminal/internal/emulator/MockTerminalControlForText.java | Tracks mouse modes for tests. |
| terminal/tests/org.eclipse.terminal.test/src/org/eclipse/terminal/internal/emulator/AllTestSuite.java | Registers mouse encoding tests. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/TextCanvas.java | Routes mouse events and suppresses competing terminal actions. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/textcanvas/GridCanvas.java | Offers wheel events before local scrolling. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/emulator/VT100TerminalControl.java | Constructs and sends mouse reports. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/emulator/VT100Emulator.java | Handles mouse modes and exposes screen height. |
| terminal/bundles/org.eclipse.terminal.control/src/org/eclipse/terminal/internal/control/impl/ITerminalControlForText.java | Adds mouse-reporting control hooks. |
Review effort: Balanced
A program that redraws its screen in many writes can bracket each screen with CSI ? 2026 h and CSI ? 2026 l. The view polls the text every 50 ms and used to paint whatever it found, often a screen half drawn, which shows as flicker and as a cursor jumping over the screen. While a program is between the two, the canvas model does not look at the text, and the next poll after the end paints the finished screen. The check and the copy of the text are one locked step, so a screen cannot begin between them, and a scroll or a resize waits like a poll. A program that never ends a screen, or begins the next one right after, does not freeze the view: it is held back at most 200 ms since it last looked. A full reset or a disconnect ends the mode, and the last poll then shows what the program had drawn. As with DECTCEM, the flag is kept on the control and copied to the new canvas model under the same lock when the tab is moved to another view. Split out of eclipse-platform#2902 as asked in its review.
A program that redraws its screen in many writes can bracket each screen with CSI ? 2026 h and CSI ? 2026 l. The view polls the text every 50 ms and used to paint whatever it found, often a screen half drawn, which shows as flicker and as a cursor jumping over the screen. While a program is between the two, the canvas model does not look at the text, and the next poll after the end paints the finished screen. The check and the copy of the text are one locked step, so a screen cannot begin between them, and a scroll or a resize waits like a poll. A program that never ends a screen, or begins the next one right after, does not freeze the view: it is held back at most 200 ms since it last looked. A full reset or a disconnect ends the mode, and the last poll then shows what the program had drawn. As with DECTCEM, the flag is kept on the control and copied to the new canvas model under the same lock when the tab is moved to another view. Split out of eclipse-platform#2902 as asked in its review.
527edb0 to
47668bb
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The fallback selection anchor is not persisted, causing later Shift-drags to jump, and stale mouse-motion coordinates can suppress movement reports across separate drags.
2 open issues
3 resolved since last review
Review effort: Balanced
A program that redraws its screen in many writes can bracket each screen with CSI ? 2026 h and CSI ? 2026 l. The view polls the text every 50 ms and used to paint whatever it found, often a screen half drawn, which shows as flicker and as a cursor jumping over the screen. While a program is between the two, the canvas model does not look at the text, and the next poll after the end paints the finished screen. The check and the copy of the text are one locked step, so a screen cannot begin between them, and a scroll or a resize waits like a poll: the view moves with the next copy, not over the lines held back. A program that never ends a screen, or begins the next one right after, does not freeze the view: it is held back at most 200 ms since it last looked, on a clock that does not move with the time of day. A full reset or a disconnect ends the mode, and the last poll then shows what the program had drawn. As with DECTCEM, the flag is kept on the control and copied to the new canvas model under the same lock when the tab is moved to another view. Split out of eclipse-platform#2902 as asked in its review.
6f77683 to
e5574db
Compare
A program that redraws its screen in many writes can bracket each screen with CSI ? 2026 h and CSI ? 2026 l. The view polls the text every 50 ms and used to paint whatever it found, often a screen half drawn, which shows as flicker and as a cursor jumping over the screen. While a program is between the two, the canvas model does not look at the text, and the next poll after the end paints the finished screen. The check and the copy of the text are one locked step, so a screen cannot begin between them, and a scroll or a resize waits like a poll: the view moves with the next copy, not over the lines held back. A program that never ends a screen, or begins the next one right after, does not freeze the view: it is held back at most 200 ms since it last looked, on a clock that does not move with the time of day. A full reset or a disconnect ends the mode, and the last poll then shows what the program had drawn. As with DECTCEM, the flag is kept on the control and copied to the new canvas model under the same lock when the tab is moved to another view. Split out of eclipse-platform#2902 as asked in its review.
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues allow unmatched mouse drags, inconsistent wheel scrolling, and invalid selection anchors after clearing, while advertised focus-reporting and synchronized-output modes remain unsupported.
4 open issues
2 resolved since last review
Review effort: Balanced
a7a8562 to
9981af8
Compare
Programs that draw their own screen - htop, ncurses menus, and lately CLIs with clickable options and wheel scrolling - ask the terminal for mouse events with DEC modes 1000 (presses and releases), 1002 (also drags) and 1003 (every move), in xterm's legacy encoding or the SGR one (mode 1006). The terminal ignored the request and kept every click for its own selection, so such programs could not be clicked on or scrolled. The canvas now hands presses, releases, moves and the wheel to the control while a program has asked for them, with the alt and control keys folded into the button as xterm does. A click the program takes is the program's alone, as in xterm and GNOME Terminal: the middle-click does not also paste, the right-click opens no context menu (the menu key still does), and neither a double-click nor the copy on release acts on it. The canvas reports it in a listener that runs before every other and stops the event there. Shift keeps the mouse, the wheel included, for the terminal, which is the convention every terminal uses to still allow a selection while a program is listening; a button held down drags for the program only if its press went there. A wheel notch is three of the lines SWT counts, however its events split them, the rest counting toward the next notch in the same direction. Positions are the program's screen, counted from its first line, not from the top of the view: with history above the screen the view rarely starts on a whole line, and a click over the history the user scrolled back to is the terminal's, not the program's. The legacy encoding reports nothing past column or row 223, as xterm, rather than bytes it has no room for, and a release in it keeps the alt and control bits of its press. A report is sent as bytes, not through the terminal's text encoding, so a column or row past 95 stays the one byte the legacy encoding means. A press that went to the program takes the terminal's selection away and becomes the selection anchor, so a later shift-drag starts from where the user last clicked rather than from a selection made long before. A release goes wherever its press went, whatever the keyboard state by then, so press and release always reach the same side. This builds on the DEC private mode parsing change (every parameter in a set/reset), since ncurses turns the mouse on with CSI ? 1006 ; 1000 h. A reset, which runs before every connection, turns mouse reporting and SGR mouse encoding off, and nothing is reported while the terminal is not connected: a program cut off while it listened left the reports on for the next connection, and a click in between threw from writing to an output stream that no longer existed. The modes are written by the reader job and read on the display thread, so they are volatile, as is application cursor keys, which had the same gap. MouseReport.mouseReport is public, as the test bundle calls it across the bundle boundary.
9981af8 to
80f3e25
Compare
| fWheelLines += count; | ||
| int notches = Math.abs(fWheelLines) / 3; | ||
| fWheelLines %= 3; |


Programs that draw their own screen — htop, ncurses menus, and lately CLIs with clickable options and wheel scrolling — ask the terminal for mouse events with DEC modes 1000 (presses and releases), 1002 (also drags) and 1003 (every move), in xterm's legacy encoding or the SGR one (mode 1006). The terminal ignored the request and kept every click for its own selection, so such programs could not be clicked on or scrolled.
Synchronized output (2026), which was here at first, is in #3066.
Tests:
MouseReportTest(both encodings, modifiers, releases, bytes, cells on the screen),TextCanvasMouseUITest(a click the program takes goes no further, Shift keeps it) and mode handling inVT100EmulatorTest.