summaryrefslogtreecommitdiffstats
path: root/cmd-select-pane.c
diff options
context:
space:
mode:
authornicm <nicm>2015-06-04 11:43:51 +0000
committernicm <nicm>2015-06-04 11:43:51 +0000
commita863834574ec02b87ff0e7245ef31f0d4543ab34 (patch)
tree4fe2aa4fe98c34bb0d56e5032460889b70dfc317 /cmd-select-pane.c
parenta3edfd9e84f4f8e9b74425cdc4b00fe9cb3d0ba6 (diff)
Add support for a single "marked pane". There is one marked pane in the
server at a time; it may be toggled or cleared with select-pane -m and -M (the border is highlighted). A new target '~' or '{marked}' specifies the marked pane to commands and it is the default target for the swap-pane and join-pane -s flag (this makes them much simpler to use - mark the source pane and then change to the target pane to run swapp or joinp).
Diffstat (limited to 'cmd-select-pane.c')
-rw-r--r--cmd-select-pane.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index f237e8fd..5ea4bdc3 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -28,8 +28,8 @@ enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_select_pane_entry = {
"select-pane", "selectp",
- "DdegLlP:Rt:U", 0, 0,
- "[-DdegLlRU] [-P style] " CMD_TARGET_PANE_USAGE,
+ "DdegLlMmP:Rt:U", 0, 0,
+ "[-DdegLlMmRU] [-P style] " CMD_TARGET_PANE_USAGE,
0,
cmd_select_pane_exec
};
@@ -47,7 +47,8 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
struct winlink *wl;
- struct window_pane *wp;
+ struct session *s;
+ struct window_pane *wp, *lastwp, *markedwp;
const char *style;
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
@@ -74,9 +75,31 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_NORMAL);
}
- if ((wl = cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp)) == NULL)
+ if ((wl = cmd_find_pane(cmdq, args_get(args, 't'), &s, &wp)) == NULL)
return (CMD_RETURN_ERROR);
+ if (args_has(args, 'm') || args_has(args, 'M')) {
+ if (args_has(args, 'm') && !window_pane_visible(wp))
+ return (CMD_RETURN_NORMAL);
+ lastwp = marked_window_pane;
+
+ if (args_has(args, 'M') || server_is_marked(s, wl, wp))
+ server_clear_marked();
+ else
+ server_set_marked(s, wl, wp);
+ markedwp = marked_window_pane;
+
+ if (lastwp != NULL) {
+ server_redraw_window_borders(lastwp->window);
+ server_status_window(lastwp->window);
+ }
+ if (markedwp != NULL) {
+ server_redraw_window_borders(markedwp->window);
+ server_status_window(markedwp->window);
+ }
+ return (CMD_RETURN_NORMAL);
+ }
+
if (args_has(self->args, 'P') || args_has(self->args, 'g')) {
if (args_has(args, 'P')) {
style = args_get(args, 'P');