From b65eab55057d68fee88795043bd407014829ced5 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 3 Apr 2020 05:18:02 +0000 Subject: [PATCH 1/4] Check previous line rather than an extra line, from Anindya Mukherjee. --- window-copy.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/window-copy.c b/window-copy.c index 1a558915..149287b5 100644 --- a/window-copy.c +++ b/window-copy.c @@ -2825,11 +2825,8 @@ window_copy_search_marks(struct window_mode_entry *wme, struct screen *ssp, } } time(&tstart); - py = gd->hsize - data->oy; - if (py > 0) - py--; - for (; py > 0; py--) { - gl = grid_peek_line(gd, py); + for (py = gd->hsize - data->oy; py > 0; py--) { + gl = grid_peek_line(gd, py - 1); if (~gl->flags & GRID_LINE_WRAPPED) break; } From c9b9b0c7c3b071056c1e72bc03fde0f5771f809c Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 3 Apr 2020 12:59:22 +0000 Subject: [PATCH 2/4] Stop logging the entire command queue every time we add something, spotted by tb & sthen. --- cmd-queue.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cmd-queue.c b/cmd-queue.c index 59c7a35c..a9e1dd3a 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -59,10 +59,6 @@ cmdq_append(struct client *c, struct cmdq_item *item) struct cmdq_list *queue = cmdq_get(c); struct cmdq_item *next; - TAILQ_FOREACH(next, queue, entry) { - log_debug("%s %s: queue %s (%u)", __func__, cmdq_name(c), - next->name, next->group); - } do { next = item->next; item->next = NULL; @@ -88,10 +84,6 @@ cmdq_insert_after(struct cmdq_item *after, struct cmdq_item *item) struct cmdq_list *queue = after->queue; struct cmdq_item *next; - TAILQ_FOREACH(next, queue, entry) { - log_debug("%s %s: queue %s (%u)", __func__, cmdq_name(c), - next->name, next->group); - } do { next = item->next; item->next = after->next; From 832b8a8cf51ff0ea5137ae38210e067ffae169d8 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 3 Apr 2020 13:54:31 +0000 Subject: [PATCH 3/4] Use new window and new pane as well for -P to new-session or new-window. --- cmd-new-session.c | 2 +- cmd-new-window.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd-new-session.c b/cmd-new-session.c index c76b564e..a75fc972 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -334,7 +334,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) if (args_has(args, 'P')) { if ((template = args_get(args, 'F')) == NULL) template = NEW_SESSION_TEMPLATE; - cp = format_single(item, template, c, s, NULL, NULL); + cp = format_single(item, template, c, s, s->curw, NULL); cmdq_print(item, "%s", cp); free(cp); } diff --git a/cmd-new-window.c b/cmd-new-window.c index a4d6c014..033d208a 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -108,7 +108,8 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item) if (args_has(args, 'P')) { if ((template = args_get(args, 'F')) == NULL) template = NEW_WINDOW_TEMPLATE; - cp = format_single(item, template, c, s, new_wl, NULL); + cp = format_single(item, template, c, s, new_wl, + new_wl->window->active); cmdq_print(item, "%s", cp); free(cp); } From fccce69cf08b220ecad690e22451afd487e4b639 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 5 Apr 2020 08:40:31 +0000 Subject: [PATCH 4/4] Add an argument to list-commands to show only a single command. --- cmd-list-keys.c | 14 +++++++++++--- tmux.1 | 7 +++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/cmd-list-keys.c b/cmd-list-keys.c index 34ed43bf..7e340516 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -47,8 +47,8 @@ const struct cmd_entry cmd_list_commands_entry = { .name = "list-commands", .alias = "lscm", - .args = { "F:", 0, 0 }, - .usage = "[-F format]", + .args = { "F:", 0, 1 }, + .usage = "[-F format] [command]", .flags = CMD_STARTSERVER|CMD_AFTERHOOK, .exec = cmd_list_keys_exec @@ -317,9 +317,12 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item) const struct cmd_entry **entryp; const struct cmd_entry *entry; struct format_tree *ft; - const char *template, *s; + const char *template, *s, *command = NULL; char *line; + if (args->argc != 0) + command = args->argv[0]; + if ((template = args_get(args, 'F')) == NULL) { template = "#{command_list_name}" "#{?command_list_alias, (#{command_list_alias}),} " @@ -331,6 +334,11 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item) for (entryp = cmd_table; *entryp != NULL; entryp++) { entry = *entryp; + if (command != NULL && + (strcmp(entry->name, command) != 0 && + (entry->alias == NULL || + strcmp(entry->alias, command) != 0))) + continue; format_add(ft, "command_list_name", "%s", entry->name); if (entry->alias != NULL) diff --git a/tmux.1 b/tmux.1 index 9346c443..ca50f524 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1048,9 +1048,12 @@ If is specified, list only clients connected to that session. .It Xo Ic list-commands .Op Fl F Ar format +.Op Ar command .Xc .D1 (alias: Ic lscm ) -List the syntax of all commands supported by +List the syntax of +.Ar command +or - if omitted - of all commands supported by .Nm . .It Ic list-sessions Op Fl F Ar format .D1 (alias: Ic ls ) @@ -2731,7 +2734,7 @@ command. .It Xo Ic list-keys .Op Fl 1aN .Op Fl P Ar prefix-string Fl T Ar key-table -.Op key +.Op Ar key .Xc .D1 (alias: Ic lsk ) List key bindings.