mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-03 16:46:18 +00:00 
			
		
		
		
	Support up, down, left, right movement through panes with -UDLR flags to
select-pane. Also remove up- and down-pane: equivalent behaviour is now available using -t :.+ and -t :.-.
This commit is contained in:
		
							
								
								
									
										22
									
								
								cmd.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								cmd.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: cmd.c,v 1.137 2010-01-22 17:28:34 tcunha Exp $ */
 | 
			
		||||
/* $Id: cmd.c,v 1.138 2010-03-15 22:03:38 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -44,7 +44,6 @@ const struct cmd_entry *cmd_table[] = {
 | 
			
		||||
	&cmd_detach_client_entry,
 | 
			
		||||
	&cmd_display_message_entry,
 | 
			
		||||
	&cmd_display_panes_entry,
 | 
			
		||||
	&cmd_down_pane_entry,
 | 
			
		||||
	&cmd_find_window_entry,
 | 
			
		||||
	&cmd_has_session_entry,
 | 
			
		||||
	&cmd_if_shell_entry,
 | 
			
		||||
@@ -108,7 +107,6 @@ const struct cmd_entry *cmd_table[] = {
 | 
			
		||||
	&cmd_switch_client_entry,
 | 
			
		||||
	&cmd_unbind_key_entry,
 | 
			
		||||
	&cmd_unlink_window_entry,
 | 
			
		||||
	&cmd_up_pane_entry,
 | 
			
		||||
	NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -954,15 +952,29 @@ cmd_find_pane(struct cmd_ctx *ctx,
 | 
			
		||||
	return (wl);
 | 
			
		||||
 | 
			
		||||
lookup_string:
 | 
			
		||||
	/* Try as next or previous pane. */
 | 
			
		||||
	if (paneptr[0] == '+' && paneptr[1] == '\0') {
 | 
			
		||||
		*wpp = TAILQ_NEXT(wl->window->active, entry);
 | 
			
		||||
		if (*wpp == NULL)
 | 
			
		||||
			*wpp = TAILQ_FIRST(&wl->window->panes);
 | 
			
		||||
		return (wl);
 | 
			
		||||
	}
 | 
			
		||||
	if (paneptr[0] == '-' && paneptr[1] == '\0') {
 | 
			
		||||
		*wpp = TAILQ_PREV(wl->window->active, window_panes, entry);
 | 
			
		||||
		if (*wpp == NULL)
 | 
			
		||||
			*wpp = TAILQ_LAST(&wl->window->panes, window_panes);
 | 
			
		||||
		return (wl);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Try pane string description. */
 | 
			
		||||
	if ((lc = layout_find_string(s->curw->window, paneptr)) == NULL) {
 | 
			
		||||
	if ((lc = layout_find_string(wl->window, paneptr)) == NULL) {
 | 
			
		||||
		ctx->error(ctx, "can't find pane: %s", paneptr);
 | 
			
		||||
		goto error;
 | 
			
		||||
	}
 | 
			
		||||
	*wpp = lc->wp;
 | 
			
		||||
 | 
			
		||||
	xfree(winptr);
 | 
			
		||||
	return (s->curw);
 | 
			
		||||
	return (wl);
 | 
			
		||||
 | 
			
		||||
no_period:
 | 
			
		||||
	/* Try as a pane number alone. */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user