1
0
mirror of https://github.com/tmux/tmux.git synced 2025-03-26 15:58:47 +00:00

Do not allow meta prefix on paste start and end sequences, GitHub issue 4387.

This commit is contained in:
nicm 2025-02-26 08:55:27 +00:00
parent f224d61f37
commit 21f7db4c4d
3 changed files with 6 additions and 5 deletions

View File

@ -2247,13 +2247,13 @@ out:
static int
server_client_is_bracket_paste(struct client *c, key_code key)
{
if (key == KEYC_PASTE_START) {
if ((key & KEYC_MASK_KEY) == KEYC_PASTE_START) {
c->flags |= CLIENT_BRACKETPASTING;
log_debug("%s: bracket paste on", c->name);
return (0);
}
if (key == KEYC_PASTE_END) {
if ((key & KEYC_MASK_KEY) == KEYC_PASTE_END) {
c->flags &= ~CLIENT_BRACKETPASTING;
log_debug("%s: bracket paste off", c->name);
return (0);

3
tmux.h
View File

@ -167,7 +167,8 @@ struct winlink;
/* Is this a paste key? */
#define KEYC_IS_PASTE(key) \
((key) == KEYC_PASTE_START || (key) == KEYC_PASTE_END)
(((key) & KEYC_MASK_KEY) == KEYC_PASTE_START || \
((key) & KEYC_MASK_KEY) == KEYC_PASTE_END)
/* Multiple click timeout. */
#define KEYC_CLICK_TIMEOUT 300

View File

@ -208,8 +208,8 @@ static const struct tty_default_key_raw tty_default_raw_keys[] = {
{ "\033[O", KEYC_FOCUS_OUT },
/* Paste keys. */
{ "\033[200~", KEYC_PASTE_START },
{ "\033[201~", KEYC_PASTE_END },
{ "\033[200~", KEYC_PASTE_START|KEYC_IMPLIED_META },
{ "\033[201~", KEYC_PASTE_END|KEYC_IMPLIED_META },
/* Extended keys. */
{ "\033[1;5Z", '\011'|KEYC_CTRL|KEYC_SHIFT },