diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2015-11-25 18:51:00 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2015-11-25 18:51:00 +0100 |
commit | 317ec32cb1cbd15b31e17bcb07f09c52cd37c44a (patch) | |
tree | 88a02c853dfafd82a2d551d862d8dfb056b1bee6 /Functions/Zle/edit-command-line | |
parent | 1637291aaea12ddcfd549d50d49c480185995c1a (diff) | |
parent | cce4261a3c6f4bf78b483db61623c80e3c98d10b (diff) | |
download | zsh-317ec32cb1cbd15b31e17bcb07f09c52cd37c44a.tar.gz zsh-317ec32cb1cbd15b31e17bcb07f09c52cd37c44a.zip |
Merge tag 'zsh-5.1.1-test-1' into debian
Diffstat (limited to 'Functions/Zle/edit-command-line')
-rw-r--r-- | Functions/Zle/edit-command-line | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line index 2c7f34b8b..103a1c1a5 100644 --- a/Functions/Zle/edit-command-line +++ b/Functions/Zle/edit-command-line @@ -11,13 +11,16 @@ # Compute the cursor's position in bytes, not characters. setopt localoptions nomultibyte - integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 )) # Open the editor, placing the cursor at the right place if we know how. local editor=${${VISUAL:-${EDITOR:-vi}}} case $editor in - (*vim*) ${=editor} -c "normal! ${byteoffset}go" -- $1;; - (*emacs*) ${=editor} $1 -eval "(goto-char ${byteoffset})";; + (*vim*) + integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 )) + ${=editor} -c "normal! ${byteoffset}go" -- $1;; + (*emacs*) + local lines=( ${(f):-"$PREBUFFER$LBUFFER"} ) + ${=editor} +${#lines}:$((${#lines[-1]} + 1)) $1;; (*) ${=editor} $1;; esac |