First, increment the relevant indices in the awk statements regarding
windows, as now the window_name entry exists.
Second, remove the window_name entry from the dump_pane_contents and
dump_shell_history functions as it no longer exists in the format.
First, make sure to include the ":" placeholder in the window_name
format.
Second, decrement the indices in relevant awk commands to make sure they
point to the right items.
Previously, window names were set when creating panes and were therefore
saved with pane data. However, saving the names with window data is more
intuitive and easier to manage. In addition, one can set the name and
automatic-rename options in the same function, so one can make sure that
renaming the windows will not overwrite the automatic-rename option.
When the session is restored, the windows are renamed to their original
names switching off automatic-rename, which can be undesirable.
Therefore the value of automatic-rename is now saved for each window and
restored after the renaming.
If the value is set, that value is saved and then applied. Otherwise, a
placeholder of ':' is placed instead, in which case the local option is
unset for that window (as it originally was).
When saving zoomed windows:
- window is un-zoomed
- window layout snapshot is taken
- window is zoomed back
This is done because otherwise tmux does not provide correct window
layout. With this we're working around a tmux bug really.
The above causes an issue with vim. For some reason vim cannot properly
reload it's content when "un-zoom + zoom" is done quickly. Everything
works ok if a little sleep/wait is added, so we're doing just that.
0.1 second sleep seems to be enough.
About `sleep 0.1 || sleep 1`: this is a hack. We want to wait for 0.1
seconds, which seems to be enough to fix the issue. However, according
to POSIX, `sleep` command takes only integers.
BUT, decimal values seem to work everywhere. So, we're using a decimal
value, and if that fails, we behave POSIX friendly.
Related to issue #112.
Add the -J options to `capture-pane` to handle wrapped lines correctly.
This way wrapped lines will be joined upon capture and once restored,
will re-wrap upon pane size changes.
Grouped sessions are session started with the command
`tmux new-session -t <existing-session-name>`
Those sessions share the panes and windows with the existing, original
session.
We're making sure to identify and save grouped sessions.
On the other hand, we don't want to save panes and windows twice