Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-06-08 22:15:06 +01:00
4 changed files with 67 additions and 17 deletions

View File

@@ -33,8 +33,8 @@ const struct cmd_entry cmd_choose_tree_entry = {
.name = "choose-tree", .name = "choose-tree",
.alias = NULL, .alias = NULL,
.args = { "F:f:GK:kNO:rst:wyZ", 0, 1, cmd_choose_tree_args_parse }, .args = { "F:f:GhK:kNO:rst:wyZ", 0, 1, cmd_choose_tree_args_parse },
.usage = "[-GkNrswZ] [-F format] [-f filter] [-K key-format] " .usage = "[-GhkNrswZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]", "[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
.target = { 't', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 },
@@ -47,8 +47,8 @@ const struct cmd_entry cmd_choose_client_entry = {
.name = "choose-client", .name = "choose-client",
.alias = NULL, .alias = NULL,
.args = { "F:f:K:kNO:rt:yZ", 0, 1, cmd_choose_tree_args_parse }, .args = { "F:f:hK:kNO:rt:yZ", 0, 1, cmd_choose_tree_args_parse },
.usage = "[-kNrZ] [-F format] [-f filter] [-K key-format] " .usage = "[-hkNrZ] [-F format] [-f filter] [-K key-format] "
"[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]", "[-O sort-order] " CMD_TARGET_PANE_USAGE " [template]",
.target = { 't', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 },

46
tmux.1
View File

@@ -2312,7 +2312,6 @@ cursor on that line.
Scroll pane in copy\-mode when bound to a mouse drag event. Scroll pane in copy\-mode when bound to a mouse drag event.
.Fl e .Fl e
causes copy mode to exit when at the bottom. causes copy mode to exit when at the bottom.
.Pp
.It Xo .It Xo
.Ic scroll\-top .Ic scroll\-top
.Xc .Xc
@@ -2743,7 +2742,7 @@ the end of the visible pane.
The default is to capture only the visible contents of the pane. The default is to capture only the visible contents of the pane.
.It Xo .It Xo
.Ic choose\-client .Ic choose\-client
.Op Fl kNryZ .Op Fl hkNryZ
.Op Fl F Ar format .Op Fl F Ar format
.Op Fl f Ar filter .Op Fl f Ar filter
.Op Fl K Ar key\-format .Op Fl K Ar key\-format
@@ -2814,14 +2813,20 @@ If a filter would lead to an empty list, it is ignored.
specifies the format for each item in the list and specifies the format for each item in the list and
.Fl K .Fl K
a format for each shortcut key; both are evaluated once for each line. a format for each shortcut key; both are evaluated once for each line.
.Pp
.Fl N .Fl N
starts without the preview or if given twice with the larger preview. starts without the preview or if given twice with the larger preview.
.Fl h
hides the pane containing the mode.
.Fl k .Fl k
kills the pane when the mode is exited. kills the pane when the mode is exited.
This command works only if at least one client is attached. .Pp
The
.Ic choose-client
command works only if at least one client is attached.
.It Xo .It Xo
.Ic choose\-tree .Ic choose\-tree
.Op Fl GkNrswyZ .Op Fl GhkNrswyZ
.Op Fl F Ar format .Op Fl F Ar format
.Op Fl f Ar filter .Op Fl f Ar filter
.Op Fl K Ar key\-format .Op Fl K Ar key\-format
@@ -2906,14 +2911,27 @@ If a filter would lead to an empty list, it is ignored.
specifies the format for each item in the tree and specifies the format for each item in the tree and
.Fl K .Fl K
a format for each shortcut key; both are evaluated once for each line. a format for each shortcut key; both are evaluated once for each line.
.Fl N
starts without the preview or if given twice with the larger preview.
.Fl G .Fl G
includes all sessions in any session groups in the tree rather than only the includes all sessions in any session groups in the tree rather than only the
first. first.
.Pp
.Fl N
starts without the preview or if given twice with the larger preview.
.Fl h
hides the pane containing the mode.
.Fl k .Fl k
kills the pane when the mode is exited. kills the pane when the mode is exited.
This command works only if at least one client is attached. .Fl h
and
.Fl k
are intended to ease use of the mode in a floating pane; for example:
.Bd -literal -offset indent
bind s 'new-pane -x50% -y50% -E; choose-tree -hks'
.Ed
.Pp
The
.Ic choose-tree
command works only if at least one client is attached.
.It Xo .It Xo
.Ic customize\-mode .Ic customize\-mode
.Op Fl kNZ .Op Fl kNZ
@@ -2962,11 +2980,15 @@ the item in the list is not shown, otherwise it is shown.
If a filter would lead to an empty list, it is ignored. If a filter would lead to an empty list, it is ignored.
.Fl F .Fl F
specifies the format for each item in the tree. specifies the format for each item in the tree.
.Pp
.Fl N .Fl N
starts without the option information. starts without the option information.
.Fl k .Fl k
kills the pane when the mode is exited. kills the pane when the mode is exited.
This command works only if at least one client is attached. .Pp
The
.Ic customize-mode
command works only if at least one client is attached.
.It Xo .It Xo
.Tg displayp .Tg displayp
.Ic display\-panes .Ic display\-panes
@@ -3037,7 +3059,9 @@ The default is
.Fl Z .Fl Z
zooms the pane. zooms the pane.
.Pp .Pp
This command works only if at least one client is attached. The
.Ic find-window
command works only if at least one client is attached.
.Tg joinp .Tg joinp
.It Xo Ic join\-pane .It Xo Ic join\-pane
.Op Fl bdfhv .Op Fl bdfhv
@@ -7706,7 +7730,9 @@ a format for each shortcut key; both are evaluated once for each line.
starts without the preview. starts without the preview.
.Fl k .Fl k
kills the pane when the mode is exited. kills the pane when the mode is exited.
This command works only if at least one client is attached. The
.Ic choose-buffer
command works only if at least one client is attached.
.Tg clearhist .Tg clearhist
.It Xo Ic clear\-history .It Xo Ic clear\-history
.Op Fl H .Op Fl H

View File

@@ -82,6 +82,7 @@ struct window_client_modedata {
char *format; char *format;
char *key_format; char *key_format;
char *command; char *command;
int hide_preview_this_pane;
struct window_client_itemdata **item_list; struct window_client_itemdata **item_list;
u_int item_size; u_int item_size;
@@ -162,9 +163,10 @@ window_client_build(void *modedata, struct sort_criteria *sort_crit,
} }
static void static void
window_client_draw(__unused void *modedata, void *itemdata, window_client_draw(void *modedata, void *itemdata,
struct screen_write_ctx *ctx, u_int sx, u_int sy) struct screen_write_ctx *ctx, u_int sx, u_int sy)
{ {
struct window_client_modedata *data = modedata;
struct window_client_itemdata *item = itemdata; struct window_client_itemdata *item = itemdata;
struct client *c = item->c; struct client *c = item->c;
struct screen *s = ctx->s; struct screen *s = ctx->s;
@@ -174,6 +176,12 @@ window_client_draw(__unused void *modedata, void *itemdata,
if (c->session == NULL || (c->flags & CLIENT_UNATTACHEDFLAGS)) if (c->session == NULL || (c->flags & CLIENT_UNATTACHEDFLAGS))
return; return;
wp = c->session->curw->window->active; wp = c->session->curw->window->active;
if (data->hide_preview_this_pane && wp == data->wp) {
if (!TAILQ_EMPTY(&c->session->curw->window->last_panes))
wp = TAILQ_FIRST(&c->session->curw->window->last_panes);
else
wp = NULL;
}
lines = status_line_size(c); lines = status_line_size(c);
if (lines >= sy) if (lines >= sy)
@@ -184,7 +192,8 @@ window_client_draw(__unused void *modedata, void *itemdata,
at = 0; at = 0;
screen_write_cursormove(ctx, cx, cy + at, 0); screen_write_cursormove(ctx, cx, cy + at, 0);
screen_write_preview(ctx, &wp->base, sx, sy - 2 - lines); if (wp != NULL)
screen_write_preview(ctx, &wp->base, sx, sy - 2 - lines);
if (at != 0) if (at != 0)
screen_write_cursormove(ctx, cx, cy + 2, 0); screen_write_cursormove(ctx, cx, cy + 2, 0);
@@ -270,6 +279,7 @@ window_client_init(struct window_mode_entry *wme,
wme->data = data = xcalloc(1, sizeof *data); wme->data = data = xcalloc(1, sizeof *data);
data->wp = wp; data->wp = wp;
data->hide_preview_this_pane = args != NULL && args_has(args, 'h');
if (args == NULL || !args_has(args, 'F')) if (args == NULL || !args_has(args, 'F'))
data->format = xstrdup(WINDOW_CLIENT_DEFAULT_FORMAT); data->format = xstrdup(WINDOW_CLIENT_DEFAULT_FORMAT);

View File

@@ -113,6 +113,7 @@ struct window_tree_modedata {
char *key_format; char *key_format;
char *command; char *command;
int squash_groups; int squash_groups;
int hide_preview_this_pane;
int prompt_flags; int prompt_flags;
struct window_tree_itemdata **item_list; struct window_tree_itemdata **item_list;
@@ -289,6 +290,8 @@ window_tree_build_window(struct session *s, struct winlink *wl,
if (n == 0) if (n == 0)
goto empty; goto empty;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (data->hide_preview_this_pane && l[i] == data->wp)
continue;
if (window_tree_filter_pane(s, wl, l[i], filter)) if (window_tree_filter_pane(s, wl, l[i], filter))
window_tree_build_pane(s, wl, l[i], modedata, mti); window_tree_build_pane(s, wl, l[i], modedata, mti);
} }
@@ -580,6 +583,10 @@ window_tree_draw_window(struct window_tree_modedata *data, struct session *s,
struct options *oo; struct options *oo;
total = window_count_panes(w, 1); total = window_count_panes(w, 1);
if (data->hide_preview_this_pane && data->wp->window == w)
total--;
if (total == 0)
return;
if (sx / total < 24) { if (sx / total < 24) {
visible = sx / 24; visible = sx / 24;
@@ -590,6 +597,8 @@ window_tree_draw_window(struct window_tree_modedata *data, struct session *s,
current = 0; current = 0;
TAILQ_FOREACH(wp, &w->panes, entry) { TAILQ_FOREACH(wp, &w->panes, entry) {
if (data->hide_preview_this_pane && wp == data->wp)
continue;
if (wp == w->active) if (wp == w->active)
break; break;
current++; current++;
@@ -653,6 +662,8 @@ window_tree_draw_window(struct window_tree_modedata *data, struct session *s,
i = loop = 0; i = loop = 0;
TAILQ_FOREACH(wp, &w->panes, entry) { TAILQ_FOREACH(wp, &w->panes, entry) {
if (data->hide_preview_this_pane && wp == data->wp)
continue;
if (loop == end) if (loop == end)
break; break;
if (loop < start) { if (loop < start) {
@@ -704,6 +715,7 @@ static void
window_tree_draw(void *modedata, void *itemdata, struct screen_write_ctx *ctx, window_tree_draw(void *modedata, void *itemdata, struct screen_write_ctx *ctx,
u_int sx, u_int sy) u_int sx, u_int sy)
{ {
struct window_tree_modedata *data = modedata;
struct window_tree_itemdata *item = itemdata; struct window_tree_itemdata *item = itemdata;
struct session *sp; struct session *sp;
struct winlink *wl; struct winlink *wl;
@@ -723,7 +735,8 @@ window_tree_draw(void *modedata, void *itemdata, struct screen_write_ctx *ctx,
window_tree_draw_window(modedata, sp, wl, ctx, sx, sy); window_tree_draw_window(modedata, sp, wl, ctx, sx, sy);
break; break;
case WINDOW_TREE_PANE: case WINDOW_TREE_PANE:
screen_write_preview(ctx, &wp->base, sx, sy); if (!data->hide_preview_this_pane || wp != data->wp)
screen_write_preview(ctx, &wp->base, sx, sy);
break; break;
} }
} }
@@ -932,6 +945,7 @@ window_tree_init(struct window_mode_entry *wme, struct cmd_find_state *fs,
else else
data->command = xstrdup(args_string(args, 0)); data->command = xstrdup(args_string(args, 0));
data->squash_groups = !args_has(args, 'G'); data->squash_groups = !args_has(args, 'G');
data->hide_preview_this_pane = args_has(args, 'h');
if (args_has(args, 'y')) if (args_has(args, 'y'))
data->prompt_flags = PROMPT_ACCEPT; data->prompt_flags = PROMPT_ACCEPT;