Hello
I just began to use the recently added zoom feature and came across an
anoying thing.
You have panes A and B. A is zoomed, if you switch to pane B, then A is
forcibly unzoomed. This is expected, of course, otherwise B would remain
invisible.
If you switch back to pane A I expect to get A zoomed again because it
wasn't me who unzoomed it.
First I started to play with these binding (hjkl and HJKL):
bind h select-pane -L
bind j select-pane -D
...
bind H select-pane -L \; resize-pane -Z
bind J select-pane -D \; resize-pane -Z
...
and yes, they worked but I had to mentally keep track of the previous
pane state and use the corresponding key combination when returning to
pane A.
Find attached a patch implementing zoom restoration. The feature is
controlled by window setting restore-zoom, which is 0 by default so the
current behaviour is not altered.
I first submitted a PR to github[1] but I'm not sure if PRs are being
looked at.
Would appreciate some feedback on this, specially if you consider that
restoring zoom should (not) be the expected behaviour.
Needless to say how cool tmux is.
Kind regards,
maykel
[1] https://github.com/ThomasAdam/tmux/pull/5/files
commit 81bd6465a52e818343d776212cae780e73762f5b
Author: Maykel Moya <mm...@mmoya.org>
Date: Sat Nov 16 02:54:28 2013 +0100
Add option for restoring window zoom
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
index d31f886..d8ee076 100644
--- a/cmd-resize-pane.c
+++ b/cmd-resize-pane.c
@@ -101,10 +101,13 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq)
w = wl->window;
if (args_has(args, 'Z')) {
- if (w->flags & WINDOW_ZOOMED)
+ if (w->flags & WINDOW_ZOOMED) {
window_unzoom(w);
- else
+ wp->flags &= ~PANE_ZOOMED;
+ } else {
window_zoom(wp);
+ wp->flags |= PANE_ZOOMED;
+ }
server_redraw_window(w);
server_status_window(w);
return (CMD_RETURN_NORMAL);
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index c342fef..e23a8da 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -67,6 +67,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 window *w;
+ int restore_zoom;
if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
wl = cmd_find_window(cmdq, args_get(args, 't'), NULL);
@@ -108,9 +110,18 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR);
}
- window_set_active_pane(wl->window, wp);
- server_status_window(wl->window);
- server_redraw_window_borders(wl->window);
+ w = wl->window;
+ restore_zoom = options_get_number(&w->options, "restore-zoom");
+
+ window_set_active_pane(w, wp);
+ if (restore_zoom && wp->flags & PANE_ZOOMED) {
+ window_zoom(wp);
+ server_redraw_window(w);
+ server_status_window(w);
+ } else {
+ server_status_window(w);
+ server_redraw_window_borders(w);
+ }
return (CMD_RETURN_NORMAL);
}
diff --git a/options-table.c b/options-table.c
index 5da095b..a16e6c1 100644
--- a/options-table.c
+++ b/options-table.c
@@ -604,6 +604,11 @@ const struct options_table_entry window_options_table[] = {
.default_num = 0
},
+ { .name = "restore-zoom",
+ .type = OPTIONS_TABLE_FLAG,
+ .default_num = 0
+ },
+
{ .name = "synchronize-panes",
.type = OPTIONS_TABLE_FLAG,
.default_num = 0
diff --git a/tmux.1 b/tmux.1
index 1146faf..e9e4f04 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2861,6 +2861,12 @@ The window may be reactivated with the
.Ic respawn-window
command.
.Pp
+.It Xo Ic restore-zoom
+.Op Ic on | off
+.Xc
+A window with this flag set will autozoom after selecting a previously zoomed
+pane.
+.Pp
.It Xo Ic synchronize-panes
.Op Ic on | off
.Xc
diff --git a/tmux.h b/tmux.h
index dbc2c49..425e000 100644
--- a/tmux.h
+++ b/tmux.h
@@ -904,6 +904,7 @@ struct window_pane {
#define PANE_FOCUSED 0x4
#define PANE_RESIZE 0x8
#define PANE_FOCUSPUSH 0x10
+#define PANE_ZOOMED 0x20
char *cmd;
char *shell;
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users