Add sorting (-O flag) and a custom format (-F) to list-keys, from Dane

Jensen in GitHub issue 4845.
This commit is contained in:
nicm
2026-02-24 08:20:52 +00:00
parent 9316476a73
commit 09bd686327
7 changed files with 439 additions and 313 deletions

View File

@@ -215,6 +215,7 @@ key_bindings_add(const char *name, key_code key, const char *note, int repeat,
bd = xcalloc(1, sizeof *bd);
bd->key = (key & ~KEYC_MASK_FLAGS);
bd->tablename = table->name;
if (note != NULL)
bd->note = xstrdup(note);
RB_INSERT(key_bindings, &table->key_bindings, bd);
@@ -702,3 +703,15 @@ key_bindings_dispatch(struct key_binding *bd, struct cmdq_item *item,
new_item = cmdq_append(c, new_item);
return (new_item);
}
int
key_bindings_has_repeat(struct key_binding **l, u_int n)
{
u_int i;
for (i = 0; i < n; i++) {
if (l[i]->flags & KEY_BINDING_REPEAT)
return (1);
}
return (0);
}