471 Commits

Author SHA1 Message Date
Mitchell Hashimoto
b4ed0e6cbe terminal/new: saved cursor 2024-03-22 20:27:28 -07:00
Mitchell Hashimoto
7fe7c56e2b terminal/new: deleteChars 2024-03-22 20:27:28 -07:00
Mitchell Hashimoto
23b0c1fad9 terminal/new: insertBlanks, insert mode 2024-03-22 20:27:28 -07:00
Mitchell Hashimoto
dfd46a850b terminal/new: decaln 2024-03-22 20:27:28 -07:00
Mitchell Hashimoto
d38e075a7c terminal/new: lots more scroll region tests 2024-03-22 20:27:28 -07:00
Mitchell Hashimoto
1280301c08 terminal/new: left/right margins insertLines 2024-03-22 20:27:27 -07:00
Mitchell Hashimoto
09f8c17800 terminal/new: erase according to bg sgr 2024-03-22 20:27:27 -07:00
Mitchell Hashimoto
d30f50d5f0 terminal/new: cursorRight 2024-03-22 20:27:27 -07:00
Mitchell Hashimoto
a41239fddc terminal/new: cursorDown 2024-03-22 20:27:27 -07:00
Mitchell Hashimoto
14d25a4d82 terminal/new: cursorLeft 2024-03-22 20:27:27 -07:00
Mitchell Hashimoto
805abd4e29 terminal/new: couple missing tests 2024-03-22 20:27:27 -07:00
Mitchell Hashimoto
977f079fdd terminal/new: scrollUp 2024-03-22 20:27:27 -07:00
Mitchell Hashimoto
1a174dbb89 terminal/new: deleteLines 2024-03-22 20:27:26 -07:00
Mitchell Hashimoto
cc324b0cb7 terminal/new: index tests 2024-03-22 20:27:26 -07:00
Mitchell Hashimoto
0cbed73ff0 terminal/new: cursorUp and reverseIndex 2024-03-22 20:27:26 -07:00
Mitchell Hashimoto
d86a47266e terminal/new: one left/right margin test 2024-03-22 20:27:26 -07:00
Mitchell Hashimoto
893770d98d terminal/new: eraseChars 2024-03-22 20:27:26 -07:00
Mitchell Hashimoto
0f63cd6f01 terminal/new: scrollDown, top/bot margin tests, fix insertLines bug 2024-03-22 20:27:26 -07:00
Mitchell Hashimoto
6fb4fddedf terminal/new: insertLines 2024-03-22 20:27:26 -07:00
Mitchell Hashimoto
b053be0164 terminal/new: scrolling viewport 2024-03-22 20:27:26 -07:00
Mitchell Hashimoto
24dab9d01e terminal/new: graphemes 2024-03-22 20:27:25 -07:00
Mitchell Hashimoto
26b1a00380 terminal/new: non-grapheme zwjs 2024-03-22 20:27:25 -07:00
Mitchell Hashimoto
d87a1c694e terminal/new: setcursorpos tests 2024-03-22 20:27:25 -07:00
Mitchell Hashimoto
dd7bb1fab5 terminal/new: backspace, cursor left 2024-03-22 20:27:25 -07:00
Mitchell Hashimoto
4acbf09bb6 terminal/new: CR and LF 2024-03-22 20:27:25 -07:00
Mitchell Hashimoto
d95bde0af7 terminal/new: port many more tests 2024-03-22 20:27:25 -07:00
Mitchell Hashimoto
004405ccf9 terminal: only apply VS15/16 to emoji
Fixes #1482
2024-02-10 17:26:45 -08:00
Mitchell Hashimoto
f7c945c4a7 Merge pull request #1494 from mitchellh/grapheme-break
Optimized grapheme break detection (6x speedup)
2024-02-10 07:54:06 -08:00
Mitchell Hashimoto
6f8b4204b9 terminal: use new grapheme break algo 2024-02-09 20:31:20 -08:00
Gregory Anders
21412847c7 Reset status display after a full reset 2024-02-09 15:50:50 -06:00
Mitchell Hashimoto
8d891fb05c terminal: fast-path ASCII on char width 2024-02-08 21:28:14 -08:00
Mitchell Hashimoto
c838bfc1c1 terminal: swap to table implementatino 2024-02-08 21:17:30 -08:00
Mitchell Hashimoto
17dc64053e terminal: swap codepointwidth implementations 2024-02-07 09:38:17 -08:00
Mitchell Hashimoto
eb653907d6 config: grapheme-width-method sets mode 2027
Fixes #1403

This changes the behavior of `grapheme-width-method = unicode` to change
the default state of mode 2027 to true. Prior to this, setting this
config would force grapheme clustering regardless of mode 2027. Now,
this only sets the default and running TUI programs can disable it if
they want.
2024-02-02 12:13:13 -08:00
Mitchell Hashimoto
4b607a07fe terminal: avoid reading reset memory for preserving prompt
Fixes #1400
2024-01-28 08:58:43 -08:00
Mitchell Hashimoto
2d612ab168 terminal: preserve multi-point grapheme clusters on scrollback deletion
This codepath was not previously tested (an accident). Upon testing
this codepath its clear to see the logic was incorrect. When we have to
remove rows from our scrollback to fit new rows in the circular buffer,
we have to delete graphemes, but we were deleting them from the wrong
row offset.

For the row offset, we previously used the _active_ screen but the
proper offset is the _full_ screen. Tests verify.
2024-01-25 09:35:56 -08:00
Mitchell Hashimoto
628b54fbb5 Merge pull request #1344 from rockorager/reflow
reflow: respect wraparound mode when reflowing text
2024-01-21 09:12:18 -08:00
Mitchell Hashimoto
8b23d5c9ab terminal: handle wide character print at edge with wraparound disabled
Fixes #1343

If a wide character is found at the right edge of a terminal screen and
can't be printed without wrapping, the wide character is ignored. This
matches xterm behavior.

The one funky behavior is with grapheme clustering enabled and VS16
emoji. For VS16, we act as if VS16 was never received. This is not
specified in any way and no other terminal handles this correctly at the
time of authoring this so we're just making this up because it seems
most sensible.
2024-01-21 09:02:15 -08:00
Tim Culverhouse
6dcec75e32 reflow: add unit tests for wraparound mode
Add unit tests for resizing with wraparound on and off.
2024-01-21 07:02:06 -06:00
Tim Culverhouse
28732b950c reflow: respect wraparound mode when reflowing text
When calling resize, Ghostty should be respecting the wraparound state.
This behavior matches xterm. Note that this same bug was also found in
kitty.

Fixes: #1343
2024-01-21 06:43:22 -06:00
Mitchell Hashimoto
3e3c07619e terminal: soft-wrap inherits semantic prompt status of previous line
Fixes #1334
2024-01-19 18:58:28 -08:00
Mitchell Hashimoto
e9fe14c750 terminal: ECH resets line wrap state in any scenario 2024-01-19 14:31:33 -08:00
Mitchell Hashimoto
bab932431f terminal: erase line right should reset soft wrap state 2024-01-19 14:08:09 -08:00
Mitchell Hashimoto
b87bbd55c5 termio: handle termio thread failure by showing a message in window
Fixes #1301
2024-01-15 20:22:55 -08:00
Mitchell Hashimoto
adb7958f61 remove tracy usage from all files 2024-01-13 15:06:08 -08:00
Gregory Anders
060bdff117 terminal: track palette color in cell state
Rather than immediately converting a color palette index into an RGB
value for a cell color, when a palette color is used track the palette
color directly in the cell state and convert to an RGB value in the
renderer.

This causes palette color changes to take effect immediately instead of
only for newly drawn cells.
2024-01-02 22:34:06 -06:00
Mitchell Hashimoto
53dffc8e18 termio/exec: style the exec failure error better 2023-12-30 19:34:45 -08:00
Mitchell Hashimoto
3e9a4ea234 terminal: cub with reverse wrap consumes pending wrap state as one
Related to #1184

See the updated website page and associated test.
2023-12-29 12:45:57 -08:00
Mitchell Hashimoto
fdd519f73b terminal: cursor back should not reduce by one with pending wrap
Fixes #1183

I'm not sure why the original logic was there. When I translated the
original test cases to shell and ran them in xterm, they did NOT match
what Ghostty expected. This updates the tests to match xterm and removes
this case. We can add back in more tests if/when we figure out under
what scenario this original logic was correct (if it ever was).
2023-12-29 12:34:33 -08:00
Mitchell Hashimoto
8b3094465d config: grapheme-width-method, default to "unicode"
This adds a new configuration `grapheme-width-method` to change the
default behavior that Ghostty uses to calculate grapheme width. The
default value is `unicode` which is identical to setting mode 2027.

**IMPORTANT:** This changes the default Ghostty behavior to be fully
grapheme-aware including ZWJs, VS15, VS16. This may cause issues with
some legacy programs and shells.

I've changed my mind that this should become the default because enough
people use emojis now that I've found in the beta program there are more
issues reported about "incorrect emoji width" than any possibly desync
issues. We'll see.

For legacy programs, this can still be set to `grapheme-width-method =
wcswidth`.
2023-12-25 14:19:05 -08:00