Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2024-12-06 12:01:11 +00:00
commit ae8f2208c9
4 changed files with 16 additions and 8 deletions

View File

@ -587,9 +587,10 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
newkey = options_get_number(global_options, "backspace");
if (newkey == KEYC_BSPACE)
newkey = '\b';
log_debug("%s: key 0x%llx is backspace -> 0x%llx", __func__,
key, newkey|(key & KEYC_MASK_FLAGS));
key = newkey|(key & KEYC_MASK_FLAGS);
newkey |= (key & (KEYC_MASK_FLAGS|KEYC_MASK_MODIFIERS));
log_debug("%s: key 0x%llx is backspace -> 0x%llx", __func__, key,
newkey);
key = newkey;
}
/* Is this backtab? */
@ -644,8 +645,7 @@ input_key(struct screen *s, struct bufferevent *bev, key_code key)
if (ike != NULL) {
log_debug("%s: found key 0x%llx: \"%s\"", __func__, key,
ike->data);
if ((key == KEYC_PASTE_START || key == KEYC_PASTE_END) &&
(~s->mode & MODE_BRACKETPASTE))
if (KEYC_IS_PASTE(key) && (~s->mode & MODE_BRACKETPASTE))
return (0);
if ((key & KEYC_META) && (~key & KEYC_IMPLIED_META))
input_key_write(__func__, bev, "\033", 1);

View File

@ -2577,7 +2577,7 @@ paste_key:
if (c->flags & CLIENT_READONLY)
goto out;
if (event->buf != NULL)
window_pane_paste(wp, event->buf, event->len);
window_pane_paste(wp, key, event->buf, event->len);
key = KEYC_NONE;
goto out;

7
tmux.h
View File

@ -174,6 +174,10 @@ struct winlink;
(((key) & KEYC_MASK_KEY) < KEYC_USER || \
((key) & KEYC_MASK_KEY) >= KEYC_USER_END))
/* Is this a paste key? */
#define KEYC_IS_PASTE(key) \
((key) == KEYC_PASTE_START || (key) == KEYC_PASTE_END)
/* Multiple click timeout. */
#define KEYC_CLICK_TIMEOUT 300
@ -3208,7 +3212,8 @@ void window_pane_reset_mode_all(struct window_pane *);
int window_pane_key(struct window_pane *, struct client *,
struct session *, struct winlink *, key_code,
struct mouse_event *);
void window_pane_paste(struct window_pane *, char *, size_t);
void window_pane_paste(struct window_pane *, key_code, char *,
size_t);
int window_pane_visible(struct window_pane *);
int window_pane_exited(struct window_pane *);
u_int window_pane_search(struct window_pane *, const char *, int,

View File

@ -1229,7 +1229,7 @@ window_pane_copy_key(struct window_pane *wp, key_code key)
}
void
window_pane_paste(struct window_pane *wp, char *buf, size_t len)
window_pane_paste(struct window_pane *wp, key_code key, char *buf, size_t len)
{
if (!TAILQ_EMPTY(&wp->modes))
return;
@ -1237,6 +1237,9 @@ window_pane_paste(struct window_pane *wp, char *buf, size_t len)
if (wp->fd == -1 || wp->flags & PANE_INPUTOFF)
return;
if (KEYC_IS_PASTE(key) && (~wp->screen->mode & MODE_BRACKETPASTE))
return;
log_debug("%s: %.*s", __func__, (int)len, buf);
bufferevent_write(wp->event, buf, len);