Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: another double-width character fix



This came up when inserting a string of double-width characters then
going back and inserting an ordinary character in front.  The tortuous
logic intended to ensure we didn't stop in the middle of a double-width
character in the old line meant it went too far along the new line and
tried to output a null.

Index: Src/Zle/zle_refresh.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v
retrieving revision 1.41
diff -u -r1.41 zle_refresh.c
--- Src/Zle/zle_refresh.c	1 Nov 2005 23:10:22 -0000	1.41
+++ Src/Zle/zle_refresh.c	21 Nov 2005 14:40:38 -0000
@@ -1201,6 +1201,12 @@
     /* we can't do any fancy tricks, so just dump the single character
        and keep on trying */
 #ifdef MULTIBYTE_SUPPORT
+	/*
+	 * in case we were tidying up a funny-width character when we
+	 * reached the end of the new line...
+	 */
+	if (!*nl)
+	    break;
 	do {
 #endif
 	    zputc(*nl);

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com



Messages sorted by: Reverse Date, Date, Thread, Author