mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-24 01:40:12 -05:00
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:
parent
dccbdb97cd
commit
beb4556dc0
4 changed files with 92 additions and 31 deletions
21
terminal.c
21
terminal.c
|
|
@ -1404,6 +1404,11 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
|
|||
.ime_enabled = true,
|
||||
#endif
|
||||
.active_notifications = tll_init(),
|
||||
.multi_cursor = {
|
||||
.shapes = NULL,
|
||||
.cursor_color = MULTI_CURSOR_COLOR_PRIMARY,
|
||||
.text_color = MULTI_CURSOR_COLOR_PRIMARY,
|
||||
},
|
||||
};
|
||||
|
||||
pixman_region32_init(&term->render.last_overlay_clip);
|
||||
|
|
@ -1946,6 +1951,7 @@ term_destroy(struct terminal *term)
|
|||
free(term->color_stack.stack);
|
||||
|
||||
pixman_region32_fini(&term->multi_cursor.active);
|
||||
free(term->multi_cursor.shapes);
|
||||
|
||||
int ret = EXIT_SUCCESS;
|
||||
|
||||
|
|
@ -2090,6 +2096,15 @@ term_theme_apply(struct terminal *term, const struct color_theme *theme)
|
|||
memcpy(term->colors.table, theme->table, sizeof(term->colors.table));
|
||||
}
|
||||
|
||||
void
|
||||
term_remove_all_multi_cursors(struct terminal *term)
|
||||
{
|
||||
pixman_region32_fini(&term->multi_cursor.active);
|
||||
pixman_region32_init(&term->multi_cursor.active);
|
||||
free(term->multi_cursor.shapes);
|
||||
term->multi_cursor.shapes = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
term_reset(struct terminal *term, bool hard)
|
||||
{
|
||||
|
|
@ -2170,6 +2185,12 @@ term_reset(struct terminal *term, bool hard)
|
|||
term->bits_affecting_ascii_printer.value = 0;
|
||||
term_update_ascii_printer(term);
|
||||
|
||||
term_remove_all_multi_cursors(term);
|
||||
term->multi_cursor.cursor_color_source = MULTI_CURSOR_COLOR_PRIMARY;
|
||||
term->multi_cursor.text_color_source = MULTI_CURSOR_COLOR_PRIMARY;
|
||||
term->multi_cursor.cursor_color = 0;
|
||||
term->multi_cursor.text_color = 0;
|
||||
|
||||
if (!hard)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue