mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Change format of choose-tree arrows slightly, from Romain Francoise.
This commit is contained in:
		@@ -74,11 +74,14 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
	struct args			*args = self->args;
 | 
			
		||||
	struct winlink			*wl, *wm;
 | 
			
		||||
	struct session			*s, *s2;
 | 
			
		||||
	struct tty			*tty;
 | 
			
		||||
	struct window_choose_data	*wcd = NULL;
 | 
			
		||||
	const char			*ses_template, *win_template;
 | 
			
		||||
	char				*final_win_action, *final_win_template;
 | 
			
		||||
	char				*final_win_action, *cur_win_template;
 | 
			
		||||
	char				*final_win_template_middle;
 | 
			
		||||
	char				*final_win_template_last;
 | 
			
		||||
	const char			*ses_action, *win_action;
 | 
			
		||||
	u_int				 cur_win, idx_ses, win_ses;
 | 
			
		||||
	u_int				 cur_win, idx_ses, win_ses, win_max;
 | 
			
		||||
	u_int				 wflag, sflag;
 | 
			
		||||
 | 
			
		||||
	ses_template = win_template = NULL;
 | 
			
		||||
@@ -90,6 +93,7 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	s = ctx->curclient->session;
 | 
			
		||||
	tty = &ctx->curclient->tty;
 | 
			
		||||
 | 
			
		||||
	if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
 | 
			
		||||
		return (CMD_RETURN_ERROR);
 | 
			
		||||
@@ -146,12 +150,14 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
	 * window template, otherwise just render the windows as a flat list
 | 
			
		||||
	 * without any padding.
 | 
			
		||||
	 */
 | 
			
		||||
	if (wflag && sflag)
 | 
			
		||||
		xasprintf(&final_win_template, "    --> %s", win_template);
 | 
			
		||||
	else if (wflag)
 | 
			
		||||
		final_win_template = xstrdup(win_template);
 | 
			
		||||
	else
 | 
			
		||||
		final_win_template = NULL;
 | 
			
		||||
	if (wflag && sflag) {
 | 
			
		||||
		xasprintf(&final_win_template_middle, " |-> %s", win_template);
 | 
			
		||||
		xasprintf(&final_win_template_last, " \\-> %s", win_template);
 | 
			
		||||
	} else if (wflag) {
 | 
			
		||||
		final_win_template_middle = xstrdup(win_template);
 | 
			
		||||
		final_win_template_last = xstrdup(win_template);
 | 
			
		||||
	} else
 | 
			
		||||
		final_win_template_middle = final_win_template_last = NULL;
 | 
			
		||||
 | 
			
		||||
	idx_ses = cur_win = -1;
 | 
			
		||||
	RB_FOREACH(s2, sessions, &sessions) {
 | 
			
		||||
@@ -178,7 +184,9 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx)
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
windows_only:
 | 
			
		||||
		win_ses = -1;
 | 
			
		||||
		win_ses = win_max = -1;
 | 
			
		||||
		RB_FOREACH(wm, winlinks, &s2->windows)
 | 
			
		||||
			win_max++;
 | 
			
		||||
		RB_FOREACH(wm, winlinks, &s2->windows) {
 | 
			
		||||
			win_ses++;
 | 
			
		||||
			if (sflag && wflag)
 | 
			
		||||
@@ -199,8 +207,13 @@ windows_only:
 | 
			
		||||
			xasprintf(&final_win_action, "%s ; %s", win_action,
 | 
			
		||||
			    wcd ? wcd->command : "");
 | 
			
		||||
 | 
			
		||||
			if (win_ses != win_max)
 | 
			
		||||
				cur_win_template = final_win_template_middle;
 | 
			
		||||
			else
 | 
			
		||||
				cur_win_template = final_win_template_last;
 | 
			
		||||
 | 
			
		||||
			window_choose_add_window(wl->window->active,
 | 
			
		||||
				ctx, s2, wm, final_win_template,
 | 
			
		||||
			    ctx, s2, wm, cur_win_template,
 | 
			
		||||
			    final_win_action, idx_ses);
 | 
			
		||||
 | 
			
		||||
			free(final_win_action);
 | 
			
		||||
@@ -212,7 +225,8 @@ windows_only:
 | 
			
		||||
		if (wflag && !sflag)
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
	free(final_win_template);
 | 
			
		||||
	free(final_win_template_middle);
 | 
			
		||||
	free(final_win_template_last);
 | 
			
		||||
 | 
			
		||||
	window_choose_ready(wl->window->active, cur_win,
 | 
			
		||||
		cmd_choose_tree_callback, cmd_choose_tree_free);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user