version 1.129, 2020/06/03 16:35:40 |
version 1.130, 2020/06/16 08:18:34 |
|
|
} |
} |
|
|
void |
void |
|
key_bindings_reset(const char *name, key_code key) |
|
{ |
|
struct key_table *table; |
|
struct key_binding *bd, *dd; |
|
|
|
table = key_bindings_get_table(name, 0); |
|
if (table == NULL) |
|
return; |
|
|
|
bd = key_bindings_get(table, key & ~KEYC_MASK_FLAGS); |
|
if (bd == NULL) |
|
return; |
|
|
|
dd = key_bindings_get_default(table, bd->key); |
|
if (dd == NULL) { |
|
key_bindings_remove(name, bd->key); |
|
return; |
|
} |
|
|
|
cmd_list_free(bd->cmdlist); |
|
bd->cmdlist = dd->cmdlist; |
|
bd->cmdlist->references++; |
|
|
|
free((void *)bd->note); |
|
if (dd->note != NULL) |
|
bd->note = xstrdup(dd->note); |
|
else |
|
bd->note = NULL; |
|
bd->flags = dd->flags; |
|
} |
|
|
|
void |
key_bindings_remove_table(const char *name) |
key_bindings_remove_table(const char *name) |
{ |
{ |
struct key_table *table; |
struct key_table *table; |
|
|
if (c->keytable == table) |
if (c->keytable == table) |
server_client_set_key_table(c, NULL); |
server_client_set_key_table(c, NULL); |
} |
} |
|
} |
|
|
|
void |
|
key_bindings_reset_table(const char *name) |
|
{ |
|
struct key_table *table; |
|
struct key_binding *bd, *bd1; |
|
|
|
table = key_bindings_get_table(name, 0); |
|
if (table == NULL) |
|
return; |
|
if (RB_EMPTY(&table->default_key_bindings)) { |
|
key_bindings_remove_table(name); |
|
return; |
|
} |
|
RB_FOREACH_SAFE(bd, key_bindings, &table->key_bindings, bd1) |
|
key_bindings_reset(name, bd->key); |
} |
} |
|
|
static enum cmd_retval |
static enum cmd_retval |