From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18360 invoked by alias); 25 Oct 2010 04:14:17 -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: 28364 Received: (qmail 12732 invoked from network); 25 Oct 2010 04:14:15 -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.214.171 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=qL7EHcJk2Q7mdnTkB9unRZ0Z5RimlN0KpxtuyCB7mKI=; b=sPrFBgCIKaG+WWxbuXqCWxzC/nY6rHtn3oyXoWTxnlnt9xxgXKO2IEOUYX8Mkjs9gm AQYxToy7f3ZUCC7QZkP0lLMxdJFyB84SH7dbq7DtCtEGQyRDfr7+JRqQDqqUJUMe2+AU 64aEkNnSS6lMvyN9+Qx1acF1BYS71mSzeBZFs= 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=qCedurtaBnwqAZ+OM/rxHg1IJozD0CLDhjwM1I+/i0RB87LEQ5TCE4VNSGw9OHVtlx bkYsSliM13hQQ4mLjee2kgECZkFjIlSiwYa+ZdUh7Lzk3BlaEft/bWnY0GPBkjlVI1he qMJ2uAsh/sXVHU3hV5BYpQXIMcZi6Tjy7KTE8= MIME-Version: 1.0 In-Reply-To: <20101024191229.0bc47b23@pws-pc.ntlworld.com> References: <20101024191229.0bc47b23@pws-pc.ntlworld.com> Date: Mon, 25 Oct 2010 06:14:11 +0200 Message-ID: Subject: Re: Fun redraw issue with double-width characters From: Mikael Magnusson To: zsh workers Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 24 October 2010 20:12, Peter Stephenson wr= ote: > On Sun, 24 Oct 2010 14:11:08 +0200 > Mikael Magnusson wrote: >> I got a random thought, "what if i enter five doublewidth characters, >> then go back to the start and enter a bunch of spaces". Turns out >> doing that causes the line to clear and cursor to move up one line. >> Doesn't happen with four or less. > > I think that may depend on what you're inserting: if you're inserting > stuff such that the character you're inserting changes the line near > the start, it may happen early. But this may be a wild goose chase. > >> Long story short, it happens only if >> ich1 is defined in the terminfo for the current $TERM, which it >> happens to be for rxvt-unicode, but also for rxvt. It doesn't matter >> if you're using xterm or rxvt or urxvt, just set TERM=3Drxvt, enter five >> =E3=81=BE and go back to the start and hold down space. I don't really k= now >> where to begin debugging this. > > Actually, there's only one use of insert in the entire source, which is > in a quite short chunk in zle_refresh.c, so localising it was the easy > bit. Well, easy if you know ich1 means TCINS :). > After staring enough I think I've worked out what's going on, but you > might want to stare at it, too. Much of this is reformatting for > clarity, the important bit is near the end where I've moved an extra > chunk inside an #ifdef MULTIBYTE_SUPPORT with a new comment. I stared at it for a while, but nothing of interest happened. I did test it though, and it works. I am asking this only out of curiosity, how come updates on the first line are done like this write(10, " \343\201\276\343\201\276\343\201\276\343\201\276\343\201\276\33= [10D", 21) =3D 21 while updates on the second line (ie after wrapping everything) are done shorter, like this write(10, "\33[@ \33[10C \33[11D", 15) =3D 15 ? (when inserting spaces in front of our five friends) Also noticed this didn't seem to be documented. I usually have special set to bold, but when looking at strace output in the first mail i did unset zle_highlight and noticed this. (what i should have done was zle_highlight=3D(none) ). diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index 92b5f20..b9abaac 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -2350,6 +2350,11 @@ Not all systems support this: for it to work, the system's representation of wide characters must be code values from the Universal Character Set, as defined by IS0 10646 (also known as Unicode). ) +item(Wrapped double-width characters)( +When a double-width character appears in the final column of a line, it +is instead shown on the next line. The empty space left in the original +position is highlighted as a special character. +) enditem() If tt(zle_highlight) is not set or no value applies to a particular --=20 Mikael Magnusson