Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] edit-command-line breaks arguments with spaces
- X-seq: zsh-workers 41880
- From: Marco Hinz <mh.codebro@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] edit-command-line breaks arguments with spaces
- Date: Sat, 14 Oct 2017 01:05:17 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=u0f5oAxjAQ6YUGZ9hHhr7APzrb9WpRCaOjog1ZGC0Wo=; b=rFit14dYQiV8316mcFiDZDBoC+KHeQO/siNk2xmVLx6UcTNedhzgHuQ1trhrxSINvk JH8SSgrnB2n2xkDWK3/dbZ5E0kWpLQhqPIW1a2KyXyXHVq9PoDw4KFzfKkTAjnMUsttT uXYdxRvZ3zNPBpUEtI8i0gf6P2aIm6g481JrKLmhpkmdYeAmR169/wbRXL1iOP1FwS9W 5aTohhq13CXPIXThhyAbFkOqemLuQ6DaemHHlQ54vRp0z12uGE725kUA/SArntQ9ezCs IMJ8vwfrWOvYKsUickneQS8iwPUNXig/o31+H0Mxt0WcoTZrB+Dq5wuAzDu269+i15Ys H7oA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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";;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author