mirror of
https://github.com/zsh-users/zsh
synced 2024-09-29 04:35:22 +00:00
41899: handle multi-word values of $VISUAL et al., and line counting of buffer for emacs startup
This commit is contained in:
parent
1fb6939b94
commit
96845524a6
|
@ -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:)...}
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue