From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12979 invoked by alias); 16 Oct 2010 12:42:49 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28356 Received: (qmail 29898 invoked from network); 16 Oct 2010 12:42:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.43 as permitted sender) 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= MIME-Version: 1.0 In-Reply-To: References: Date: Sat, 16 Oct 2010 14:42:44 +0200 Message-ID: Subject: Re: command line not refresh properly with wide chars when cursor would have been inside one From: Mikael Magnusson To: zsh workers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 16 October 2010 14:36, Mikael Magnusson wrote: > On 16 October 2010 13:21, Mikael Magnusson wrote: >> zsh -f >> % echo =E3=81=AE=E3=81=AE=E3=81=AE >> % uuuuuu >> % echo =E3=81=AE [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 =E3=81=AE" are printed one by = one, > but then ol is advanced past the end of the old string "uuuuuu" and > somehow after that are =E3=81=AE=E3=81=AE=E3=81=AE 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 /* --=20 Mikael Magnusson