Add flags to selectp to enable and disable input to a pane, from Anish

Athalye.
This commit is contained in:
nicm 2014-08-11 22:14:30 +00:00
parent 1ac96200a7
commit f518a077b1
4 changed files with 42 additions and 17 deletions

View File

@ -29,8 +29,8 @@ enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_select_pane_entry = { const struct cmd_entry cmd_select_pane_entry = {
"select-pane", "selectp", "select-pane", "selectp",
"lDLRt:U", 0, 0, "DdeLlRt:U", 0, 0,
"[-lDLRU] " CMD_TARGET_PANE_USAGE, "[-DdeLlRU] " CMD_TARGET_PANE_USAGE,
0, 0,
cmd_select_pane_key_binding, cmd_select_pane_key_binding,
cmd_select_pane_exec cmd_select_pane_exec
@ -38,8 +38,8 @@ const struct cmd_entry cmd_select_pane_entry = {
const struct cmd_entry cmd_last_pane_entry = { const struct cmd_entry cmd_last_pane_entry = {
"last-pane", "lastp", "last-pane", "lastp",
"t:", 0, 0, "det:", 0, 0,
CMD_TARGET_WINDOW_USAGE, "[-de] " CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
cmd_select_pane_exec cmd_select_pane_exec
@ -78,10 +78,16 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} }
server_unzoom_window(wl->window); if (args_has(self->args, 'e'))
window_set_active_pane(wl->window, wl->window->last); wl->window->last->flags &= ~PANE_INPUTOFF;
server_status_window(wl->window); else if (args_has(self->args, 'd'))
server_redraw_window_borders(wl->window); wl->window->last->flags |= PANE_INPUTOFF;
else {
server_unzoom_window(wl->window);
window_set_active_pane(wl->window, wl->window->last);
server_status_window(wl->window);
server_redraw_window_borders(wl->window);
}
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);
} }
@ -108,9 +114,15 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} }
window_set_active_pane(wl->window, wp); if (args_has(self->args, 'e'))
server_status_window(wl->window); wp->flags &= ~PANE_INPUTOFF;
server_redraw_window_borders(wl->window); else if (args_has(self->args, 'd'))
wp->flags |= PANE_INPUTOFF;
else {
window_set_active_pane(wl->window, wp);
server_status_window(wl->window);
server_redraw_window_borders(wl->window);
}
return (CMD_RETURN_NORMAL); return (CMD_RETURN_NORMAL);
} }

17
tmux.1
View File

@ -1292,7 +1292,7 @@ flag, see the
section. section.
This command works only if at least one client is attached. This command works only if at least one client is attached.
.It Ic display-panes Op Fl t Ar target-client .It Ic display-panes Op Fl t Ar target-client
.D1 (alias: Ic displayp) .D1 (alias: Ic displayp )
Display a visible indicator of each pane shown by Display a visible indicator of each pane shown by
.Ar target-client . .Ar target-client .
See the See the
@ -1382,9 +1382,16 @@ The
.Fl a .Fl a
option kills all but the window given with option kills all but the window given with
.Fl t . .Fl t .
.It Ic last-pane Op Fl t Ar target-window .It Xo Ic last-pane
.Op Fl de
.Op Fl t Ar target-window
.Xc
.D1 (alias: Ic lastp ) .D1 (alias: Ic lastp )
Select the last (previously selected) pane. Select the last (previously selected) pane.
.Fl e
enables or
.Fl d
disables input to the pane.
.It Ic last-window Op Fl t Ar target-session .It Ic last-window Op Fl t Ar target-session
.D1 (alias: Ic last ) .D1 (alias: Ic last )
Select the last (previously selected) window. Select the last (previously selected) window.
@ -1701,7 +1708,7 @@ and
.Ic previous-layout .Ic previous-layout
commands. commands.
.It Xo Ic select-pane .It Xo Ic select-pane
.Op Fl lDLRU .Op Fl DdeLlRU
.Op Fl t Ar target-pane .Op Fl t Ar target-pane
.Xc .Xc
.D1 (alias: Ic selectp ) .D1 (alias: Ic selectp )
@ -1721,6 +1728,10 @@ target pane is used.
is the same as using the is the same as using the
.Ic last-pane .Ic last-pane
command. command.
.Fl e
enables or
.Fl d
disables input to the pane.
.It Xo Ic select-window .It Xo Ic select-window
.Op Fl lnpT .Op Fl lnpT
.Op Fl t Ar target-window .Op Fl t Ar target-window

1
tmux.h
View File

@ -956,6 +956,7 @@ struct window_pane {
#define PANE_FOCUSED 0x4 #define PANE_FOCUSED 0x4
#define PANE_RESIZE 0x8 #define PANE_RESIZE 0x8
#define PANE_FOCUSPUSH 0x10 #define PANE_FOCUSPUSH 0x10
#define PANE_INPUTOFF 0x20
int argc; int argc;
char **argv; char **argv;

View File

@ -1057,8 +1057,9 @@ window_pane_key(struct window_pane *wp, struct session *sess, int key)
return; return;
} }
if (wp->fd == -1) if (wp->fd == -1 || wp->flags & PANE_INPUTOFF)
return; return;
input_key(wp, key); input_key(wp, key);
if (options_get_number(&wp->window->options, "synchronize-panes")) { if (options_get_number(&wp->window->options, "synchronize-panes")) {
TAILQ_FOREACH(wp2, &wp->window->panes, entry) { TAILQ_FOREACH(wp2, &wp->window->panes, entry) {
@ -1071,8 +1072,8 @@ window_pane_key(struct window_pane *wp, struct session *sess, int key)
} }
void void
window_pane_mouse( window_pane_mouse(struct window_pane *wp, struct session *sess,
struct window_pane *wp, struct session *sess, struct mouse_event *m) struct mouse_event *m)
{ {
if (!window_pane_visible(wp)) if (!window_pane_visible(wp))
return; return;