Commit Graph

38 Commits

Author SHA1 Message Date
Kat
6fabf775bb Lots of duplicate word typos + typo. 2026-03-16 09:19:09 +11:00
Mitchell Hashimoto
2044e5030f terminal: make stream processing infallible
The terminal.Stream next/nextSlice functions can now no longer fail.
All prior failure modes were fully isolated in the handler `vt`
callbacks. As such, vt callbacks are now required to not return an error
and handle their own errors somehow.

Allowing streams to be fallible before was an incorrect design. It
caused problematic scenarios like in `nextSlice` early terminating
processing due to handler errors. This should not be possible.

There is no safe way to bubble up vt errors through the stream because
if nextSlice is called and multiple errors are returned, we can't
coalesce them. We could modify that to return a partial result but its
just more work for stream that is unnecessary. The handler can do all of
this.

This work was discovered due to cleanups to prepare for more C APIs.
Less errors make C APIs easier to implement! And, it helps clean up our
Zig, too.
2026-03-13 13:56:14 -07:00
Mitchell Hashimoto
2a62f21bf0 fix tests 2026-02-19 14:10:33 -08:00
Mitchell Hashimoto
26b104c9e0 terminal: Fix possible crash on RenderState with invalid mouse point
Fixes #10032
2025-12-26 10:45:15 -08:00
Mitchell Hashimoto
5a2f5a6b9e terminal: RenderState linkCells needs to use Page y not Viewport y
Fixes #9957

Our `Page.getRowAndCell` uses a _page-relative_ x/y coordinate system
and we were passing in viewport x/y. This has the possibility to leading
to all sorts of bugs, including the crash found in #9957 but also simply
reading the wrong cell even in single-page scenarios.
2025-12-18 13:54:35 -08:00
Mitchell Hashimoto
d7087627d7 terminal: renderstate needs to reset highlights on dirty
This fixes memory corruption where future matches on a fully dirty row
would write highlights out of bounds. It was easy to reproduce in debug
by searching for `$` in `ghostty +boo`
2025-11-30 07:18:42 -08:00
Mitchell Hashimoto
10f19ebdc3 search: handle soft-wrapped lines in sliding window properly
Fixes #9752
2025-11-29 07:32:06 -08:00
Mitchell Hashimoto
b96b55ebde terminal: RenderState must consider first row in dirty page dirty 2025-11-26 13:20:16 -08:00
Mitchell Hashimoto
880db9fdd0 renderer: hook up search selection match highlighting 2025-11-25 11:05:38 -08:00
Mitchell Hashimoto
a4e40c7567 set proper dirty state to redo viewport search 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
dd9ed531ad render viewport matches 2025-11-24 19:55:27 -08:00
Mitchell Hashimoto
df466f3c73 renderer: make cursorStyle depend on RenderState
This makes `cursorStyle` utilize `RenderState` to determine the
appropriate cursor style. This moves the cursor style logic outside the
critical area, although it was cheap to begin with.

This always removes `viewport_is_bottom` which had no practical use.
2025-11-22 14:36:53 -08:00
Mitchell Hashimoto
82f5c1a13c renderer: clear renderstate memory periodically 2025-11-21 09:03:03 -08:00
Mitchell Hashimoto
c892599385 terminal: cache some selection state to make render state faster 2025-11-20 22:00:44 -08:00
Mitchell Hashimoto
7728620ea8 terminal: render state dirty state 2025-11-20 22:00:44 -08:00
Mitchell Hashimoto
86fcf9ff4a terminal: render state selection 2025-11-20 22:00:44 -08:00
Mitchell Hashimoto
a15f13b962 terminal: renderstate tests 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
5d58487fb8 terminal: update renderstate to use new assert 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
6e5e24c3ca terminal: fix lib-vt test builds 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
cd00a8a2ab renderer: handle normal non-osc8 links with new render state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
fa26e9a384 terminal: OSC8 hyperlinks in render state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
81142265aa terminal: renderstate stores pins 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
b8363a8417 terminal: update render state for new dirty tracking 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
07115ce9a9 terminal: render state contains raw row data 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
d1e87c73fb terminal: renderstate now has terminal colors 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
ebc8bff8f1 renderer: switch to using render state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
9162e71bcc terminal: render state contains cursor state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
29db3e0295 terminal: setup selection state on render state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
0e13fd6b73 terminal: add more render state tests 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
4caefb807c terminal: fix up some performance issues with render state 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
5d85f2382e terminal: render state needs to preserve as much allocation as possible 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
a860801323 terminal: updating render state with tests 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
3f7cee1e99 terminal: render state fixes for empty cells 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
a66963e3f8 terminal: full redraw state tracking on render state 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
bbbeacab79 terminal: renderstate needs dirty state 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
60fe4af8ac terminal: render state style get requires non-default style 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
789b3dd38d terminal: RenderState.row_data is a MultiArrayList 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
a90fe1656a terminal: RenderState 2025-11-20 22:00:42 -08:00