1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-21 09:59:08 +03:00

Also escape path and tmpdir in iterm.kak

This fixes an issue with where paths containing spaces would
break iterm support
This commit is contained in:
Jeroen de Haas 2022-07-16 15:51:55 +02:00
parent c7fbf1f390
commit 5a1b0ac2cb

View File

@ -22,11 +22,18 @@ define-command -hidden -params 2.. iterm-terminal-split-impl %{
fi
done
)
# go through another round of escaping for osascript
# \ -> \\
# " -> \"
escaped=$(printf %s "$args" | sed -e 's|\\|\\\\|g; s|"|\\"|g')
cmd="env PATH='${PATH}' TMPDIR='${TMPDIR}' $escaped"
do_esc() {
printf %s "$*" | sed -e 's|\\|\\\\|g; s|"|\\"|g'
}
escaped=$(do_esc "$args")
esc_path=$(do_esc "$PATH")
esc_tmp=$(do_esc "$TMPDIR")
cmd="env PATH='${esc_path}' TMPDIR='${esc_tmp}' $escaped"
osascript \
-e "tell application \"iTerm\"" \
-e " tell current session of current window" \