Commit 9edde69
committed
Track DECSET/DECRST 1007 (Alternate Scroll Mode)
Private mode 1007 is xterm's Alternate Scroll Mode, which corresponds to its
alternateScroll resource: while the alternate screen is active and the
application has not enabled mouse tracking, the terminal translates wheel
input into cursor up/down keys, so full-screen programs that do not read the
mouse (less, vim without mouse=a) still respond to scrolling.
SwiftTerm currently drops 1007 into the "Unhandled DEC Private Mode" branch,
so an embedder that implements this translation has no way to let an
application turn it off, and DECRQM cannot answer a query about it.
This only tracks the state and exposes it as Terminal.alternateScrollMode;
translating wheel events stays with the host view, as with the other mouse
state SwiftTerm tracks. The mode is wired into DECSET, DECRST, DECRQM and
RIS, matching how 1004 is handled.
One deliberate choice worth a second opinion: the default here is true,
matching Ghostty (src/terminal/modes.zig marks mouse_alternate_scroll
default true), while xterm's own alternateScroll resource defaults to false.
True keeps the wheel working out of the box in less/vim, which is what
users on macOS terminals tend to expect, but I am happy to flip it to false
to match xterm if you would rather follow the reference implementation.1 parent 1052996 commit 9edde69
2 files changed
Lines changed: 97 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
479 | 489 | | |
480 | 490 | | |
481 | 491 | | |
| |||
954 | 964 | | |
955 | 965 | | |
956 | 966 | | |
| 967 | + | |
957 | 968 | | |
958 | 969 | | |
959 | 970 | | |
| |||
4428 | 4439 | | |
4429 | 4440 | | |
4430 | 4441 | | |
| 4442 | + | |
| 4443 | + | |
4431 | 4444 | | |
4432 | 4445 | | |
4433 | 4446 | | |
| |||
5257 | 5270 | | |
5258 | 5271 | | |
5259 | 5272 | | |
| 5273 | + | |
| 5274 | + | |
5260 | 5275 | | |
5261 | 5276 | | |
5262 | 5277 | | |
| |||
5356 | 5371 | | |
5357 | 5372 | | |
5358 | 5373 | | |
| 5374 | + | |
| 5375 | + | |
5359 | 5376 | | |
5360 | 5377 | | |
5361 | 5378 | | |
| |||
5506 | 5523 | | |
5507 | 5524 | | |
5508 | 5525 | | |
| 5526 | + | |
| 5527 | + | |
5509 | 5528 | | |
5510 | 5529 | | |
5511 | 5530 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
0 commit comments