mirror of
https://github.com/tmux/tmux.git
synced 2025-03-29 02:08:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
ef68debc8d
@ -41,7 +41,7 @@ const struct cmd_entry cmd_display_menu_entry = {
|
|||||||
.args = { "b:c:C:H:s:S:MOt:T:x:y:", 1, -1, cmd_display_menu_args_parse },
|
.args = { "b:c:C:H:s:S:MOt:T:x:y:", 1, -1, cmd_display_menu_args_parse },
|
||||||
.usage = "[-MO] [-b border-lines] [-c target-client] "
|
.usage = "[-MO] [-b border-lines] [-c target-client] "
|
||||||
"[-C starting-choice] [-H selected-style] [-s style] "
|
"[-C starting-choice] [-H selected-style] [-s style] "
|
||||||
"[-S border-style] " CMD_TARGET_PANE_USAGE "[-T title] "
|
"[-S border-style] " CMD_TARGET_PANE_USAGE " [-T title] "
|
||||||
"[-x position] [-y position] name key command ...",
|
"[-x position] [-y position] name key command ...",
|
||||||
|
|
||||||
.target = { 't', CMD_FIND_PANE, 0 },
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
@ -58,7 +58,7 @@ const struct cmd_entry cmd_display_popup_entry = {
|
|||||||
.usage = "[-BCE] [-b border-lines] [-c target-client] "
|
.usage = "[-BCE] [-b border-lines] [-c target-client] "
|
||||||
"[-d start-directory] [-e environment] [-h height] "
|
"[-d start-directory] [-e environment] [-h height] "
|
||||||
"[-s style] [-S border-style] " CMD_TARGET_PANE_USAGE
|
"[-s style] [-S border-style] " CMD_TARGET_PANE_USAGE
|
||||||
"[-T title] [-w width] [-x position] [-y position] "
|
" [-T title] [-w width] [-x position] [-y position] "
|
||||||
"[shell-command]",
|
"[shell-command]",
|
||||||
|
|
||||||
.target = { 't', CMD_FIND_PANE, 0 },
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
@ -91,7 +91,7 @@ cmd_list_keys_print_notes(struct cmdq_item *item, struct args *args,
|
|||||||
struct key_binding *bd;
|
struct key_binding *bd;
|
||||||
const char *key;
|
const char *key;
|
||||||
char *tmp, *note;
|
char *tmp, *note;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
table = key_bindings_get_table(tablename, 0);
|
table = key_bindings_get_table(tablename, 0);
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
@ -321,6 +321,31 @@ out:
|
|||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cmd_list_single_command(const struct cmd_entry *entry, struct format_tree *ft,
|
||||||
|
const char *template, struct cmdq_item *item)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
char *line;
|
||||||
|
|
||||||
|
format_add(ft, "command_list_name", "%s", entry->name);
|
||||||
|
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(item, "%s", line);
|
||||||
|
free(line);
|
||||||
|
}
|
||||||
|
|
||||||
static enum cmd_retval
|
static enum cmd_retval
|
||||||
cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
|
cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
|
||||||
{
|
{
|
||||||
@ -328,8 +353,8 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
|
|||||||
const struct cmd_entry **entryp;
|
const struct cmd_entry **entryp;
|
||||||
const struct cmd_entry *entry;
|
const struct cmd_entry *entry;
|
||||||
struct format_tree *ft;
|
struct format_tree *ft;
|
||||||
const char *template, *s, *command;
|
const char *template, *command;
|
||||||
char *line;
|
char *cause;
|
||||||
|
|
||||||
if ((template = args_get(args, 'F')) == NULL) {
|
if ((template = args_get(args, 'F')) == NULL) {
|
||||||
template = "#{command_list_name}"
|
template = "#{command_list_name}"
|
||||||
@ -341,30 +366,19 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item)
|
|||||||
format_defaults(ft, NULL, NULL, NULL, NULL);
|
format_defaults(ft, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
command = args_string(args, 0);
|
command = args_string(args, 0);
|
||||||
for (entryp = cmd_table; *entryp != NULL; entryp++) {
|
if (command == NULL) {
|
||||||
entry = *entryp;
|
for (entryp = cmd_table; *entryp != NULL; entryp++)
|
||||||
if (command != NULL &&
|
cmd_list_single_command(*entryp, ft, template, item);
|
||||||
(strcmp(entry->name, command) != 0 &&
|
} else {
|
||||||
(entry->alias == NULL ||
|
entry = cmd_find(command, &cause);
|
||||||
strcmp(entry->alias, command) != 0)))
|
if (entry != NULL)
|
||||||
continue;
|
cmd_list_single_command(entry, ft, template, item);
|
||||||
|
else {
|
||||||
format_add(ft, "command_list_name", "%s", entry->name);
|
cmdq_error(item, "%s", cause);
|
||||||
if (entry->alias != NULL)
|
free(cause);
|
||||||
s = entry->alias;
|
format_free(ft);
|
||||||
else
|
return (CMD_RETURN_ERROR);
|
||||||
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(item, "%s", line);
|
|
||||||
free(line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
format_free(ft);
|
format_free(ft);
|
||||||
|
@ -42,7 +42,7 @@ const struct cmd_entry cmd_split_window_entry = {
|
|||||||
.args = { "bc:de:fF:hIl:p:Pt:vZ", 0, -1, NULL },
|
.args = { "bc:de:fF:hIl:p:Pt:vZ", 0, -1, NULL },
|
||||||
.usage = "[-bdefhIPvZ] [-c start-directory] [-e environment] "
|
.usage = "[-bdefhIPvZ] [-c start-directory] [-e environment] "
|
||||||
"[-F format] [-l size] " CMD_TARGET_PANE_USAGE
|
"[-F format] [-l size] " CMD_TARGET_PANE_USAGE
|
||||||
"[shell-command]",
|
" [shell-command]",
|
||||||
|
|
||||||
.target = { 't', CMD_FIND_PANE, 0 },
|
.target = { 't', CMD_FIND_PANE, 0 },
|
||||||
|
|
||||||
|
2
cmd.c
2
cmd.c
@ -444,7 +444,7 @@ cmd_get_alias(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Look up a command entry by name. */
|
/* Look up a command entry by name. */
|
||||||
static const struct cmd_entry *
|
const struct cmd_entry *
|
||||||
cmd_find(const char *name, char **cause)
|
cmd_find(const char *name, char **cause)
|
||||||
{
|
{
|
||||||
const struct cmd_entry **loop, *entry, *found = NULL;
|
const struct cmd_entry **loop, *entry, *found = NULL;
|
||||||
|
1
tmux.h
1
tmux.h
@ -2641,6 +2641,7 @@ int cmd_find_from_nothing(struct cmd_find_state *, int);
|
|||||||
|
|
||||||
/* cmd.c */
|
/* cmd.c */
|
||||||
extern const struct cmd_entry *cmd_table[];
|
extern const struct cmd_entry *cmd_table[];
|
||||||
|
const struct cmd_entry *cmd_find(const char *, char **);
|
||||||
void printflike(3, 4) cmd_log_argv(int, char **, const char *, ...);
|
void printflike(3, 4) cmd_log_argv(int, char **, const char *, ...);
|
||||||
void cmd_prepend_argv(int *, char ***, const char *);
|
void cmd_prepend_argv(int *, char ***, const char *);
|
||||||
void cmd_append_argv(int *, char ***, const char *);
|
void cmd_append_argv(int *, char ***, const char *);
|
||||||
|
Loading…
Reference in New Issue
Block a user