Infer the terminal theme from the background colour correctly, if theme

reporting is not supported.
This commit is contained in:
nicm
2026-07-04 22:06:45 +00:00
parent b05f0abeeb
commit 415885ecb9
2 changed files with 7 additions and 1 deletions

View File

@@ -751,7 +751,7 @@ tty_keys_next(struct tty *tty)
const char *buf;
size_t len, size;
cc_t bspace;
int delay, expired = 0, n;
int delay, expired = 0, n, bg = tty->bg;
key_code key, onlykey;
struct mouse_event m = { 0 };
struct key_event *event;
@@ -811,11 +811,15 @@ tty_keys_next(struct tty *tty)
switch (tty_keys_colours(tty, buf, len, &size, &tty->fg, &tty->bg)) {
case 0: /* yes */
key = KEYC_UNKNOWN;
if (tty->bg != bg)
server_client_update_theme_colours(c);
session_theme_changed(c->session);
goto complete_key;
case -1: /* no, or not valid */
break;
case 1: /* partial */
if (tty->bg != bg)
server_client_update_theme_colours(c);
session_theme_changed(c->session);
goto partial_key;
}