aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd-list-keys.c8
-rw-r--r--key-bindings.c2
-rw-r--r--key-string.c6
-rw-r--r--server-client.c26
4 files changed, 21 insertions, 21 deletions
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index e2d5dc52..d26486bd 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -77,8 +77,6 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
continue;
RB_FOREACH(bd, key_bindings, &table->key_bindings) {
key = key_string_lookup_key(bd->key);
- if (key == NULL)
- continue;
if (bd->can_repeat)
repeat = 1;
@@ -97,8 +95,6 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
continue;
RB_FOREACH(bd, key_bindings, &table->key_bindings) {
key = key_string_lookup_key(bd->key);
- if (key == NULL)
- continue;
if (!repeat)
r = "";
@@ -140,8 +136,6 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
any_mode = 0;
RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
key = key_string_lookup_key(mbind->key);
- if (key == NULL)
- continue;
if (mbind->mode != 0)
any_mode = 1;
@@ -153,8 +147,6 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
key = key_string_lookup_key(mbind->key);
- if (key == NULL)
- continue;
mode = "";
if (mbind->mode != 0)
diff --git a/key-bindings.c b/key-bindings.c
index cc1a1c6e..2d739e84 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -223,6 +223,8 @@ key_bindings_init(void)
"bind -n MouseDown1Pane select-pane -t=\\; send-keys -M",
"bind -n MouseDrag1Border resize-pane -M",
"bind -n MouseDown1Status select-window -t=",
+ "bind -n WheelDownStatus next-window",
+ "bind -n WheelUpStatus previous-window",
"bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= \"#{pane_in_mode}\" \"copy-mode -M\" \"send-keys -M\"' 'copy-mode -M'",
"bind -n MouseDown3Pane select-pane -mt=",
"bind -n WheelUpPane if-shell -Ft= '#{mouse_any_flag}' 'send-keys -M' 'if -Ft= \"#{pane_in_mode}\" \"send-keys -M\" \"copy-mode -e\"'",
diff --git a/key-string.c b/key-string.c
index b6474c4f..88cd2a32 100644
--- a/key-string.c
+++ b/key-string.c
@@ -238,8 +238,10 @@ key_string_lookup_key(int key)
}
/* Invalid keys are errors. */
- if (key == 127 || key > 255)
- return (NULL);
+ if (key == 127 || key > 255) {
+ snprintf(out, sizeof out, "<INVALID#%04x>", key);
+ return (out);
+ }
/* Check for standard or control key. */
if (key >= 0 && key <= 32) {
diff --git a/server-client.c b/server-client.c
index 57f0de49..f818c2fe 100644
--- a/server-client.c
+++ b/server-client.c
@@ -550,7 +550,6 @@ server_client_handle_key(struct client *c, int key)
if (s == NULL || (c->flags & (CLIENT_DEAD|CLIENT_SUSPENDED)) != 0)
return;
w = s->curw->window;
- wp = w->active;
/* Update the activity timer. */
if (gettimeofday(&c->activity_time, NULL) != 0)
@@ -591,19 +590,14 @@ server_client_handle_key(struct client *c, int key)
m->valid = 1;
m->key = key;
- if (!options_get_number(&s->options, "mouse")) {
- window_pane_key(wp, c, s, key, m);
- return;
- }
+ if (!options_get_number(&s->options, "mouse"))
+ goto forward;
} else
m->valid = 0;
/* Treat everything as a regular key when pasting is detected. */
- if (!KEYC_IS_MOUSE(key) && server_client_assume_paste(s)) {
- if (!(c->flags & CLIENT_READONLY))
- window_pane_key(wp, c, s, key, m);
- return;
- }
+ if (!KEYC_IS_MOUSE(key) && server_client_assume_paste(s))
+ goto forward;
retry:
/* Try to see if there is a key binding in the current table. */
@@ -679,7 +673,17 @@ retry:
key == options_get_number(&s->options, "prefix2")) {
server_client_key_table(c, "prefix");
server_status_client(c);
- } else if (!(c->flags & CLIENT_READONLY))
+ return;
+ }
+
+forward:
+ if (c->flags & CLIENT_READONLY)
+ return;
+ if (KEYC_IS_MOUSE(key))
+ wp = cmd_mouse_pane(m, NULL, NULL);
+ else
+ wp = w->active;
+ if (wp != NULL)
window_pane_key(wp, c, s, key, m);
}