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

Minor text attribute display issue



With recent versions of rxvt, I've noticed that if I have text
attributes set for the area of text I'm editing, and delete some of that
text, causing spaces to be produced at the end of the line by the
deletion (even if there were some spaces there before), then the final
space gets the attribute of the current text.  This appears to turn that
off cleanly.

Index: Src/Zle/zle_refresh.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v
retrieving revision 1.73
diff -u -r1.73 zle_refresh.c
--- Src/Zle/zle_refresh.c	18 Nov 2008 10:14:35 -0000	1.73
+++ Src/Zle/zle_refresh.c	13 Jan 2009 15:47:19 -0000
@@ -1973,8 +1973,18 @@
 		   eg. oldline: hifoobar \ hopefully cheaper here to delete two
 		   newline: foobar	 / characters, then we have six matches */
 		if (tccan(TCDEL)) {
+		    int first = 1;
 		    for (i = 1; ol[i].chr; i++)
 			if (tcdelcost(i) < wpfxlen(ol + i, nl)) {
+			    /*
+			     * Some terminals will output the current
+			     * attributes into cells added at the end by
+			     * deletions, so turn off text attributes.
+			     */
+			    if (first) {
+				clearattributes();
+				first = 0;
+			    }
 			    tc_delchars(i);
 			    ol += i;
 			    char_ins -= i;
@@ -1984,15 +1994,6 @@
 				char_ins--;
 			    }
 #endif
-			    /*
-			     * If the sequence we're deleting ended
-			     * by turning off an attribute, make sure
-			     * it stays turned off.  I don't think we
-			     * should need this.
-			     */
-			    if (ol[-1].atr & TXT_ATTR_OFF_MASK)
-				settextattributes(ol[-1].atr &
-						  TXT_ATTR_OFF_MASK);
 			    i = 0;
 			    break;
 			}


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



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