mirror of
https://github.com/tmux/tmux.git
synced 2026-04-13 19:16:02 +00:00
Merge branch 'obsd-master'
This commit is contained in:
@@ -93,7 +93,7 @@ cmd_list_keys_get_table_width(struct key_binding **l, u_int n)
|
||||
}
|
||||
|
||||
static struct key_binding **
|
||||
cmd_get_root_and_prefix(u_int *n, struct sort_criteria *sort_crit)
|
||||
cmd_list_keys_get_root_and_prefix(u_int *n, struct sort_criteria *sort_crit)
|
||||
{
|
||||
const char *tables[] = { "prefix", "root" };
|
||||
struct key_table *t;
|
||||
@@ -119,7 +119,7 @@ cmd_get_root_and_prefix(u_int *n, struct sort_criteria *sort_crit)
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_filter_key_list(int filter_notes, int filter_key, key_code only,
|
||||
cmd_list_keys_filter_key_list(int filter_notes, int filter_key, key_code only,
|
||||
struct key_binding **l, u_int *n)
|
||||
{
|
||||
key_code key;
|
||||
@@ -137,10 +137,10 @@ cmd_filter_key_list(int filter_notes, int filter_key, key_code only,
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_format_add_key_binding(struct format_tree *ft,
|
||||
cmd_list_keys_format_add_key_binding(struct format_tree *ft,
|
||||
const struct key_binding *bd, const char *prefix)
|
||||
{
|
||||
const char *s;
|
||||
char *s;
|
||||
|
||||
if (bd->flags & KEY_BINDING_REPEAT)
|
||||
format_add(ft, "key_repeat", "1");
|
||||
@@ -155,12 +155,12 @@ cmd_format_add_key_binding(struct format_tree *ft,
|
||||
format_add(ft, "key_prefix", "%s", prefix);
|
||||
format_add(ft, "key_table", "%s", bd->tablename);
|
||||
|
||||
s = key_string_lookup_key(bd->key, 0);
|
||||
format_add(ft, "key_string", "%s", s);
|
||||
format_add(ft, "key_string", "%s", key_string_lookup_key(bd->key, 0));
|
||||
|
||||
s = cmd_list_print(bd->cmdlist,
|
||||
CMD_LIST_PRINT_ESCAPED|CMD_LIST_PRINT_NO_GROUPS);
|
||||
s = cmd_list_print(bd->cmdlist, CMD_LIST_PRINT_ESCAPED|
|
||||
CMD_LIST_PRINT_NO_GROUPS);
|
||||
format_add(ft, "key_command", "%s", s);
|
||||
free(s);
|
||||
}
|
||||
|
||||
static enum cmd_retval
|
||||
@@ -213,14 +213,16 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (table)
|
||||
l = sort_get_key_bindings_table(table, &n, &sort_crit);
|
||||
else if (notes_only)
|
||||
l = cmd_get_root_and_prefix(&n, &sort_crit);
|
||||
l = cmd_list_keys_get_root_and_prefix(&n, &sort_crit);
|
||||
else
|
||||
l = sort_get_key_bindings(&n, &sort_crit);
|
||||
|
||||
filter_notes = notes_only && !args_has(args, 'a');
|
||||
filter_key = only != KEYC_UNKNOWN;
|
||||
if (filter_notes || filter_key)
|
||||
cmd_filter_key_list(filter_notes, filter_key, only, l, &n);
|
||||
if (filter_notes || filter_key) {
|
||||
cmd_list_keys_filter_key_list(filter_notes, filter_key, only, l,
|
||||
&n);
|
||||
}
|
||||
if (single)
|
||||
n = 1;
|
||||
|
||||
@@ -232,7 +234,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||
format_add(ft, "key_table_width", "%u",
|
||||
cmd_list_keys_get_table_width(l, n));
|
||||
for (i = 0; i < n; i++) {
|
||||
cmd_format_add_key_binding(ft, l[i], prefix);
|
||||
cmd_list_keys_format_add_key_binding(ft, l[i], prefix);
|
||||
|
||||
line = format_expand(ft, template);
|
||||
if ((single && tc != NULL) || n == 1)
|
||||
|
||||
Reference in New Issue
Block a user