From 3bb14001b9a9a5665c7dcac542dc49841e1b3c58 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 11 Jan 2017 22:36:07 +0000 Subject: [PATCH 1/2] Add some missing special keys to key_string_lookup_key, fix a mouse check in server_client_handle_key, and tweak a comment. --- key-string.c | 6 ++++++ server-client.c | 2 +- tty.c | 4 +--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/key-string.c b/key-string.c index b2fe845f..85841dd2 100644 --- a/key-string.c +++ b/key-string.c @@ -247,8 +247,14 @@ key_string_lookup_key(key_code key) /* Handle special keys. */ if (key == KEYC_UNKNOWN) return ("Unknown"); + if (key == KEYC_FOCUS_IN) + return ("FocusIn"); + if (key == KEYC_FOCUS_OUT) + return ("FocusOut"); if (key == KEYC_MOUSE) return ("Mouse"); + if (key == KEYC_DRAGGING) + return ("Dragging"); /* * Special case: display C-@ as C-Space. Could do this below in diff --git a/server-client.c b/server-client.c index b45265b7..6092a234 100644 --- a/server-client.c +++ b/server-client.c @@ -758,7 +758,7 @@ server_client_handle_key(struct client *c, key_code key) wp = w->active; /* Forward mouse keys if disabled. */ - if (key == KEYC_MOUSE && !options_get_number(s->options, "mouse")) + if (KEYC_IS_MOUSE(key) && !options_get_number(s->options, "mouse")) goto forward; /* Treat everything as a regular key when pasting is detected. */ diff --git a/tty.c b/tty.c index 23a74255..d9962491 100644 --- a/tty.c +++ b/tty.c @@ -565,9 +565,7 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s) if (mode & ALL_MOUSE_MODES) { /* * Enable the SGR (1006) extension unconditionally, as - * this is safe from misinterpretation. Do it in this - * order, because in some terminals it's the last one - * that takes effect and SGR is the preferred one. + * it is safe from misinterpretation. */ tty_puts(tty, "\033[?1006h"); if (mode & MODE_MOUSE_BUTTON) From 74c40d04eadc40c034634d70925355a0751c1433 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 11 Jan 2017 23:10:04 +0000 Subject: [PATCH 2/2] Be less aggressive about turning margins off. --- tty.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tty.c b/tty.c index d9962491..d1a72599 100644 --- a/tty.c +++ b/tty.c @@ -1133,13 +1133,12 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) struct screen *s = wp->screen; u_int cx, width; - if (ctx->xoff + ctx->ocx > tty->sx - 1 && - ctx->ocy == ctx->orlower && - tty_pane_full_width(tty, ctx)) - tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); - else - tty_region_off(tty); - tty_margin_off(tty); + if (ctx->xoff + ctx->ocx > tty->sx - 1 && ctx->ocy == ctx->orlower) { + if (tty_pane_full_width(tty, ctx)) + tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); + else + tty_margin_off(tty); + } /* Is the cursor in the very last position? */ width = ctx->cell->data.width;