-/* $OpenBSD: screen.c,v 1.72 2021/06/10 07:36:47 nicm Exp $ */
+/* $OpenBSD: screen.c,v 1.73 2021/06/10 07:43:44 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
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;
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);
+}
-/* $OpenBSD: tty.c,v 1.391 2021/06/10 07:36:47 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.392 2021/06/10 07:43:44 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
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)