mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 13:37:12 +00:00
Mass rename struct cmd_q to struct cmdq_item and related.
This commit is contained in:
@ -27,10 +27,11 @@
|
||||
* List key bindings.
|
||||
*/
|
||||
|
||||
static enum cmd_retval cmd_list_keys_exec(struct cmd *, struct cmd_q *);
|
||||
static enum cmd_retval cmd_list_keys_exec(struct cmd *, struct cmdq_item *);
|
||||
|
||||
static enum cmd_retval cmd_list_keys_table(struct cmd *, struct cmd_q *);
|
||||
static enum cmd_retval cmd_list_keys_commands(struct cmd *, struct cmd_q *);
|
||||
static enum cmd_retval cmd_list_keys_table(struct cmd *, struct cmdq_item *);
|
||||
static enum cmd_retval cmd_list_keys_commands(struct cmd *,
|
||||
struct cmdq_item *);
|
||||
|
||||
const struct cmd_entry cmd_list_keys_entry = {
|
||||
.name = "list-keys",
|
||||
@ -55,7 +56,7 @@ const struct cmd_entry cmd_list_commands_entry = {
|
||||
};
|
||||
|
||||
static enum cmd_retval
|
||||
cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
cmd_list_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct key_table *table;
|
||||
@ -65,14 +66,14 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
int repeat, width, tablewidth, keywidth;
|
||||
|
||||
if (self->entry == &cmd_list_commands_entry)
|
||||
return (cmd_list_keys_commands(self, cmdq));
|
||||
return (cmd_list_keys_commands(self, item));
|
||||
|
||||
if (args_has(args, 't'))
|
||||
return (cmd_list_keys_table(self, cmdq));
|
||||
return (cmd_list_keys_table(self, item));
|
||||
|
||||
tablename = args_get(args, 'T');
|
||||
if (tablename != NULL && key_bindings_get_table(tablename, 0) == NULL) {
|
||||
cmdq_error(cmdq, "table %s doesn't exist", tablename);
|
||||
cmdq_error(item, "table %s doesn't exist", tablename);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
||||
@ -124,7 +125,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
strlcat(tmp, cp, sizeof tmp);
|
||||
free(cp);
|
||||
|
||||
cmdq_print(cmdq, "bind-key %s", tmp);
|
||||
cmdq_print(item, "bind-key %s", tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +133,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
}
|
||||
|
||||
static enum cmd_retval
|
||||
cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
|
||||
cmd_list_keys_table(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
const char *tablename, *cmdstr;
|
||||
@ -142,7 +143,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
|
||||
|
||||
tablename = args_get(args, 't');
|
||||
if ((mtab = mode_key_findtable(tablename)) == NULL) {
|
||||
cmdq_error(cmdq, "unknown key table: %s", tablename);
|
||||
cmdq_error(item, "unknown key table: %s", tablename);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
||||
@ -156,7 +157,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
|
||||
RB_FOREACH(mbind, mode_key_tree, mtab->tree) {
|
||||
cmdstr = mode_key_tostring(mtab->cmdstr, mbind->cmd);
|
||||
if (cmdstr != NULL) {
|
||||
cmdq_print(cmdq, "bind-key -t %s %*s %s",
|
||||
cmdq_print(item, "bind-key -t %s %*s %s",
|
||||
mtab->name, (int)keywidth,
|
||||
key_string_lookup_key(mbind->key), cmdstr);
|
||||
}
|
||||
@ -166,13 +167,13 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq)
|
||||
}
|
||||
|
||||
static enum cmd_retval
|
||||
cmd_list_keys_commands(struct cmd *self, struct cmd_q *cmdq)
|
||||
cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
const struct cmd_entry **entryp;
|
||||
const struct cmd_entry *entry;
|
||||
struct format_tree *ft;
|
||||
const char *template;
|
||||
const char *template, *s;
|
||||
char *line;
|
||||
|
||||
if ((template = args_get(args, 'F')) == NULL) {
|
||||
@ -181,25 +182,27 @@ cmd_list_keys_commands(struct cmd *self, struct cmd_q *cmdq)
|
||||
"#{command_list_usage}";
|
||||
}
|
||||
|
||||
ft = format_create(cmdq, 0);
|
||||
ft = format_create(item, 0);
|
||||
format_defaults(ft, NULL, NULL, NULL, NULL);
|
||||
|
||||
for (entryp = cmd_table; *entryp != NULL; entryp++) {
|
||||
entry = *entryp;
|
||||
|
||||
format_add(ft, "command_list_name", "%s", entry->name);
|
||||
if (entry->alias != NULL) {
|
||||
format_add(ft, "command_list_alias", "%s",
|
||||
entry->alias);
|
||||
}
|
||||
if (entry->alias != NULL) {
|
||||
format_add(ft, "command_list_usage", "%s",
|
||||
entry->usage);
|
||||
}
|
||||
if (entry->alias != NULL)
|
||||
s = entry->alias;
|
||||
else
|
||||
s = "";
|
||||
format_add(ft, "command_list_alias", "%s", s);
|
||||
if (entry->usage != NULL)
|
||||
s = entry->usage;
|
||||
else
|
||||
s = "";
|
||||
format_add(ft, "command_list_usage", "%s", s);
|
||||
|
||||
line = format_expand(ft, template);
|
||||
if (*line != '\0')
|
||||
cmdq_print(cmdq, "%s", line);
|
||||
cmdq_print(item, "%s", line);
|
||||
free(line);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user