Use global cursor style and colour options for modes instead of default,

GitHub issue 4117.
This commit is contained in:
nicm 2024-10-01 08:01:19 +00:00
parent 17bab32794
commit 1c1f4c1219
4 changed files with 17 additions and 9 deletions

View File

@ -170,6 +170,20 @@ screen_reset_tabs(struct screen *s)
bit_set(s->tabs, i); bit_set(s->tabs, i);
} }
/* Set default cursor style and colour from options. */
void
screen_set_default_cursor(struct screen *s, struct options *oo)
{
int c;
c = options_get_number(oo, "cursor-colour");
s->default_ccolour = c;
c = options_get_number(oo, "cursor-style");
s->default_mode = 0;
screen_set_cursor_style(c, &s->default_cstyle, &s->default_mode);
}
/* Set screen cursor style and mode. */ /* Set screen cursor style and mode. */
void void
screen_set_cursor_style(u_int style, enum screen_cursor_style *cstyle, screen_set_cursor_style(u_int style, enum screen_cursor_style *cstyle,

1
tmux.h
View File

@ -3014,6 +3014,7 @@ void screen_reinit(struct screen *);
void screen_free(struct screen *); void screen_free(struct screen *);
void screen_reset_tabs(struct screen *); void screen_reset_tabs(struct screen *);
void screen_reset_hyperlinks(struct screen *); void screen_reset_hyperlinks(struct screen *);
void screen_set_default_cursor(struct screen *, struct options *);
void screen_set_cursor_style(u_int, enum screen_cursor_style *, int *); void screen_set_cursor_style(u_int, enum screen_cursor_style *, int *);
void screen_set_cursor_colour(struct screen *, int); void screen_set_cursor_colour(struct screen *, int);
int screen_set_title(struct screen *, const char *); int screen_set_title(struct screen *, const char *);

View File

@ -417,6 +417,7 @@ window_copy_common_init(struct window_mode_entry *wme)
data->jumpchar = NULL; data->jumpchar = NULL;
screen_init(&data->screen, screen_size_x(base), screen_size_y(base), 0); screen_init(&data->screen, screen_size_x(base), screen_size_y(base), 0);
screen_set_default_cursor(&data->screen, global_w_options);
data->modekeys = options_get_number(wp->window->options, "mode-keys"); data->modekeys = options_get_number(wp->window->options, "mode-keys");
evtimer_set(&data->dragtimer, window_copy_scroll_timer, wme); evtimer_set(&data->dragtimer, window_copy_scroll_timer, wme);

View File

@ -1686,15 +1686,7 @@ window_set_fill_character(struct window *w)
void void
window_pane_default_cursor(struct window_pane *wp) window_pane_default_cursor(struct window_pane *wp)
{ {
struct screen *s = wp->screen; screen_set_default_cursor(wp->screen, wp->options);
int c;
c = options_get_number(wp->options, "cursor-colour");
s->default_ccolour = c;
c = options_get_number(wp->options, "cursor-style");
s->default_mode = 0;
screen_set_cursor_style(c, &s->default_cstyle, &s->default_mode);
} }
int int