zsh-workers
 help / color / mirror / code / Atom feed
* Minor text attribute display issue
@ 2009-01-13 15:49 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2009-01-13 15:49 UTC (permalink / raw)
  To: Zsh hackers list

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@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-13 15:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-13 15:49 Minor text attribute display issue Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).