summaryrefslogtreecommitdiffstats
path: root/cmd.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-03-22 19:07:52 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-03-22 19:07:52 +0000
commit6f04866044e7482c20bd28abd876d173093fa6ac (patch)
tree3cb0a65d0ea702094fe9e4e3d717987d09e5cb58 /cmd.c
parent021037c419b2044f5ba6f9596cc86923ab130309 (diff)
Support up, down, left, right movement through panes with -UDLR flags to
select-pane. Also REMOVE the up- and down-pane commands: equivalent behaviour is now available using -t :.+ and -t :.-.
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/cmd.c b/cmd.c
index 6163d78a..09b58adf 100644
--- a/cmd.c
+++ b/cmd.c
@@ -45,7 +45,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,
@@ -109,7 +108,6 @@ const struct cmd_entry *cmd_table[] = {
&cmd_switch_client_entry,
&cmd_unbind_key_entry,
&cmd_unlink_window_entry,
- &cmd_up_pane_entry,
NULL
};
@@ -955,15 +953,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. */