diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2023-01-16 11:26:15 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2023-01-16 11:26:15 +0000 |
commit | f8d0b897e6455ec9782922c457e78c104a8cd5fa (patch) | |
tree | 2ee5ff67ff3cede55c43bb2b9a7527886f16c6ea /usr.bin | |
parent | d1906e2d0dfc9e60ce3fa3e1134b7c4b898a3523 (diff) |
Mark keys sent by command and skip paste handling for them.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/cmd-send-keys.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/key-string.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/server-client.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 13 |
4 files changed, 16 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-send-keys.c b/usr.bin/tmux/cmd-send-keys.c index c8ee97f2295..b49fd82dd03 100644 --- a/usr.bin/tmux/cmd-send-keys.c +++ b/usr.bin/tmux/cmd-send-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-send-keys.c,v 1.74 2022/12/19 07:30:10 nicm Exp $ */ +/* $OpenBSD: cmd-send-keys.c,v 1.75 2023/01/16 11:26:14 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -74,7 +74,7 @@ cmd_send_keys_inject_key(struct cmdq_item *item, struct cmdq_item *after, if (tc == NULL) return (item); event = xmalloc(sizeof *event); - event->key = key; + event->key = key|KEYC_SENT; memset(&event->m, 0, sizeof event->m); if (server_client_handle_key(tc, event) == 0) free(event); diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index 25d41061c55..9b22d2ea101 100644 --- a/usr.bin/tmux/key-string.c +++ b/usr.bin/tmux/key-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-string.c,v 1.70 2022/11/01 09:54:13 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.71 2023/01/16 11:26:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -462,6 +462,8 @@ out: strlcat(out, "B", sizeof out); if (saved & KEYC_EXTENDED) strlcat(out, "E", sizeof out); + if (saved & KEYC_SENT) + strlcat(out, "S", sizeof out); strlcat(out, "]", sizeof out); } return (out); diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 29f736c02ee..e4ab945c65d 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.398 2023/01/12 18:49:11 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.399 2023/01/16 11:26:14 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1890,7 +1890,9 @@ server_client_key_callback(struct cmdq_item *item, void *data) goto forward_key; /* Treat everything as a regular key when pasting is detected. */ - if (!KEYC_IS_MOUSE(key) && server_client_assume_paste(s)) + if (!KEYC_IS_MOUSE(key) && + (~key & KEYC_SENT) && + server_client_assume_paste(s)) goto forward_key; /* diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 86b1c24857f..b36df4ac8d5 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1191 2023/01/12 18:49:11 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1192 2023/01/16 11:26:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -131,13 +131,14 @@ struct winlink; #define KEYC_SHIFT 0x00400000000000ULL /* Key flag bits. */ -#define KEYC_LITERAL 0x01000000000000ULL -#define KEYC_KEYPAD 0x02000000000000ULL -#define KEYC_CURSOR 0x04000000000000ULL +#define KEYC_LITERAL 0x01000000000000ULL +#define KEYC_KEYPAD 0x02000000000000ULL +#define KEYC_CURSOR 0x04000000000000ULL #define KEYC_IMPLIED_META 0x08000000000000ULL #define KEYC_BUILD_MODIFIERS 0x10000000000000ULL -#define KEYC_VI 0x20000000000000ULL -#define KEYC_EXTENDED 0x40000000000000ULL +#define KEYC_VI 0x20000000000000ULL +#define KEYC_EXTENDED 0x40000000000000ULL +#define KEYC_SENT 0x80000000000000ULL /* Masks for key bits. */ #define KEYC_MASK_MODIFIERS 0x00f00000000000ULL |