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.
This commit is contained in:
nicm
2019-07-09 14:03:12 +00:00
parent ad11d49d64
commit fc2016dbb6
7 changed files with 94 additions and 40 deletions

View File

@ -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);