zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] edit-command-line breaks arguments with spaces
@ 2017-10-13 23:05 Marco Hinz
  2017-10-14  0:07 ` Daniel Shahaf
  0 siblings, 1 reply; 11+ messages in thread
From: Marco Hinz @ 2017-10-13 23:05 UTC (permalink / raw)
  To: zsh-workers

In Functions/Zle/edit-command-line are these two lines:

  local editor=${${VISUAL:-${EDITOR:-vi}}}
  ${=editor} -c "normal! ${byteoffset}go" -- $1;;

In the second line $editor gets word-split. This is a problem in cases like:

  VISUAL='vim -c "set bufhidden=wipe"'

The word splitting splits the argument to -c in two pieces, "set, and bufhidden=wipe".

Here a small script that shows the difference and my suggestion of using eval:

  https://gist.github.com/mhinz/ec6f0363ac083ab80613148d39b28121

Marco

diff --git i/Functions/Zle/edit-command-line w/Functions/Zle/edit-command-line
index 353f2609a..5c82e823a 100644
--- i/Functions/Zle/edit-command-line
+++ w/Functions/Zle/edit-command-line
@@ -22 +22 @@
-      ${=editor} -c "normal! ${byteoffset}go" -- $1;;
+      eval "${editor[@]} -c 'normal! ${byteoffset}go' -- $1";;
@@ -25,2 +25,2 @@
-      ${=editor} +${#lines}:$((${#lines[-1]} + 1)) $1;;
-    (*) ${=editor} $1;;
+      eval "${editor[@]} +${#lines}:$((${#lines[-1]} + 1)) $1";;
+    (*) eval "${editor[@]} $1";;


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-10-15 14:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 23:05 [PATCH] edit-command-line breaks arguments with spaces Marco Hinz
2017-10-14  0:07 ` Daniel Shahaf
2017-10-14  0:45   ` Marco Hinz
2017-10-14  0:55   ` Bart Schaefer
2017-10-14  1:52     ` Daniel Shahaf
2017-10-14  4:21       ` Phil Pennock
2017-10-14 13:57         ` Daniel Shahaf
2017-10-14  1:56     ` Daniel Shahaf
2017-10-14 18:40     ` Marco Hinz
2017-10-15  1:35       ` Bart Schaefer
2017-10-15 14:15         ` Marco Hinz

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).