mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Improve logging of screen mode changes.
This commit is contained in:
parent
f02a6c34e0
commit
02a6b39db7
@ -769,6 +769,9 @@ screen_write_mode_set(struct screen_write_ctx *ctx, int mode)
|
||||
struct screen *s = ctx->s;
|
||||
|
||||
s->mode |= mode;
|
||||
|
||||
if (log_get_level() != 0)
|
||||
log_debug("%s: %s", __func__, screen_mode_to_string(mode));
|
||||
}
|
||||
|
||||
/* Clear a mode. */
|
||||
@ -778,6 +781,9 @@ screen_write_mode_clear(struct screen_write_ctx *ctx, int mode)
|
||||
struct screen *s = ctx->s;
|
||||
|
||||
s->mode &= ~mode;
|
||||
|
||||
if (log_get_level() != 0)
|
||||
log_debug("%s: %s", __func__, screen_mode_to_string(mode));
|
||||
}
|
||||
|
||||
/* Cursor up by ny. */
|
||||
|
52
screen.c
52
screen.c
@ -156,8 +156,8 @@ screen_reset_tabs(struct screen *s)
|
||||
void
|
||||
screen_set_cursor_style(struct screen *s, u_int style)
|
||||
{
|
||||
switch (style)
|
||||
{
|
||||
log_debug("%s: new %u, was %u", __func__, style, s->cstyle);
|
||||
switch (style) {
|
||||
case 0:
|
||||
s->cstyle = SCREEN_CURSOR_DEFAULT;
|
||||
break;
|
||||
@ -653,3 +653,51 @@ screen_alternate_off(struct screen *s, struct grid_cell *gc, int cursor)
|
||||
if (s->cy > screen_size_y(s) - 1)
|
||||
s->cy = screen_size_y(s) - 1;
|
||||
}
|
||||
|
||||
/* Get mode as a string. */
|
||||
const char *
|
||||
screen_mode_to_string(int mode)
|
||||
{
|
||||
static char tmp[1024];
|
||||
|
||||
if (mode == 0)
|
||||
return "NONE";
|
||||
if (mode == ALL_MODES)
|
||||
return "ALL";
|
||||
|
||||
*tmp = '\0';
|
||||
if (mode & MODE_CURSOR)
|
||||
strlcat(tmp, "CURSOR,", sizeof tmp);
|
||||
if (mode & MODE_INSERT)
|
||||
strlcat(tmp, "INSERT,", sizeof tmp);
|
||||
if (mode & MODE_KCURSOR)
|
||||
strlcat(tmp, "KCURSOR,", sizeof tmp);
|
||||
if (mode & MODE_KKEYPAD)
|
||||
strlcat(tmp, "KKEYPAD,", sizeof tmp);
|
||||
if (mode & MODE_WRAP)
|
||||
strlcat(tmp, "WRAP,", sizeof tmp);
|
||||
if (mode & MODE_MOUSE_STANDARD)
|
||||
strlcat(tmp, "STANDARD,", sizeof tmp);
|
||||
if (mode & MODE_MOUSE_BUTTON)
|
||||
strlcat(tmp, "BUTTON,", sizeof tmp);
|
||||
if (mode & MODE_BLINKING)
|
||||
strlcat(tmp, "BLINKING,", sizeof tmp);
|
||||
if (mode & MODE_MOUSE_UTF8)
|
||||
strlcat(tmp, "UTF8,", sizeof tmp);
|
||||
if (mode & MODE_MOUSE_SGR)
|
||||
strlcat(tmp, "SGR,", sizeof tmp);
|
||||
if (mode & MODE_BRACKETPASTE)
|
||||
strlcat(tmp, "BRACKETPASTE,", sizeof tmp);
|
||||
if (mode & MODE_FOCUSON)
|
||||
strlcat(tmp, "FOCUSON,", sizeof tmp);
|
||||
if (mode & MODE_MOUSE_ALL)
|
||||
strlcat(tmp, "ALL,", sizeof tmp);
|
||||
if (mode & MODE_ORIGIN)
|
||||
strlcat(tmp, "ORIGIN,", sizeof tmp);
|
||||
if (mode & MODE_CRLF)
|
||||
strlcat(tmp, "CRLF,", sizeof tmp);
|
||||
if (mode & MODE_KEXTENDED)
|
||||
strlcat(tmp, "KEXTENDED,", sizeof tmp);
|
||||
tmp[strlen (tmp) - 1] = '\0';
|
||||
return (tmp);
|
||||
}
|
||||
|
@ -1694,7 +1694,10 @@ server_client_reset_state(struct client *c)
|
||||
s = wp->screen;
|
||||
if (s != NULL)
|
||||
mode = s->mode;
|
||||
log_debug("%s: client %s mode %x", __func__, c->name, mode);
|
||||
if (log_get_level() != 0) {
|
||||
log_debug("%s: client %s mode %s", __func__, c->name,
|
||||
screen_mode_to_string(mode));
|
||||
}
|
||||
|
||||
/* Reset region and margin. */
|
||||
tty_region_off(tty);
|
||||
|
1
tmux.h
1
tmux.h
@ -2749,6 +2749,7 @@ void screen_select_cell(struct screen *, struct grid_cell *,
|
||||
const struct grid_cell *);
|
||||
void screen_alternate_on(struct screen *, struct grid_cell *, int);
|
||||
void screen_alternate_off(struct screen *, struct grid_cell *, int);
|
||||
const char *screen_mode_to_string(int);
|
||||
|
||||
/* window.c */
|
||||
extern struct windows windows;
|
||||
|
8
tty.c
8
tty.c
@ -665,8 +665,12 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s)
|
||||
mode &= ~MODE_CURSOR;
|
||||
|
||||
changed = mode ^ tty->mode;
|
||||
if (changed != 0)
|
||||
log_debug("%s: update mode %x to %x", c->name, tty->mode, mode);
|
||||
if (log_get_level() != 0 && changed != 0) {
|
||||
log_debug("%s: current mode %s", c->name,
|
||||
screen_mode_to_string(tty->mode));
|
||||
log_debug("%s: setting mode %s", c->name,
|
||||
screen_mode_to_string(mode));
|
||||
}
|
||||
|
||||
if (s != NULL) {
|
||||
if (strcmp(s->ccolour, tty->ccolour) != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user