libghostty: mark semantic stream failures

The libghostty-vt stream is made to be infallible: in the case of any error
it just logs and moves on. That's because a terminal can't really... stop,
under normal operations. But, under special operations (fuzzing, replays,
etc.) it can and should stop!

Rather than make the operation fallible, its simply enough for me at least
to know that something went wrong. This is a simple change that adds a simple
flag that is flagged to true when such a scenario happens.

For normal Ghostty GUI operations, this isn't used at all. For libghostty
consumers they can choose to read it if they want, but don't have to.

This also adds a C API to read it.
This commit is contained in:
Mitchell Hashimoto
2026-07-17 12:20:38 -07:00
parent d7e9773329
commit 439d35e27c
3 changed files with 151 additions and 18 deletions

View File

@@ -1197,6 +1197,22 @@ typedef enum GHOSTTY_ENUM_TYPED {
* Output type: bool *
*/
GHOSTTY_TERMINAL_DATA_VIEWPORT_ACTIVE = 32,
/**
* Whether VT processing encountered a non-gracefully handled error that may
* have prevented a terminal-owned semantic update.
*
* Processing remains best-effort, and ghostty_terminal_reset() does not
* clear it. Gracefully handled protocol failures, configured limits,
* malformed or unsupported input, and failures limited to external effects
* or query responses do not set it.
*
* This can't currently be unset. This is purely informational to consumers
* if there was some error that happened at some point during VT processing.
*
* Output type: bool *
*/
GHOSTTY_TERMINAL_DATA_VT_PROCESSING_ERROR = 33,
GHOSTTY_TERMINAL_DATA_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
} GhosttyTerminalData;