_get_command_arguments: make trailing space optional

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.
This commit is contained in:
kt programs 2023-01-30 10:33:50 +08:00
parent a2ddfb96b9
commit 4941cdb074

View File

@ -121,7 +121,7 @@ _get_command_arguments() {
if _proc_starts_with_tildae "$match"; then if _proc_starts_with_tildae "$match"; then
match="$(remove_first_char "$match")" match="$(remove_first_char "$match")"
fi fi
echo "$pane_full_command" | sed "s,^.*${match}[^ ]* ,," echo "$pane_full_command" | sed "s,^.*${match}[^ ]* *,,"
} }
_get_proc_restore_command() { _get_proc_restore_command() {