about summary refs log tree commit diff
path: root/Functions/Zle/edit-command-line
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2015-07-16 12:07:48 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2015-07-24 14:11:27 +0000
commita8e18dc370eefac3919b8c1a92dbbb2c3e2cf08d (patch)
tree166408877ac7a75df0d0e13f2c529b0d96f3b5fc /Functions/Zle/edit-command-line
parentbfc5c04e42f411cd9405de7c4a82c196eda63dfe (diff)
downloadzsh-a8e18dc370eefac3919b8c1a92dbbb2c3e2cf08d.tar.gz
zsh-a8e18dc370eefac3919b8c1a92dbbb2c3e2cf08d.tar.xz
zsh-a8e18dc370eefac3919b8c1a92dbbb2c3e2cf08d.zip
35807: edit-command-line: Fix for non-7bit-data (after 35769)
Bug reported and fix suggested by Mikael.
Diffstat (limited to 'Functions/Zle/edit-command-line')
-rw-r--r--Functions/Zle/edit-command-line5
1 files changed, 4 insertions, 1 deletions
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index 2ad4825b7..2c7f34b8b 100644
--- a/Functions/Zle/edit-command-line
+++ b/Functions/Zle/edit-command-line
@@ -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})";;