mirror of
https://github.com/tmux/tmux.git
synced 2026-10-11 04:44:25 +00:00
Infer the terminal theme from the background colour correctly, if theme
reporting is not supported.
This commit is contained in:
@@ -1197,6 +1197,8 @@ server_client_update_theme_colours(struct client *c)
|
|||||||
format_defaults(ft, c, NULL, NULL, NULL);
|
format_defaults(ft, c, NULL, NULL, NULL);
|
||||||
|
|
||||||
theme = c->theme;
|
theme = c->theme;
|
||||||
|
if (theme == THEME_UNKNOWN)
|
||||||
|
theme = colour_totheme(c->tty.bg);
|
||||||
if (option == 2)
|
if (option == 2)
|
||||||
theme = THEME_LIGHT;
|
theme = THEME_LIGHT;
|
||||||
else if (option == 3)
|
else if (option == 3)
|
||||||
|
|||||||
@@ -751,7 +751,7 @@ tty_keys_next(struct tty *tty)
|
|||||||
const char *buf;
|
const char *buf;
|
||||||
size_t len, size;
|
size_t len, size;
|
||||||
cc_t bspace;
|
cc_t bspace;
|
||||||
int delay, expired = 0, n;
|
int delay, expired = 0, n, bg = tty->bg;
|
||||||
key_code key, onlykey;
|
key_code key, onlykey;
|
||||||
struct mouse_event m = { 0 };
|
struct mouse_event m = { 0 };
|
||||||
struct key_event *event;
|
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)) {
|
switch (tty_keys_colours(tty, buf, len, &size, &tty->fg, &tty->bg)) {
|
||||||
case 0: /* yes */
|
case 0: /* yes */
|
||||||
key = KEYC_UNKNOWN;
|
key = KEYC_UNKNOWN;
|
||||||
|
if (tty->bg != bg)
|
||||||
|
server_client_update_theme_colours(c);
|
||||||
session_theme_changed(c->session);
|
session_theme_changed(c->session);
|
||||||
goto complete_key;
|
goto complete_key;
|
||||||
case -1: /* no, or not valid */
|
case -1: /* no, or not valid */
|
||||||
break;
|
break;
|
||||||
case 1: /* partial */
|
case 1: /* partial */
|
||||||
|
if (tty->bg != bg)
|
||||||
|
server_client_update_theme_colours(c);
|
||||||
session_theme_changed(c->session);
|
session_theme_changed(c->session);
|
||||||
goto partial_key;
|
goto partial_key;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user