summaryrefslogtreecommitdiff
path: root/src/terminal/modes.zig
AgeCommit message (Collapse)Author
2025-10-04Move paste encoding to the input package, test, optimize away one allocMitchell Hashimoto
This moves our paste logic to `src/input` in preparation for exposing this as part of libghostty-vt. This yields an immediate benefit of unit tests for paste encoding. Additionally, we were able to remove one allocation on every unbracketed paste path unless the input specifically contains a newline. Unlikely to be noticable, but nice. NOTE: This also includes one change in behavior: we no longer encode `\r\n` and a single `\r`, but as a duplicate `\r\r`. This matches xterm behavior and I don't think will result in any issues since duplicate carriage returns should do nothing in well-behaved terminals.
2025-06-09feat: implement mode 1048 for saving/restoring cursor positionAlex Straight
2025-05-27add support for buffer switching with CSI ? 47 h/lJonatan Borkowski
2025-03-12Lots of 0.14 changesMitchell Hashimoto
2024-11-29terminal: reset should preserve desired default mode valuesMitchell Hashimoto
Fixes #2857 Some terminal modes always reset, but there are others that should be conditional based on how the terminal's default state is configured. Primarily from #2857 is the grapheme clustering mode (mode 2027) which was always resetting to false but should be conditional based on the the `grapheme-width-method` configuration.
2024-07-17terminal: implement in-band size reports (Mode 2048)Mitchell Hashimoto
https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83
2024-03-13update zigMitchell Hashimoto
2024-02-02terminal: support mode 2031Mitchell Hashimoto
2024-01-09input: manage application keypad state with mode 1035Mitchell Hashimoto
Fixes #1099 We previously applied application keypad mode logic (`ESC=` or mode 66) whenever it was active. However, from looking at the behavior of other terminals (xterm and foot) it appears this isn't correct. For xterm, application keypad mode only applies unconditionally if the keyboard mode is VT220 (`-kt vt220`). For modern terminals, application keypad mode is only applied if mode 1035 is disabled. Mode 1035 is the "ignore numpad state with keypad mode" mode. It defaults to true on terminal startup. If this is true, keypads are always encoded in numerical mode. If this is false, the numlock state will be respected.
2024-01-08fix: update code to compile with 0.12.0-dev.2075+f5978181eTristan Partin
2023-12-05terminal: implement mode 1047 (alternate screen)Tim Culverhouse
Implement handling of mode 1047, which enters the alternate screen. This is not used often, typically applications will favor 1049 (enter alt screen, save cursor, clear alt screen).
2023-11-21terminal: know about autorepeat modeMitchell Hashimoto
Ignore it because xterm does
2023-11-12terminal: our mode size changedMitchell Hashimoto
2023-11-12xterm audit: slow scroll (DECSCLM)Mitchell Hashimoto
2023-10-24inspector: show modesMitchell Hashimoto
2023-10-15terminal: save cursor and restore cursor xterm auditMitchell Hashimoto
2023-10-12terminal: linefeed modeMitchell Hashimoto
2023-10-12website: document srm modeMitchell Hashimoto
2023-10-12terminal: KAM (mode 2)Mitchell Hashimoto
This has an associated config `vt-kam-allowed` which defaults to "false" since this mode can cause the terminal to become mostly unusable. We include this mode for completions sake however.
2023-10-10Enable left/right margin supportMitchell Hashimoto
2023-10-10terminal: RIS should reset tabstops, ESC ? W should reset every 8Mitchell Hashimoto
Fixes #648 Two issues here: - RIS should've been resetting the tabstops to every 8, but was clearing all tabstops. - `ESC ? W` should've reset tabstops to every 8, but was clearing all tabstops.
2023-10-09terminal: set left and right margins, left and right margin mode 69Mitchell Hashimoto
2023-10-09terminal: handle ansi vs dec modeMitchell Hashimoto
Previously, we just ignored ansi vs dec modes (`?`-prefix) and just responded to both requests most of the time using the number as the unique value. This _kind of works_ because almost all DEC modes do not overlap with ANSI modes, but some overlap (i.e. `insert`, ANSI mode 4). This commit properly separates ANSI vs DEC modes and updates all of our terminal sequences to handle both (where applicable -- some sequences are explicitly DEC-only).
2023-10-09terminal: enable alternate scroll mode by defaultMitchell Hashimoto
Fixes #641 xterm does not so there is an argument to not doing this but a lot of other terminals do. Having this on by default makes things like less scroll with the mouse wheel by default which is nice to have.
2023-10-07terminal: alternate scroll (mode 1007) should not be enabled by defaultMitchell Hashimoto
2023-10-06terminal: cursor back handles reverse wrap (mode 45)Mitchell Hashimoto
2023-10-06terminal: cursor back should reduce count if pending wrap is oneMitchell Hashimoto
2023-10-02terminal: mode 2027Mitchell Hashimoto
2023-09-09Big Cursor State RefactorMitchell Hashimoto
This makes a few major changes: - cursor style on terminal is single source of stylistic truth - cursor style is split between style and style request - cursor blinking is handled by the renderer thread - cursor style/visibility is no longer stored as persistent state on renderers - cursor style computation is extracted to be shared by all renderers - mode 12 "cursor_blinking" is now source of truth on whether blinking is enabled or not - CSI q and mode 12 are synced like xterm
2023-08-28termio: handle all the synchronized output setting, timerMitchell Hashimoto
2023-08-15terminal: ModeState can save/restore one set of modesMitchell Hashimoto
2023-08-15terminal: working on new modes storage abstractionMitchell Hashimoto