When pane_full_command has no arguments, the regex doesn't find argv[0]
as there is no trailing space.
For example, if pane_full_command was "vim" and the restore option was
"~Vim->vim *", the command "vim vim" would get executed instead of just
"vim".
Make the trailing space optional to match having only the command
without arguments.
The issue apprently happens when using fish as the default shell. This commit
fixes this issue by postponing `restore/pane_contents` clean-up after calling
`restore_active_pane_for_each_window` (scripts/restore.sh:392). It might also
fix#192.
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).
"restoring shell history" feature is very invasive and dirty. I propose
removing it in the future without the replacement.
I worry it spoils the first experience of using this plugin for users
that accidentally turn it on and don't know how to turn it off, see
https://github.com/tmux-plugins/tmux-resurrect/issues/288
Also, it hurts me to reject PRs that improve the feature.
Thoughts?
If pane content is restored and no default-command is set, restore.sh
falls back to default-shell, which tmux sets automatically and calls as
a login shell.
In pane_creation_command() we need to make sure to call default-shell as a login shell.
As tmux does. But take care not to call default-command as a login shell.