Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2022-11-01 12:01:10 +00:00
commit 36896f6dd0
5 changed files with 30 additions and 6 deletions

View File

@ -587,22 +587,22 @@ cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)
return (-1); return (-1);
return (0); return (0);
} else if (strcmp(pane, "{up-of}") == 0) { } else if (strcmp(pane, "{up-of}") == 0) {
fs->wp = window_pane_find_up(fs->current->wp); fs->wp = window_pane_find_up(fs->w->active);
if (fs->wp == NULL) if (fs->wp == NULL)
return (-1); return (-1);
return (0); return (0);
} else if (strcmp(pane, "{down-of}") == 0) { } else if (strcmp(pane, "{down-of}") == 0) {
fs->wp = window_pane_find_down(fs->current->wp); fs->wp = window_pane_find_down(fs->w->active);
if (fs->wp == NULL) if (fs->wp == NULL)
return (-1); return (-1);
return (0); return (0);
} else if (strcmp(pane, "{left-of}") == 0) { } else if (strcmp(pane, "{left-of}") == 0) {
fs->wp = window_pane_find_left(fs->current->wp); fs->wp = window_pane_find_left(fs->w->active);
if (fs->wp == NULL) if (fs->wp == NULL)
return (-1); return (-1);
return (0); return (0);
} else if (strcmp(pane, "{right-of}") == 0) { } else if (strcmp(pane, "{right-of}") == 0) {
fs->wp = window_pane_find_right(fs->current->wp); fs->wp = window_pane_find_right(fs->w->active);
if (fs->wp == NULL) if (fs->wp == NULL)
return (-1); return (-1);
return (0); return (0);
@ -614,7 +614,7 @@ cmd_find_get_pane_with_window(struct cmd_find_state *fs, const char *pane)
n = strtonum(pane + 1, 1, INT_MAX, NULL); n = strtonum(pane + 1, 1, INT_MAX, NULL);
else else
n = 1; n = 1;
wp = fs->current->wp; wp = fs->w->active;
if (pane[0] == '+') if (pane[0] == '+')
fs->wp = window_pane_next_by_number(fs->w, wp, n); fs->wp = window_pane_next_by_number(fs->w, wp, n);
else else

View File

@ -306,6 +306,20 @@ static struct input_key_entry input_key_defaults[] = {
}, },
{ .key = KEYC_DC|KEYC_BUILD_MODIFIERS, { .key = KEYC_DC|KEYC_BUILD_MODIFIERS,
.data = "\033[3;_~" .data = "\033[3;_~"
},
/* Tab and modifiers. */
{ .key = '\011'|KEYC_CTRL,
.data = "\011"
},
{ .key = '\011'|KEYC_CTRL|KEYC_EXTENDED,
.data = "\033[9;5u"
},
{ .key = '\011'|KEYC_CTRL|KEYC_SHIFT,
.data = "\011"
},
{ .key = '\011'|KEYC_CTRL|KEYC_SHIFT|KEYC_EXTENDED,
.data = "\033[1;5Z"
} }
}; };
static const key_code input_key_modifiers[] = { static const key_code input_key_modifiers[] = {
@ -468,6 +482,8 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
key &= ~KEYC_KEYPAD; key &= ~KEYC_KEYPAD;
if (~s->mode & MODE_KCURSOR) if (~s->mode & MODE_KCURSOR)
key &= ~KEYC_CURSOR; key &= ~KEYC_CURSOR;
if (~s->mode & MODE_KEXTENDED)
key &= ~KEYC_EXTENDED;
ike = input_key_get(key); ike = input_key_get(key);
if (ike == NULL && (key & KEYC_META) && (~key & KEYC_IMPLIED_META)) if (ike == NULL && (key & KEYC_META) && (~key & KEYC_IMPLIED_META))
ike = input_key_get(key & ~KEYC_META); ike = input_key_get(key & ~KEYC_META);
@ -475,6 +491,8 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
ike = input_key_get(key & ~KEYC_CURSOR); ike = input_key_get(key & ~KEYC_CURSOR);
if (ike == NULL && (key & KEYC_KEYPAD)) if (ike == NULL && (key & KEYC_KEYPAD))
ike = input_key_get(key & ~KEYC_KEYPAD); ike = input_key_get(key & ~KEYC_KEYPAD);
if (ike == NULL && (key & KEYC_EXTENDED))
ike = input_key_get(key & ~KEYC_EXTENDED);
if (ike != NULL) { if (ike != NULL) {
log_debug("found key 0x%llx: \"%s\"", key, ike->data); log_debug("found key 0x%llx: \"%s\"", key, ike->data);
if ((key & KEYC_META) && (~key & KEYC_IMPLIED_META)) if ((key & KEYC_META) && (~key & KEYC_IMPLIED_META))

View File

@ -460,6 +460,8 @@ out:
strlcat(out, "I", sizeof out); strlcat(out, "I", sizeof out);
if (saved & KEYC_BUILD_MODIFIERS) if (saved & KEYC_BUILD_MODIFIERS)
strlcat(out, "B", sizeof out); strlcat(out, "B", sizeof out);
if (saved & KEYC_EXTENDED)
strlcat(out, "E", sizeof out);
strlcat(out, "]", sizeof out); strlcat(out, "]", sizeof out);
} }
return (out); return (out);

1
tmux.h
View File

@ -138,6 +138,7 @@ struct winlink;
#define KEYC_IMPLIED_META 0x08000000000000ULL #define KEYC_IMPLIED_META 0x08000000000000ULL
#define KEYC_BUILD_MODIFIERS 0x10000000000000ULL #define KEYC_BUILD_MODIFIERS 0x10000000000000ULL
#define KEYC_VI 0x20000000000000ULL #define KEYC_VI 0x20000000000000ULL
#define KEYC_EXTENDED 0x40000000000000ULL
/* Masks for key bits. */ /* Masks for key bits. */
#define KEYC_MASK_MODIFIERS 0x00f00000000000ULL #define KEYC_MASK_MODIFIERS 0x00f00000000000ULL

View File

@ -208,6 +208,9 @@ static const struct tty_default_key_raw tty_default_raw_keys[] = {
/* Paste keys. */ /* Paste keys. */
{ "\033[200~", KEYC_PASTE_START }, { "\033[200~", KEYC_PASTE_START },
{ "\033[201~", KEYC_PASTE_END }, { "\033[201~", KEYC_PASTE_END },
/* Extended keys. */
{ "\033[1;5Z", '\011'|KEYC_CTRL|KEYC_SHIFT|KEYC_EXTENDED },
}; };
/* Default xterm keys. */ /* Default xterm keys. */
@ -974,7 +977,7 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len,
log_debug("%s: extended key %.*s is %llx (%s)", c->name, log_debug("%s: extended key %.*s is %llx (%s)", c->name,
(int)*size, buf, nkey, key_string_lookup_key(nkey, 1)); (int)*size, buf, nkey, key_string_lookup_key(nkey, 1));
} }
*key = nkey; *key = nkey|KEYC_EXTENDED;
return (0); return (0);
} }