libghostty: add option to set default cursor style

Adds an option to `libghostty-vt` to configure the default cursor style
that should be displayed when an app sends a DECSCUSR reset sequence
(`CSI 0 q`).
This commit is contained in:
Riccardo Mazzarini
2026-06-02 17:57:41 +02:00
parent 6246c288ae
commit 2444e4d557
3 changed files with 74 additions and 2 deletions

View File

@@ -232,6 +232,26 @@ typedef enum GHOSTTY_ENUM_TYPED {
GHOSTTY_TERMINAL_SCREEN_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
} GhosttyTerminalScreen;
/**
* Visual style of the terminal cursor.
*
* @ingroup terminal
*/
typedef enum GHOSTTY_ENUM_TYPED {
/** Bar cursor (DECSCUSR 5, 6). */
GHOSTTY_TERMINAL_CURSOR_STYLE_BAR = 0,
/** Block cursor (DECSCUSR 1, 2). */
GHOSTTY_TERMINAL_CURSOR_STYLE_BLOCK = 1,
/** Underline cursor (DECSCUSR 3, 4). */
GHOSTTY_TERMINAL_CURSOR_STYLE_UNDERLINE = 2,
/** Hollow block cursor. */
GHOSTTY_TERMINAL_CURSOR_STYLE_BLOCK_HOLLOW = 3,
GHOSTTY_TERMINAL_CURSOR_STYLE_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
} GhosttyTerminalCursorStyle;
/**
* Scrollbar state for the terminal viewport.
*
@@ -608,6 +628,15 @@ typedef enum GHOSTTY_ENUM_TYPED {
* Input type: GhosttySelection*
*/
GHOSTTY_TERMINAL_OPT_SELECTION = 21,
/**
* Set the default cursor style used by DECSCUSR reset (CSI 0 q).
*
* A NULL value pointer resets to the built-in default block cursor.
*
* Input type: GhosttyTerminalCursorStyle*
*/
GHOSTTY_TERMINAL_OPT_DEFAULT_CURSOR_STYLE = 22,
GHOSTTY_TERMINAL_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
} GhosttyTerminalOption;