summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-01-13 16:05:46 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-01-13 16:05:46 +0000
commit7e5d340abe68cb521b9bc351db791ea87b7dfc5d (patch)
tree19ff7c304cf55170783a48aac1ea3c6c7848f194
parent0cf040f4bf50c5530bd19da76ea234e2cd831667 (diff)
downloadzsh-7e5d340abe68cb521b9bc351db791ea87b7dfc5d.tar.gz
zsh-7e5d340abe68cb521b9bc351db791ea87b7dfc5d.tar.xz
zsh-7e5d340abe68cb521b9bc351db791ea87b7dfc5d.zip
26393: turn off text attributes in refresh when deleting text
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_refresh.c19
2 files changed, 14 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index b09759376..57853752c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-01-13  Peter Stephenson  <pws@csr.com>
 
+	* 26393: Src/Zle/zle_refresh.c: turn off text attributes when
+	deleting text, to avoid them being used for inserted blanks.
+
 	* unposted: Completion/Base/Utility/_values, Doc/Zsh/compwid.yo,
 	Src/Zle/compcore.c, Src/Zle/complete.c, Src/Zle/compresult.c:
 	Back off 26270 and follow up; was causing memory corruption.
@@ -10901,5 +10904,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4506 $                         
+* $Revision: 1.4507 $                         
 *****************************************************
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index ba6fdaaf1..8fb2dff34 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1973,8 +1973,18 @@ refreshline(int ln)
 		   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 @@ refreshline(int ln)
 				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;
 			}