393 Commits

Author SHA1 Message Date
Mitchell Hashimoto
df52fae76a terminal: check OSC parser for tmux 112 sequences from HN
Saw this on HN:
https://github.com/darrenstarr/VtNetCore/pull/14

I wanted to see if ghostty was vulnerable to it (it is not). But, its a
good example of a weird edge case in the wild and I wanted to make sure
it was redundantly tested. It looks like we read the "spec" (blog posts,
man pages, source of other terminal using tools, etc.) right.
2023-01-17 21:47:38 -08:00
Mitchell Hashimoto
e210c91d10 update zig version, update @call for newer zig version 2022-12-16 22:34:54 -08:00
Mitchell Hashimoto
ad9b773cd8 terminal: printing char outside of ASCII with non-UTF8 charset is space 2022-12-14 21:50:32 -08:00
Mitchell Hashimoto
4fae29ff13 terminal: scrollRegionUp outside of range does nothing 2022-12-14 21:43:47 -08:00
Mitchell Hashimoto
6f451f22bb terminal: only clear wide spacer head if wide char is not on first line 2022-12-14 21:39:45 -08:00
Mitchell Hashimoto
8534e5a186 terminal: insertLines with count 0 no longer crashes 2022-12-14 21:29:06 -08:00
Mitchell Hashimoto
0592e4fa1a terminal: osc parser gracefully handles input data larger than buffer 2022-12-14 21:24:43 -08:00
Mitchell Hashimoto
c7a28fab20 terminal: don't crash if cell claims to have grapheme but doesn't 2022-12-14 21:19:23 -08:00
Mitchell Hashimoto
4a3e2b35b9 terminal: parse table needs to have room for all chars 2022-12-14 21:10:22 -08:00
Mitchell Hashimoto
36c6e95dfc terminal: ignore invalid C0 escape codes 2022-12-14 20:57:31 -08:00
Mitchell Hashimoto
c01a9f583f zero-width chars are ignored if they're at col 0
This can cause a crash, and is impossible since zero-width chars are
always attached to a prior character. Word-wrapping doesn't come into
play here because this check happens prior to the wrapping.
2022-12-14 19:20:05 -08:00
Mitchell Hashimoto
10f708ee65 wasm: export terminal core API 2022-12-05 21:27:20 -08:00
Mitchell Hashimoto
29cc8312d5 revert 2022-11-27 21:45:10 -08:00
Mitchell Hashimoto
4a3376d916 fix crash with cursor going off screen on resize 2022-11-27 21:06:11 -08:00
Mitchell Hashimoto
b8832833cb respect application cursor keys for arrow (DECCKM)
This fixes the arrow keys in htop.
2022-11-27 20:57:58 -08:00
Mitchell Hashimoto
bfc657395a curly underlines 2022-11-27 16:11:15 -08:00
Mitchell Hashimoto
c2d08c3071 terminal: parse all underline styles 2022-11-27 15:39:12 -08:00
Mitchell Hashimoto
5045e51b99 unknown underline styles render a single underline 2022-11-27 15:30:49 -08:00
Mitchell Hashimoto
d7fe6a1c47 fix sgr parsing for underline styles 2022-11-27 15:30:02 -08:00
Mitchell Hashimoto
584149121d use enum for underline styles 2022-11-27 14:16:51 -08:00
Mitchell Hashimoto
3fbeca914b terminal: fix possible crash when increasing columns in resize
If a cell has graphemes attached to it, we'd share the grapheme map.
This copies it.
2022-11-26 17:44:08 -08:00
Mitchell Hashimoto
d64b0e371e terminal: copy grapheme map when resizing and ensure proper cleanup 2022-11-26 17:33:52 -08:00
Mitchell Hashimoto
70b017200a copying selection trims trailing whitespace
This is configurable with `clipboard-trim-trailing-spaces`.

This also fixes a bug where debug builds would crash when copying blank
lines. This never affected release builds.
2022-11-22 21:27:05 -08:00
Mitchell Hashimoto
d1b565f4d4 hook up triple-click in UI to select lines 2022-11-22 10:07:52 -08:00
Mitchell Hashimoto
8b839ef4b6 screen selectLine and tests 2022-11-22 10:03:20 -08:00
Mitchell Hashimoto
04088abe5a fix regression around selecting word at end of screen 2022-11-22 09:41:07 -08:00
Mitchell Hashimoto
a63815c5ba selectWord goes across soft-wrapped lines 2022-11-22 08:04:27 -08:00
Mitchell Hashimoto
f7c6ea63e1 screen selectWord starting functionality, not done at all 2022-11-21 21:34:38 -08:00
Mitchell Hashimoto
56de5846f4 OSC 52: Clipboard Control (#52)
This adds support for OSC 52 -- applications can read/write the clipboard. Due to the security risk of this, the default configuration allows for writing but _not reading_. This is configurable using two new settings: `clipboard-read` and `clipboard-write` (both booleans).
2022-11-21 15:12:00 -08:00
Mitchell Hashimoto
d213c1a939 fix selection regression caused by screen copy optimization 2022-11-20 20:05:07 -08:00
Mitchell Hashimoto
01573819ea Configurable 256 Color Palette (#50)
The 256 color palette can now be configured with the `palette=N=HEX` format in the config. Example, Dracula:

```
foreground=#f8f8f2
background=#282a36
palette=0=#21222c
palette=8=#6272a4
palette=1=#ff5555
palette=9=#ff6e6e
palette=2=#50fa7b
palette=10=#69ff94
palette=3=#f1fa8c
palette=11=#ffffa5
palette=4=#bd93f9
palette=12=#d6acff
palette=5=#ff79c6
palette=13=#ff92df
palette=6=#8be9fd
palette=14=#a4ffff
palette=7=#f8f8f2
palette=15=#ffffff
```
2022-11-20 15:25:51 -08:00
Mitchell Hashimoto
02b6eb123e fix test name 2022-11-18 18:18:10 -08:00
Mitchell Hashimoto
dbf167d18a OSC parsing for get/set clipboard (OSC 52) -- not hooked up yet 2022-11-18 18:16:53 -08:00
Mitchell Hashimoto
a714ee2702 fix memory leak when grapheme clusters of >4 codepoints are present 2022-11-18 14:15:14 -08:00
Mitchell Hashimoto
69fdd57aa3 screen: support scroll region scrolling with circular buffer wraparound 2022-11-16 09:28:56 -08:00
Mitchell Hashimoto
4ced2290b3 OSC handling, handle OSC change window title command 2022-11-14 10:46:40 -08:00
Mitchell Hashimoto
99224ae2c0 implement CSI ESC [ <n> b for repeating previously printed char 2022-11-13 22:07:40 -08:00
Mitchell Hashimoto
feccd550c3 implement many more reset sgr attributes 2022-11-13 21:54:26 -08:00
Mitchell Hashimoto
23e7b8d63e The cursor should be reset on entering the alt screen 2022-11-13 21:43:59 -08:00
Mitchell Hashimoto
019f1e34bb metal: copy screen data (see opengl commit for why) 2022-11-13 17:29:23 -08:00
Mitchell Hashimoto
3fcdd9a196 fix outdated test 2022-11-13 16:25:50 -08:00
Mitchell Hashimoto
f1c69343d3 opengl: copy screen data instead of sharing state
Through benchmarking I've determined this lowers lock contention by
about 50% on the critical data.
2022-11-13 16:16:08 -08:00
Mitchell Hashimoto
ce85d9a2cd add more tracing, unroll a loop 2022-11-08 19:15:14 -08:00
Mitchell Hashimoto
d1718e6cbf use libc memcpy/memmove instead of std.mem if available 2022-11-08 19:01:45 -08:00
Mitchell Hashimoto
a471eaf980 drop a couple function calls and optimize scrolling a bit 2022-11-08 18:35:19 -08:00
Mitchell Hashimoto
306ab947e7 implement region scrolling directly in screen to use memcpy
This doubles scroll region scrolling speed.
2022-11-08 17:35:15 -08:00
Mitchell Hashimoto
8a871e1294 missing trace 2022-11-08 13:57:12 -08:00
Mitchell Hashimoto
c1a9184ebd sgr: parse italic (render not implemented) 2022-11-07 14:04:40 -08:00
Mitchell Hashimoto
9ee5a5c715 implement ESC c -- full reset 2022-11-06 18:59:17 -08:00
Mitchell Hashimoto
a05b08fdc7 move bracketed paste to terminal state 2022-11-05 19:31:28 -07:00