From: nicm Date: Tue, 1 Oct 2024 08:01:19 +0000 (+0000) Subject: Use global cursor style and colour options for modes instead of default, X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d1cbf82e13469de3d1070a8404a440b8b01e8ae3;p=openbsd Use global cursor style and colour options for modes instead of default, GitHub issue 4117. --- diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c index 182d6a89428..e70edd5fdb9 100644 --- a/usr.bin/tmux/screen.c +++ b/usr.bin/tmux/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.86 2024/08/21 04:17:09 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.87 2024/10/01 08:01:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -170,6 +170,20 @@ screen_reset_tabs(struct screen *s) 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. */ void screen_set_cursor_style(u_int style, enum screen_cursor_style *cstyle, diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 19b429d0f44..5a927860dfa 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1230 2024/10/01 06:15:47 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1231 2024/10/01 08:01:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -3014,6 +3014,7 @@ void screen_reinit(struct screen *); void screen_free(struct screen *); void screen_reset_tabs(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_colour(struct screen *, int); int screen_set_title(struct screen *, const char *); diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index eb830948dc0..1e45db5935c 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.353 2024/08/27 07:49:07 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.354 2024/10/01 08:01:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -417,6 +417,7 @@ window_copy_common_init(struct window_mode_entry *wme) data->jumpchar = NULL; 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"); evtimer_set(&data->dragtimer, window_copy_scroll_timer, wme); diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index dd2f1f8b0e6..2c92c4f8625 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.293 2024/10/01 06:15:47 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.294 2024/10/01 08:01:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1686,15 +1686,7 @@ window_set_fill_character(struct window *w) void window_pane_default_cursor(struct window_pane *wp) { - struct screen *s = wp->screen; - 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); + screen_set_default_cursor(wp->screen, wp->options); } int