1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-18 12:01:00 +01:00

35807: edit-command-line: Fix for non-7bit-data (after 35769)

Bug reported and fix suggested by Mikael.
This commit is contained in:
Daniel Shahaf 2015-07-16 12:07:48 +00:00
parent bfc5c04e42
commit a8e18dc370
2 changed files with 9 additions and 1 deletions

View file

@ -9,9 +9,12 @@
() {
exec </dev/tty
# 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}}}
integer byteoffset=$(( $#PREBUFFER + $#LBUFFER + 1 ))
case $editor in
(*vim*) ${=editor} -c "normal! ${byteoffset}go" -- $1;;
(*emacs*) ${=editor} $1 -eval "(goto-char ${byteoffset})";;