Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-01-04 10:01:08 +00:00
5 changed files with 27 additions and 14 deletions

19
cmd.c
View File

@@ -681,6 +681,9 @@ cmd_list_print(const struct cmd_list *cmdlist, int escaped)
struct cmd *cmd, *next; struct cmd *cmd, *next;
char *buf, *this; char *buf, *this;
size_t len; size_t len;
const char *separator;
const char *single_separator = escaped ? " \\; " : " ; ";
const char *double_separator = escaped ? " \\;\\; " : " ;; ";
len = 1; len = 1;
buf = xcalloc(1, len); buf = xcalloc(1, len);
@@ -695,17 +698,11 @@ cmd_list_print(const struct cmd_list *cmdlist, int escaped)
next = TAILQ_NEXT(cmd, qentry); next = TAILQ_NEXT(cmd, qentry);
if (next != NULL) { if (next != NULL) {
if (cmd->group != next->group) { if (cmd->group != next->group)
if (escaped) separator = double_separator;
strlcat(buf, " \\;\\; ", len); else
else separator = single_separator;
strlcat(buf, " ;; ", len); strlcat(buf, separator, len);
} else {
if (escaped)
strlcat(buf, " \\; ", len);
else
strlcat(buf, " ; ", len);
}
} }
free(this); free(this);

View File

@@ -3432,14 +3432,19 @@ input_cancel_requests(struct client *c)
static void static void
input_report_current_theme(struct input_ctx *ictx) input_report_current_theme(struct input_ctx *ictx)
{ {
switch (window_pane_get_theme(ictx->wp)) { struct window_pane *wp = ictx->wp;
switch (window_pane_get_theme(wp)) {
case THEME_DARK: case THEME_DARK:
log_debug("%s: %%%u dark theme", __func__, wp->id);
input_reply(ictx, 0, "\033[?997;1n"); input_reply(ictx, 0, "\033[?997;1n");
break; break;
case THEME_LIGHT: case THEME_LIGHT:
log_debug("%s: %%%u light theme", __func__, wp->id);
input_reply(ictx, 0, "\033[?997;2n"); input_reply(ictx, 0, "\033[?997;2n");
break; break;
case THEME_UNKNOWN: case THEME_UNKNOWN:
log_debug("%s: %%%u unknown theme", __func__, wp->id);
break; break;
} }
} }

View File

@@ -382,6 +382,14 @@ key_string_lookup_key(key_code key, int with_flags)
s = "PasteEnd"; s = "PasteEnd";
goto append; goto append;
} }
if (key == KEYC_REPORT_DARK_THEME) {
s = "ReportDarkTheme";
goto append;
}
if (key == KEYC_REPORT_LIGHT_THEME) {
s = "ReportLightTheme";
goto append;
}
if (key == KEYC_MOUSE) { if (key == KEYC_MOUSE) {
s = "Mouse"; s = "Mouse";
goto append; goto append;

View File

@@ -765,6 +765,8 @@ screen_mode_to_string(int mode)
strlcat(tmp, "KEYS_EXTENDED,", sizeof tmp); strlcat(tmp, "KEYS_EXTENDED,", sizeof tmp);
if (mode & MODE_KEYS_EXTENDED_2) if (mode & MODE_KEYS_EXTENDED_2)
strlcat(tmp, "KEYS_EXTENDED_2,", sizeof tmp); strlcat(tmp, "KEYS_EXTENDED_2,", sizeof tmp);
if (mode & MODE_THEME_UPDATES)
strlcat(tmp, "THEME_UPDATES,", sizeof tmp);
tmp[strlen(tmp) - 1] = '\0'; tmp[strlen(tmp) - 1] = '\0';
return (tmp); return (tmp);
} }

View File

@@ -1943,17 +1943,18 @@ window_pane_send_theme_update(struct window_pane *wp)
return; return;
if (~wp->screen->mode & MODE_THEME_UPDATES) if (~wp->screen->mode & MODE_THEME_UPDATES)
return; return;
switch (window_pane_get_theme(wp)) { switch (window_pane_get_theme(wp)) {
case THEME_LIGHT: case THEME_LIGHT:
log_debug("%s: %%%u light theme", __func__, wp->id);
input_key_pane(wp, KEYC_REPORT_LIGHT_THEME, NULL); input_key_pane(wp, KEYC_REPORT_LIGHT_THEME, NULL);
break; break;
case THEME_DARK: case THEME_DARK:
log_debug("%s: %%%u dark theme", __func__, wp->id);
input_key_pane(wp, KEYC_REPORT_DARK_THEME, NULL); input_key_pane(wp, KEYC_REPORT_DARK_THEME, NULL);
break; break;
case THEME_UNKNOWN: case THEME_UNKNOWN:
log_debug("%s: %%%u unknown theme", __func__, wp->id);
break; break;
} }
wp->flags &= ~PANE_THEMECHANGED; wp->flags &= ~PANE_THEMECHANGED;
} }