When command_arguments contains a path, there are too many delimiters
for sed, which causes it to not replace properly.
The result of this is that the original command gets executed without
remapping and/or expanding the arguments.
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).
A user may decide to use custom session file. Eg vim -S Session1.vim
With the previous approach we were preventing that as we only checked
for the existence of the default Session.vim file.