Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: command line not refresh properly with wide chars when cursor would have been inside one
- X-seq: zsh-workers 28356
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: command line not refresh properly with wide chars when cursor would have been inside one
- Date: Sat, 16 Oct 2010 14:42:44 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=X2NaOj7hKyx80Q64ILVYnlD6QGTZuTXNh6LL2Qkw0NA=; b=o1b5OsuYd6B4Kka2ElRQ0pDaHeu5hY32moZjwmGec1m/YjksGy7Gut6J+oecKrwy3s i4Gizy9FqBjwsIFLWIrP1lUdLUMsN2JLaaQbm8CVo4kWkWmynDaxDJAl1Ubzq4W7VbjT XpTRjv4e2qul6DUN/SxQiBwO7IKsfBt2KhXY8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=JxOKecBraIS8RZnca4nVLmW70U86LU7YdCz2Q7B3hLtTVdjh141GNUyJMcaMn3XXHH T6+dLe0JNw3Kde25LM4kDlEi4PVlgeZ5xY5VAz5MTFmcCW0JQE8H0/2hclUgoWP6Rjpa 9EsBfsz1yddo8/gU0sYd+Zfx29lOpA8ZaBs6U=
- In-reply-to: <AANLkTi=NENPEeVmxgqQqT=R_Lfb9grY6VtQGYtnmagO9@xxxxxxxxxxxxxx>
- 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
- References: <AANLkTimh+E7u1n1+t4bR1On5wO-xGcJS9ssdp+ERmGZw@xxxxxxxxxxxxxx> <AANLkTi=NENPEeVmxgqQqT=R_Lfb9grY6VtQGYtnmagO9@xxxxxxxxxxxxxx>
On 16 October 2010 14:36, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On 16 October 2010 13:21, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> zsh -f
>> % echo ããã
>> % uuuuuu<up>
>> % echo ã [cursor here]
>>
>> if you type one more (or less, or three or five more) letters, the
>> line refreshes properly, but when it would have ended up in the middle
>> of a wide char, the line gets cut off. This has bothered me for quite
>> some time but I've never been able to figure out the exact
>> circumstances before. Verified in latest cvs and 4.3.6 with -f.
>
> Actually the problem is when the previous line ends in a wide char in
> the new line, doesn't matter where the cursor is.
>
> Hmm, it seems the problem is somewhere in refreshline (surprise,
> right?). First all the characters of "echo ã" are printed one by one,
> but then ol is advanced past the end of the old string "uuuuuu" and
> somehow after that are ããã which causes
>
> /* skip past all matching characters */
> for (; nl->chr && ZR_equal(*ol, *nl); nl++, ol++, ccs++)
> ;
>
> to trigger, which is why the rest of the string isn't output. Why this
> happens is a bit of a mystery to me still.
This seems to fix the problem of skipping past the end of ol, but I'm
not sure if this is the exact spot that has a bug. I can't reproduce
my problem with this patch.
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index d36febb..e3307ef 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -2107,7 +2107,9 @@ refreshline(int ln)
* We check for WEOF inside.
*/
zputc(nl);
- nl++, ol++;
+ nl++;
+ if (ol->chr)
+ ol++;
ccs++, vcs++;
#ifdef MULTIBYTE_SUPPORT
/*
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author