libghostty: expose viewport active state

Expose whether the terminal viewport is currently pinned to the active
area through the libghostty-vt terminal data API. Previously embedders
could only infer this from scrollbar geometry, which was indirect and
could require the more expensive scrollbar calculation.

The new GHOSTTY_TERMINAL_DATA_VIEWPORT_ACTIVE value returns the exact
PageList viewport state as a bool. The scroll viewport test now verifies
the value while moving between the active area and scrollback.
This commit is contained in:
Mitchell Hashimoto
2026-05-27 15:23:48 -07:00
parent 6d089a544d
commit f730ee0557
2 changed files with 23 additions and 1 deletions

View File

@@ -901,6 +901,16 @@ typedef enum GHOSTTY_ENUM_TYPED {
* Output type: GhosttySelection *
*/
GHOSTTY_TERMINAL_DATA_SELECTION = 31,
/**
* Whether the viewport is currently pinned to the active area.
*
* This is true when the viewport is following the active terminal area,
* and false when the user has scrolled into history.
*
* Output type: bool *
*/
GHOSTTY_TERMINAL_DATA_VIEWPORT_ACTIVE = 32,
GHOSTTY_TERMINAL_DATA_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
} GhosttyTerminalData;