From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] edit-command-line breaks arguments with spaces
Date: Fri, 13 Oct 2017 17:55:55 -0700 [thread overview]
Message-ID: <171013175555.ZM12982@torch.brasslantern.com> (raw)
In-Reply-To: <1507939677.3717869.1138301848.03470D9F@webmail.messagingengine.com>
On Oct 14, 12:07am, Daniel Shahaf wrote:
} Subject: Re: [PATCH] edit-command-line breaks arguments with spaces
}
} Marco Hinz wrote on Sat, 14 Oct 2017 01:05 +0200:
} > + eval "${editor[@]} +${#lines}:$((${#lines[-1]} + 1)) $1";;
} > + (*) eval "${editor[@]} $1";;
}
} LGTM, except that $1 should be changed into ${(q)1} due to the eval.
Wouldn't this work and be preferable to eval?
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index 353f260..f77eb35 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;;
+ ${editor} +${#lines}:$((${#lines[-1]} + 1)) $1;;
+ (*) ${editor} $1;;
esac
(( $+zle_bracketed_paste )) && print -r -n - $zle_bracketed_paste[1]
--
Barton E. Schaefer
next prev parent reply other threads:[~2017-10-14 0:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 23:05 Marco Hinz
2017-10-14 0:07 ` Daniel Shahaf
2017-10-14 0:45 ` Marco Hinz
2017-10-14 0:55 ` Bart Schaefer [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=171013175555.ZM12982@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).