mirror of
https://github.com/tmux/tmux.git
synced 2026-01-11 16:30:22 +00:00
Do not send theme unless it has changed, and do not send immediately
when updates are enabled. GitHub issue 5787.
This commit is contained in:
18
window.c
18
window.c
@@ -926,7 +926,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
||||
wp = xcalloc(1, sizeof *wp);
|
||||
wp->window = w;
|
||||
wp->options = options_create(w->options);
|
||||
wp->flags = (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
wp->flags = PANE_STYLECHANGED;
|
||||
|
||||
wp->id = next_window_pane_id++;
|
||||
RB_INSERT(window_pane_tree, &all_window_panes, wp);
|
||||
@@ -1926,24 +1926,32 @@ window_pane_get_theme(struct window_pane *wp)
|
||||
void
|
||||
window_pane_send_theme_update(struct window_pane *wp)
|
||||
{
|
||||
enum client_theme theme;
|
||||
|
||||
if (wp == NULL || window_pane_exited(wp))
|
||||
return;
|
||||
if (~wp->flags & PANE_THEMECHANGED)
|
||||
return;
|
||||
if (~wp->screen->mode & MODE_THEME_UPDATES)
|
||||
return;
|
||||
switch (window_pane_get_theme(wp)) {
|
||||
|
||||
theme = window_pane_get_theme(wp);
|
||||
if (theme == wp->last_theme)
|
||||
return;
|
||||
wp->last_theme = theme;
|
||||
wp->flags &= ~PANE_THEMECHANGED;
|
||||
|
||||
switch (theme) {
|
||||
case THEME_LIGHT:
|
||||
log_debug("%s: %%%u light theme", __func__, wp->id);
|
||||
input_key_pane(wp, KEYC_REPORT_LIGHT_THEME, NULL);
|
||||
bufferevent_write(wp->event, "\033[?997;2n", 9);
|
||||
break;
|
||||
case THEME_DARK:
|
||||
log_debug("%s: %%%u dark theme", __func__, wp->id);
|
||||
input_key_pane(wp, KEYC_REPORT_DARK_THEME, NULL);
|
||||
bufferevent_write(wp->event, "\033[?997;1n", 9);
|
||||
break;
|
||||
case THEME_UNKNOWN:
|
||||
log_debug("%s: %%%u unknown theme", __func__, wp->id);
|
||||
break;
|
||||
}
|
||||
wp->flags &= ~PANE_THEMECHANGED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user