mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 21:56:57 +00:00
Merge branch 'obsd-master'
This commit is contained in:
17
input-keys.c
17
input-keys.c
@ -149,7 +149,7 @@ input_split2(u_int c, u_char *dst)
|
||||
}
|
||||
|
||||
/* Translate a key code into an output key sequence. */
|
||||
void
|
||||
int
|
||||
input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
|
||||
{
|
||||
const struct input_key_ent *ike;
|
||||
@ -166,14 +166,14 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
|
||||
if (KEYC_IS_MOUSE(key)) {
|
||||
if (m != NULL && m->wp != -1 && (u_int)m->wp == wp->id)
|
||||
input_key_mouse(wp, m);
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Literal keys go as themselves (can't be more than eight bits). */
|
||||
if (key & KEYC_LITERAL) {
|
||||
ud.data[0] = (u_char)key;
|
||||
bufferevent_write(wp->event, &ud.data[0], 1);
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Is this backspace? */
|
||||
@ -194,15 +194,15 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
|
||||
bufferevent_write(wp->event, "\033", 1);
|
||||
ud.data[0] = justkey;
|
||||
bufferevent_write(wp->event, &ud.data[0], 1);
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
if (justkey > 0x7f && justkey < KEYC_BASE) {
|
||||
if (utf8_split(justkey, &ud) != UTF8_DONE)
|
||||
return;
|
||||
return (-1);
|
||||
if (key & KEYC_ESCAPE)
|
||||
bufferevent_write(wp->event, "\033", 1);
|
||||
bufferevent_write(wp->event, ud.data, ud.size);
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -213,7 +213,7 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
|
||||
if ((out = xterm_keys_lookup(key)) != NULL) {
|
||||
bufferevent_write(wp->event, out, strlen(out));
|
||||
free(out);
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
key &= ~KEYC_XTERM;
|
||||
@ -236,7 +236,7 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
|
||||
}
|
||||
if (i == nitems(input_keys)) {
|
||||
log_debug("key 0x%llx missing", key);
|
||||
return;
|
||||
return (-1);
|
||||
}
|
||||
dlen = strlen(ike->data);
|
||||
log_debug("found key 0x%llx: \"%s\"", key, ike->data);
|
||||
@ -245,6 +245,7 @@ input_key(struct window_pane *wp, key_code key, struct mouse_event *m)
|
||||
if (key & KEYC_ESCAPE)
|
||||
bufferevent_write(wp->event, "\033", 1);
|
||||
bufferevent_write(wp->event, ike->data, dlen);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Translate mouse and output. */
|
||||
|
Reference in New Issue
Block a user