From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Pasting UTF-8 characters with bracketed-paste-magic seems broken in 5.1
Date: Thu, 10 Sep 2015 12:20:55 -0700 [thread overview]
Message-ID: <150910122055.ZM3818@torch.brasslantern.com> (raw)
In-Reply-To: <20150910172840.0a1899f4@pwslap01u.europe.root.pri>
On Sep 10, 5:28pm, Peter Stephenson wrote:
} Subject: Re: Pasting UTF-8 characters with bracketed-paste-magic seems bro
}
} On Thu, 10 Sep 2015 09:16:49 -0700
} Bart Schaefer <schaefer@brasslantern.com> wrote:
}
} > Should be possible to handle that in the loop in bracketed-paste-magic
} > with a test of $KEYS and a call to read -k. Might try to get to this
} > later, out of time now ... or someone else can jump in.
}
} Not really clear to me what level the "right" fix is, since this was all
} designed for a pre-multibyte world... I don't think we have a test for a
} valid/invalid multibyte character at the shell level currently, do we?
We can probably get by with some variant of this:
read-multibyte() {
local K=$KEYS[-1]
if (( ##K & 0x80 )); then
if (( ##K & 0xe0 == 0xc0 )); then
read -k 1 K
elif (( ##K & 0xf0 == 0xe0 )); then
read -k 2 K
elif (( ##K & 0xf8 == 0xf0 )); then
read -k 3 K
fi
KEYS+="$K"
fi
}
while zle .read-command; do
read-multibyte
# etc.
done
Except "read -k" is supposed to read a full multibyte character, so I
don't know if it behaves consistently when invoked in the middle of one.
--
Barton E. Schaefer
next prev parent reply other threads:[~2015-09-10 19:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-06 15:57 Axel Beckert
2015-09-10 11:17 ` Axel Beckert
2015-09-10 15:26 ` Yuri D'Elia
2015-09-10 14:39 ` Bart Schaefer
2015-09-10 14:57 ` Axel Beckert
2015-09-10 15:45 ` Bart Schaefer
2015-09-10 16:07 ` Peter Stephenson
2015-09-10 16:16 ` Bart Schaefer
2015-09-10 16:28 ` Peter Stephenson
2015-09-10 18:57 ` Peter Stephenson
2015-09-10 19:35 ` Peter Stephenson
2015-09-10 23:24 ` Bart Schaefer
2015-09-11 8:10 ` Peter Stephenson
2015-09-11 9:42 ` Axel Beckert
2015-09-11 15:33 ` Bart Schaefer
2015-09-11 17:41 ` Peter Stephenson
2015-09-11 19:22 ` Bart Schaefer
2015-09-11 19:49 ` Axel Beckert
2015-09-11 20:04 ` Axel Beckert
2015-09-11 21:53 ` Daniel Shahaf
2015-09-10 19:20 ` Bart Schaefer [this message]
2015-09-10 19:29 ` Bart Schaefer
2015-09-10 19:53 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=150910122055.ZM3818@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).