Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2015-10-27 00:01:09 +00:00
commit 9c69a79f9a
4 changed files with 21 additions and 21 deletions

View File

@ -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)

View File

@ -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\"'",

View File

@ -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) {

View File

@ -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);
}