From 6d10ee01b603d4e3a6f6205038e4be36c200b0ba Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 24 Jan 2018 14:24:34 +0100 Subject: [PATCH 1/3] Fix https://github.com/tmux-plugins/tmux-resurrect/issues/176. This removes (un)zooming on save which should not be necessary anymore with recent tmux versions (from 2.2 on?). --- scripts/save.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scripts/save.sh b/scripts/save.sh index 7ce2b99..b52ef48 100755 --- a/scripts/save.sh +++ b/scripts/save.sh @@ -246,14 +246,8 @@ dump_windows() { fi # window_layout is not correct for zoomed windows if [[ "$window_flags" == *Z* ]]; then - # unmaximize the window - toggle_window_zoom "${session_name}:${window_index}" # get correct window layout window_layout="$(tmux display-message -p -t "${session_name}:${window_index}" -F "#{window_layout}")" - # sleep required otherwise vim does not redraw correctly, issue #112 - sleep 0.1 || sleep 1 # portability hack - # maximize window again - toggle_window_zoom "${session_name}:${window_index}" fi echo "${line_type}${d}${session_name}${d}${window_index}${d}${window_active}${d}${window_flags}${d}${window_layout}" done From fee390d1b515a5a05bcb733e2d7a777d15e5edf7 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 24 Jan 2018 22:32:35 +0100 Subject: [PATCH 2/3] Update tests to save and restore a setup with a zoomed pane. --- tests/fixtures/restore_file.txt | 8 ++++---- tests/fixtures/save_file.txt | 8 ++++---- tests/helpers/create_and_save_tmux_test_environment.exp | 1 + tests/helpers/expect_helpers.exp | 5 +++++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/fixtures/restore_file.txt b/tests/fixtures/restore_file.txt index 2cf7f2a..dcf5779 100644 --- a/tests/fixtures/restore_file.txt +++ b/tests/fixtures/restore_file.txt @@ -4,9 +4,9 @@ pane blue 1 :man 0 :- 0 :/tmp 0 bash : pane blue 1 :man 0 :- 1 :/usr/share/man 1 man :man echo pane blue 2 :bash 1 :* 0 :/tmp 1 bash : pane red 0 :bash 0 : 0 :/tmp 1 bash : -pane red 1 :bash 0 :- 0 :/tmp 0 bash : -pane red 1 :bash 0 :- 1 :/tmp 0 bash : -pane red 1 :bash 0 :- 2 :/tmp 1 bash : +pane red 1 :bash 0 :-Z 0 :/tmp 0 bash : +pane red 1 :bash 0 :-Z 1 :/tmp 0 bash : +pane red 1 :bash 0 :-Z 2 :/tmp 1 bash : pane red 2 :bash 1 :* 0 :/tmp 0 bash : pane red 2 :bash 1 :* 1 :/tmp 1 bash : pane yellow 0 :bash 1 :* 0 :/tmp/bar 1 bash : @@ -15,7 +15,7 @@ window blue 0 0 : ce9f,200x49,0,0,2 window blue 1 0 :- 178b,200x49,0,0{100x49,0,0,3,99x49,101,0,4} window blue 2 1 :* cea2,200x49,0,0,5 window red 0 0 : cea3,200x49,0,0,6 -window red 1 0 :- 135b,200x49,0,0[200x24,0,0,7,200x24,0,25{100x24,0,25,8,99x24,101,25,9}] +window red 1 0 :-Z 135b,200x49,0,0[200x24,0,0,7,200x24,0,25{100x24,0,25,8,99x24,101,25,9}] window red 2 1 :* db81,200x49,0,0[200x24,0,0,10,200x24,0,25,11] window yellow 0 1 :* 6781,200x49,0,0,12 state yellow blue diff --git a/tests/fixtures/save_file.txt b/tests/fixtures/save_file.txt index f0b28af..0301f92 100644 --- a/tests/fixtures/save_file.txt +++ b/tests/fixtures/save_file.txt @@ -4,9 +4,9 @@ pane blue 1 :man 0 :!- 0 :/tmp 0 bash : pane blue 1 :man 0 :!- 1 :/usr/share/man 1 man :man echo pane blue 2 :bash 1 :* 0 :/tmp 1 bash : pane red 0 :bash 0 : 0 :/tmp 1 bash : -pane red 1 :bash 0 :- 0 :/tmp 0 bash : -pane red 1 :bash 0 :- 1 :/tmp 0 bash : -pane red 1 :bash 0 :- 2 :/tmp 1 bash : +pane red 1 :bash 0 :-Z 0 :/tmp 0 bash : +pane red 1 :bash 0 :-Z 1 :/tmp 0 bash : +pane red 1 :bash 0 :-Z 2 :/tmp 1 bash : pane red 2 :bash 1 :* 0 :/tmp 0 bash : pane red 2 :bash 1 :* 1 :/tmp 1 bash : pane yellow 0 :bash 1 :* 0 :/tmp/bar 1 bash : @@ -15,7 +15,7 @@ window blue 0 0 :! cea4,200x49,0,0,7 window blue 1 0 :!- 9797,200x49,0,0{100x49,0,0,8,99x49,101,0,9} window blue 2 1 :* 677f,200x49,0,0,10 window red 0 0 : ce9e,200x49,0,0,1 -window red 1 0 :- 52b7,200x49,0,0[200x24,0,0,2,200x24,0,25{100x24,0,25,3,99x24,101,25,4}] +window red 1 0 :-Z 52b7,200x49,0,0[200x24,0,0,2,200x24,0,25{100x24,0,25,3,99x24,101,25,4}] window red 2 1 :* bd68,200x49,0,0[200x24,0,0,5,200x24,0,25,6] window yellow 0 1 :* 6780,200x49,0,0,11 state yellow blue diff --git a/tests/helpers/create_and_save_tmux_test_environment.exp b/tests/helpers/create_and_save_tmux_test_environment.exp index feef033..80cca2c 100755 --- a/tests/helpers/create_and_save_tmux_test_environment.exp +++ b/tests/helpers/create_and_save_tmux_test_environment.exp @@ -16,6 +16,7 @@ new_tmux_session "red" new_tmux_window horizontal_split vertical_split +toggle_zoom_pane new_tmux_window horizontal_split diff --git a/tests/helpers/expect_helpers.exp b/tests/helpers/expect_helpers.exp index 6980428..cbf4234 100644 --- a/tests/helpers/expect_helpers.exp +++ b/tests/helpers/expect_helpers.exp @@ -44,6 +44,11 @@ proc vertical_split {} { sleep 0.1 } +proc toggle_zoom_pane {} { + send "z" + sleep 0.2 +} + proc run_shell_command {command} { send "$command\r" sleep 1 From 2f5394bfed12bad49672588c12c24c9fb0c36e8f Mon Sep 17 00:00:00 2001 From: Wouter R Date: Sat, 27 Jan 2018 19:08:28 +0100 Subject: [PATCH 3/3] Remove superfluous if-block. --- scripts/save.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/scripts/save.sh b/scripts/save.sh index b52ef48..f7508e8 100755 --- a/scripts/save.sh +++ b/scripts/save.sh @@ -244,11 +244,6 @@ dump_windows() { if is_session_grouped "$session_name"; then continue fi - # window_layout is not correct for zoomed windows - if [[ "$window_flags" == *Z* ]]; then - # get correct window layout - window_layout="$(tmux display-message -p -t "${session_name}:${window_index}" -F "#{window_layout}")" - fi echo "${line_type}${d}${session_name}${d}${window_index}${d}${window_active}${d}${window_flags}${d}${window_layout}" done }