Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] edit-command-line: Fix for non-7bit-data (after 35769)
- X-seq: zsh-workers 35807
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] edit-command-line: Fix for non-7bit-data (after 35769)
- Date: Thu, 16 Jul 2015 23:17:45 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=noP vXjxIAKABSARjyqlBSUytgEA=; b=zJPEJ04Xv38MS0OQCm6pTvsLq3DZZPvDFsN cVJLI6ULvRfTkMlJvWy/F993iousRyM+h647qypis8zaVlpAyUO8L60n5D8uRfx+ MRiHNfrTH0bEFjoXhk+JURGyYe/zKdJQy3+bBKKrdqcsBmMIYZH+4zND8Wq8/2ID 1N5AGd7s=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=no PvXjxIAKABSARjyqlBSUytgEA=; b=MoFcui/BFUIosymDb8bKpqPekh9WNODWen BCCNEfxcUHikbet8znL+8SBODo0UDB8Qu/eAb/yh+VjVf5qt3Szfe/UHwHN2dlN5 DOnl1SuRYj8kF2mRFhGB0GfCoUB0WxgXSvJkrrlmeXclVBiR4vPmDe4W7jXmbpDn bQ4CGgGQw=
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Bug reported and fix suggested by Mikael.
---
Functions/Zle/edit-command-line | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Functions/Zle/edit-command-line b/Functions/Zle/edit-command-line
index 2ad4825..2c7f34b 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})";;
--
1.9.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author