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:
nicm
2026-01-06 20:05:57 +00:00
parent 035a2f35d4
commit f226804149
4 changed files with 36 additions and 24 deletions

15
input.c
View File

@@ -1898,6 +1898,8 @@ input_csi_dispatch_rm_private(struct input_ctx *ictx)
break;
case 2031:
screen_write_mode_clear(sctx, MODE_THEME_UPDATES);
if (ictx->wp != NULL)
ictx->wp->flags &= ~PANE_THEMECHANGED;
break;
case 2026: /* synchronized output */
screen_write_stop_sync(ictx->wp);
@@ -2001,6 +2003,10 @@ input_csi_dispatch_sm_private(struct input_ctx *ictx)
break;
case 2031:
screen_write_mode_set(sctx, MODE_THEME_UPDATES);
if (ictx->wp != NULL) {
ictx->wp->last_theme = window_pane_get_theme(ictx->wp);
ictx->wp->flags &= ~PANE_THEMECHANGED;
}
break;
case 2026: /* synchronized output */
screen_write_start_sync(ictx->wp);
@@ -3397,9 +3403,11 @@ input_report_current_theme(struct input_ctx *ictx)
{
struct window_pane *wp = ictx->wp;
if (wp == NULL)
return;
switch (window_pane_get_theme(wp)) {
if (wp != NULL) {
wp->last_theme = window_pane_get_theme(wp);
wp->flags &= ~PANE_THEMECHANGED;
switch (wp->last_theme) {
case THEME_DARK:
log_debug("%s: %%%u dark theme", __func__, wp->id);
input_reply(ictx, 0, "\033[?997;1n");
@@ -3411,5 +3419,6 @@ input_report_current_theme(struct input_ctx *ictx)
case THEME_UNKNOWN:
log_debug("%s: %%%u unknown theme", __func__, wp->id);
break;
}
}
}