mirror of
				https://github.com/tmux/tmux.git
				synced 2025-10-26 12:27:15 +00:00 
			
		
		
		
	Add -T option to select-window to toggle to last window if already
current, from Raghavendra D Prabhu.
This commit is contained in:
		| @@ -31,8 +31,8 @@ enum cmd_retval	 cmd_select_window_exec(struct cmd *, struct cmd_ctx *); | |||||||
|  |  | ||||||
| const struct cmd_entry cmd_select_window_entry = { | const struct cmd_entry cmd_select_window_entry = { | ||||||
| 	"select-window", "selectw", | 	"select-window", "selectw", | ||||||
| 	"lnpt:", 0, 0, | 	"lnpTt:", 0, 0, | ||||||
| 	"[-lnp] " CMD_TARGET_WINDOW_USAGE, | 	"[-lnpT] " CMD_TARGET_WINDOW_USAGE, | ||||||
| 	0, | 	0, | ||||||
| 	cmd_select_window_key_binding, | 	cmd_select_window_key_binding, | ||||||
| 	NULL, | 	NULL, | ||||||
| @@ -130,7 +130,17 @@ cmd_select_window_exec(struct cmd *self, struct cmd_ctx *ctx) | |||||||
| 		if (wl == NULL) | 		if (wl == NULL) | ||||||
| 			return (CMD_RETURN_ERROR); | 			return (CMD_RETURN_ERROR); | ||||||
|  |  | ||||||
| 		if (session_select(s, wl->idx) == 0) | 		/* | ||||||
|  | 		 * If -T and select-window is invoked on same window as | ||||||
|  | 		 * current, switch to previous window. | ||||||
|  | 		 */ | ||||||
|  | 		if (args_has(self->args, 'T') && wl == s->curw) { | ||||||
|  | 			if (session_last(s) != 0) { | ||||||
|  | 				ctx->error(ctx, "no last window"); | ||||||
|  | 				return (-1); | ||||||
|  | 			} | ||||||
|  | 			server_redraw_session(s); | ||||||
|  | 		} else if (session_select(s, wl->idx) == 0) | ||||||
| 			server_redraw_session(s); | 			server_redraw_session(s); | ||||||
| 	} | 	} | ||||||
| 	recalculate_sizes(); | 	recalculate_sizes(); | ||||||
|   | |||||||
| @@ -43,7 +43,6 @@ void	window_choose_scroll_down(struct window_pane *); | |||||||
| void	window_choose_collapse(struct window_pane *, struct session *); | void	window_choose_collapse(struct window_pane *, struct session *); | ||||||
| void	window_choose_expand(struct window_pane *, struct session *, u_int); | void	window_choose_expand(struct window_pane *, struct session *, u_int); | ||||||
| void	window_choose_collapse_all(struct window_pane *); | void	window_choose_collapse_all(struct window_pane *); | ||||||
| void	window_choose_expand_all(struct window_pane *); |  | ||||||
|  |  | ||||||
| enum window_choose_input_type { | enum window_choose_input_type { | ||||||
| 	WINDOW_CHOOSE_NORMAL = -1, | 	WINDOW_CHOOSE_NORMAL = -1, | ||||||
| @@ -118,7 +117,6 @@ window_choose_ready(struct window_pane *wp, u_int cur, | |||||||
| 	ARRAY_CONCAT(&data->old_list, &data->list); | 	ARRAY_CONCAT(&data->old_list, &data->list); | ||||||
|  |  | ||||||
| 	window_choose_collapse_all(wp); | 	window_choose_collapse_all(wp); | ||||||
| 	window_choose_redraw_screen(wp); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| struct screen * | struct screen * | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Nicholas Marriott
					Nicholas Marriott