about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2017-10-15 11:17:06 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2017-10-15 11:17:06 -0700
commit96845524a66aecfd4fa01f1b23f80bbf753f1130 (patch)
tree4797ec4507e8e845bd16579eb5bbdccc20c6b1e3
parent1fb6939b94750746de349b6b61115d27fda500f3 (diff)
downloadzsh-96845524a66aecfd4fa01f1b23f80bbf753f1130.tar.gz
zsh-96845524a66aecfd4fa01f1b23f80bbf753f1130.tar.xz
zsh-96845524a66aecfd4fa01f1b23f80bbf753f1130.zip
41899: handle multi-word values of $VISUAL et al., and line counting of buffer for emacs startup
-rw-r--r--ChangeLog5
-rw-r--r--Functions/Zle/edit-command-line10
2 files changed, 10 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 497092813..afb3ce8da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-15  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 41898: Functions/Zle/edit-command-line: handle multi-word values
+	of $VISUAL et al., and line counting of buffer for emacs startup
+
 2017-10-13  Barton E. Schaefer  <schaefer@zsh.org>
 
 	* 41873: Src/lex.c: temporarily disable effects of ${(Z:n:)...}
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index 353f2609a..e17893e93 100644
--- a/Functions/Zle/edit-command-line
+++ b/Functions/Zle/edit-command-line
@@ -15,15 +15,15 @@
   (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[2]
 
   # Open the editor, placing the cursor at the right place if we know how.
-  local editor=${${VISUAL:-${EDITOR:-vi}}}
+  local editor=( "${(@Q)${(z)${VISUAL:-${EDITOR:-vi}}}}" )
   case $editor in 
     (*vim*)
       integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 ))
-      ${=editor} -c "normal! ${byteoffset}go" -- $1;;
+      "${(@)editor}" -c "normal! ${byteoffset}go" -- $1;;
     (*emacs*)
-      local lines=( ${(f):-"$PREBUFFER$LBUFFER"} )
-      ${=editor} +${#lines}:$((${#lines[-1]} + 1)) $1;;
-    (*) ${=editor} $1;;
+      local lines=( "${(@f):-"$PREBUFFER$LBUFFER"}" )
+      "${(@)editor}" +${#lines}:$((${#lines[-1]} + 1)) $1;;
+    (*) "${(@)editor}" $1;;
   esac
 
   (( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1]