multi-cursor: wip: track cursor shapes and colors

And erase all extra cursors on reset, resize and clear
screen/scrollback (ED 2/3).
This commit is contained in:
Daniel Eklöf 2025-08-27 13:43:12 +02:00
parent dccbdb97cd
commit beb4556dc0
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 92 additions and 31 deletions

View file

@ -407,6 +407,23 @@ struct colors {
enum which_color_theme active_theme;
};
/* Synchronized with the multi-cursor protocol specification */
enum multi_cursor_shape {
MULTI_CURSOR_SHAPE_NONE = 0,
MULTI_CURSOR_SHAPE_BLOCK = 1,
MULTI_CURSOR_SHAPE_BEAM = 2,
MULTI_CURSOR_SHAPE_UNDERLINE = 3,
MULTI_CURSOR_SHAPE_PRIMARY = 29,
};
/* Synchronized with the multi-cursor protocol specification */
enum multi_cursor_color_source {
MULTI_CURSOR_COLOR_PRIMARY = 0,
MULTI_CURSOR_COLOR_SPECIAL = 1,
MULTI_CURSOR_COLOR_RGB = 2,
MULTI_CURSOR_COLOR_256 = 5,
};
struct terminal {
struct fdm *fdm;
struct reaper *reaper;
@ -834,6 +851,11 @@ struct terminal {
struct {
pixman_region32_t active;
enum multi_cursor_shape *shapes; /* Flattened 2-dimensional array */
enum multi_cursor_color_source cursor_color_source;
enum multi_cursor_color_source text_color_source;
uint32_t cursor_color;
uint32_t text_color;
} multi_cursor;
};
@ -992,6 +1014,8 @@ void term_theme_switch_to_1(struct terminal *term);
void term_theme_switch_to_2(struct terminal *term);
void term_theme_toggle(struct terminal *term);
void term_remove_all_multi_cursors(struct terminal *term);
static inline void term_reset_grapheme_state(struct terminal *term)
{
#if defined(FOOT_GRAPHEME_CLUSTERING)