summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/arguments.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-07-09 14:03:13 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-07-09 14:03:13 +0000
commitae1315bd838fce44a2313b7cb77696a32420e9b1 (patch)
treede8dead926ef5b50bed524d7e9b455606bc26a13 /usr.bin/tmux/arguments.c
parent0a3f3de573f95d16c96427b619e315cb6d1c88c6 (diff)
Add a -H flag to send-keys to send literal keys given as hex numbers
(needed for control clients to send mouse sequences). Also add some format flags for UTF-8 and SGR mouse mode. Requested by Bradley Smith in GitHub issues 1832 and 1833.
Diffstat (limited to 'usr.bin/tmux/arguments.c')
-rw-r--r--usr.bin/tmux/arguments.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c
index 08a72817412..ffd3f8c5025 100644
--- a/usr.bin/tmux/arguments.c
+++ b/usr.bin/tmux/arguments.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arguments.c,v 1.26 2019/06/20 07:10:56 nicm Exp $ */
+/* $OpenBSD: arguments.c,v 1.27 2019/07/09 14:03:12 nicm Exp $ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -38,6 +38,7 @@ TAILQ_HEAD(args_values, args_value);
struct args_entry {
u_char flag;
struct args_values values;
+ u_int count;
RB_ENTRY(args_entry) entry;
};
@@ -174,6 +175,7 @@ args_print(struct args *args)
size_t len;
char *buf;
int i;
+ u_int j;
struct args_entry *entry;
struct args_value *value;
@@ -187,7 +189,8 @@ args_print(struct args *args)
if (*buf == '\0')
args_print_add(&buf, &len, "-");
- args_print_add(&buf, &len, "%c", entry->flag);
+ for (j = 0; j < entry->count; j++)
+ args_print_add(&buf, &len, "%c", entry->flag);
}
/* Then the flags with arguments. */
@@ -244,7 +247,12 @@ args_escape(const char *s)
int
args_has(struct args *args, u_char ch)
{
- return (args_find(args, ch) != NULL);
+ struct args_entry *entry;
+
+ entry = args_find(args, ch);
+ if (entry == NULL)
+ return (0);
+ return (entry->count);
}
/* Set argument value in the arguments tree. */
@@ -258,9 +266,11 @@ args_set(struct args *args, u_char ch, const char *s)
if (entry == NULL) {
entry = xcalloc(1, sizeof *entry);
entry->flag = ch;
+ entry->count = 1;
TAILQ_INIT(&entry->values);
RB_INSERT(args_tree, &args->tree, entry);
- }
+ } else
+ entry->count++;
if (s != NULL) {
value = xcalloc(1, sizeof *value);