mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 01:34:18 +00:00 
			
		
		
		
	Key (v) and flag (-N) to toggle preview in choose modes.
This commit is contained in:
		@@ -30,8 +30,8 @@ const struct cmd_entry cmd_choose_tree_entry = {
 | 
			
		||||
	.name = "choose-tree",
 | 
			
		||||
	.alias = NULL,
 | 
			
		||||
 | 
			
		||||
	.args = { "F:f:O:st:w", 0, 1 },
 | 
			
		||||
	.usage = "[-sw] [-F format] [-f filter] [-O sort-order] "
 | 
			
		||||
	.args = { "F:f:NO:st:w", 0, 1 },
 | 
			
		||||
	.usage = "[-Nsw] [-F format] [-f filter] [-O sort-order] "
 | 
			
		||||
	         CMD_TARGET_PANE_USAGE,
 | 
			
		||||
 | 
			
		||||
	.target = { 't', CMD_FIND_PANE, 0 },
 | 
			
		||||
@@ -44,8 +44,8 @@ const struct cmd_entry cmd_choose_client_entry = {
 | 
			
		||||
	.name = "choose-client",
 | 
			
		||||
	.alias = NULL,
 | 
			
		||||
 | 
			
		||||
	.args = { "F:f:O:t:", 0, 1 },
 | 
			
		||||
	.usage = "[-F format] [-f filter] [-O sort-order] "
 | 
			
		||||
	.args = { "F:f:NO:t:", 0, 1 },
 | 
			
		||||
	.usage = "[-N] [-F format] [-f filter] [-O sort-order] "
 | 
			
		||||
	         CMD_TARGET_PANE_USAGE,
 | 
			
		||||
 | 
			
		||||
	.target = { 't', CMD_FIND_PANE, 0 },
 | 
			
		||||
@@ -58,8 +58,8 @@ const struct cmd_entry cmd_choose_buffer_entry = {
 | 
			
		||||
	.name = "choose-buffer",
 | 
			
		||||
	.alias = NULL,
 | 
			
		||||
 | 
			
		||||
	.args = { "F:f:O:t:", 0, 1 },
 | 
			
		||||
	.usage = "[-F format] [-f filter] [-O sort-order] "
 | 
			
		||||
	.args = { "F:f:NO:t:", 0, 1 },
 | 
			
		||||
	.usage = "[-N] [-F format] [-f filter] [-O sort-order] "
 | 
			
		||||
	         CMD_TARGET_PANE_USAGE,
 | 
			
		||||
 | 
			
		||||
	.target = { 't', CMD_FIND_PANE, 0 },
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								mode-tree.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								mode-tree.c
									
									
									
									
									
								
							@@ -60,6 +60,7 @@ struct mode_tree_data {
 | 
			
		||||
 | 
			
		||||
	struct screen		  screen;
 | 
			
		||||
 | 
			
		||||
	int			  preview;
 | 
			
		||||
	char			 *search;
 | 
			
		||||
	char			 *filter;
 | 
			
		||||
};
 | 
			
		||||
@@ -295,6 +296,8 @@ mode_tree_start(struct window_pane *wp, struct args *args,
 | 
			
		||||
	mtd->sort_size = sort_size;
 | 
			
		||||
	mtd->sort_type = 0;
 | 
			
		||||
 | 
			
		||||
	mtd->preview = !args_has(args, 'N');
 | 
			
		||||
 | 
			
		||||
	sort = args_get(args, 'O');
 | 
			
		||||
	if (sort != NULL) {
 | 
			
		||||
		for (i = 0; i < sort_size; i++) {
 | 
			
		||||
@@ -348,6 +351,7 @@ mode_tree_build(struct mode_tree_data *mtd)
 | 
			
		||||
	mode_tree_set_current(mtd, tag);
 | 
			
		||||
 | 
			
		||||
	mtd->width = screen_size_x(s);
 | 
			
		||||
	if (mtd->preview) {
 | 
			
		||||
		mtd->height = (screen_size_y(s) / 3) * 2;
 | 
			
		||||
		if (mtd->height > mtd->line_size)
 | 
			
		||||
			mtd->height = screen_size_y(s) / 2;
 | 
			
		||||
@@ -355,6 +359,8 @@ mode_tree_build(struct mode_tree_data *mtd)
 | 
			
		||||
			mtd->height = screen_size_y(s);
 | 
			
		||||
		if (screen_size_y(s) - mtd->height < 2)
 | 
			
		||||
			mtd->height = screen_size_y(s);
 | 
			
		||||
	} else
 | 
			
		||||
		mtd->height = screen_size_y(s);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void
 | 
			
		||||
@@ -549,7 +555,7 @@ mode_tree_draw(struct mode_tree_data *mtd)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sy = screen_size_y(s);
 | 
			
		||||
	if (sy <= 4 || h <= 4 || sy - h <= 4 || w <= 4) {
 | 
			
		||||
	if (!mtd->preview || sy <= 4 || h <= 4 || sy - h <= 4 || w <= 4) {
 | 
			
		||||
		screen_write_stop(&ctx);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
@@ -861,6 +867,10 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
 | 
			
		||||
		    mode_tree_filter_callback, mode_tree_filter_free, mtd,
 | 
			
		||||
		    PROMPT_NOFORMAT);
 | 
			
		||||
		break;
 | 
			
		||||
	case 'v':
 | 
			
		||||
		mtd->preview = !mtd->preview;
 | 
			
		||||
		mode_tree_build(mtd);
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								tmux.1
									
									
									
									
									
								
							@@ -1354,6 +1354,7 @@ the end of the visible pane.
 | 
			
		||||
The default is to capture only the visible contents of the pane.
 | 
			
		||||
.It Xo
 | 
			
		||||
.Ic choose-client
 | 
			
		||||
.Op Fl N
 | 
			
		||||
.Op Fl F Ar format
 | 
			
		||||
.Op Fl f Ar filter
 | 
			
		||||
.Op Fl O Ar sort-order
 | 
			
		||||
@@ -1381,6 +1382,7 @@ The following keys may be used in client mode:
 | 
			
		||||
.It Li "Z" Ta "Suspend tagged clients"
 | 
			
		||||
.It Li "f" Ta "Enter a format to filter items"
 | 
			
		||||
.It Li "O" Ta "Change sort order"
 | 
			
		||||
.It Li "v" Ta "Toggle preview"
 | 
			
		||||
.It Li "q" Ta "Exit mode"
 | 
			
		||||
.El
 | 
			
		||||
.Pp
 | 
			
		||||
@@ -1404,10 +1406,12 @@ or
 | 
			
		||||
specifies an initial filter.
 | 
			
		||||
.Fl F
 | 
			
		||||
specifies the format for each item in the list.
 | 
			
		||||
.Fl N
 | 
			
		||||
starts without the preview.
 | 
			
		||||
This command works only if at least one client is attached.
 | 
			
		||||
.It Xo
 | 
			
		||||
.Ic choose-tree
 | 
			
		||||
.Op Fl sw
 | 
			
		||||
.Op Fl Nsw
 | 
			
		||||
.Op Fl F Ar format
 | 
			
		||||
.Op Fl f Ar filter
 | 
			
		||||
.Op Fl O Ar sort-order
 | 
			
		||||
@@ -1436,6 +1440,7 @@ The following keys may be used in tree mode:
 | 
			
		||||
.It Li "\&:" Ta "Run a command for each tagged item"
 | 
			
		||||
.It Li "f" Ta "Enter a format to filter items"
 | 
			
		||||
.It Li "O" Ta "Change sort order"
 | 
			
		||||
.It Li "v" Ta "Toggle preview"
 | 
			
		||||
.It Li "q" Ta "Exit mode"
 | 
			
		||||
.El
 | 
			
		||||
.Pp
 | 
			
		||||
@@ -1458,6 +1463,8 @@ or
 | 
			
		||||
specifies an initial filter.
 | 
			
		||||
.Fl F
 | 
			
		||||
specifies the format for each item in the tree.
 | 
			
		||||
.Fl N
 | 
			
		||||
starts without the preview.
 | 
			
		||||
This command works only if at least one client is attached.
 | 
			
		||||
.It Xo
 | 
			
		||||
.Ic display-panes
 | 
			
		||||
@@ -4054,6 +4061,7 @@ The buffer commands are as follows:
 | 
			
		||||
.Bl -tag -width Ds
 | 
			
		||||
.It Xo
 | 
			
		||||
.Ic choose-buffer
 | 
			
		||||
.Op Fl N
 | 
			
		||||
.Op Fl F Ar format
 | 
			
		||||
.Op Fl f Ar filter
 | 
			
		||||
.Op Fl O Ar sort-order
 | 
			
		||||
@@ -4077,6 +4085,7 @@ The following keys may be used in buffer mode:
 | 
			
		||||
.It Li "D" Ta "Delete tagged buffers"
 | 
			
		||||
.It Li "f" Ta "Enter a format to filter items"
 | 
			
		||||
.It Li "O" Ta "Change sort order"
 | 
			
		||||
.It Li "v" Ta "Toggle preview"
 | 
			
		||||
.It Li "q" Ta "Exit mode"
 | 
			
		||||
.El
 | 
			
		||||
.Pp
 | 
			
		||||
@@ -4099,6 +4108,8 @@ or
 | 
			
		||||
specifies an initial filter.
 | 
			
		||||
.Fl F
 | 
			
		||||
specifies the format for each item in the list.
 | 
			
		||||
.Fl N
 | 
			
		||||
starts without the preview.
 | 
			
		||||
This command works only if at least one client is attached.
 | 
			
		||||
.It Ic clear-history Op Fl t Ar target-pane
 | 
			
		||||
.D1 (alias: Ic clearhist )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user