From 5a1b0ac2cbc064626a5215037a189f8334761627 Mon Sep 17 00:00:00 2001 From: Jeroen de Haas Date: Sat, 16 Jul 2022 15:51:55 +0200 Subject: [PATCH 1/2] Also escape path and tmpdir in iterm.kak This fixes an issue with where paths containing spaces would break iterm support --- rc/windowing/iterm.kak | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/rc/windowing/iterm.kak b/rc/windowing/iterm.kak index d99a975c..acc0cae7 100644 --- a/rc/windowing/iterm.kak +++ b/rc/windowing/iterm.kak @@ -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" \