summaryrefslogtreecommitdiffstats
path: root/generic/tkTextDisp.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-11-07 12:06:47 (GMT)
committervincentdarley <vincentdarley>2003-11-07 12:06:47 (GMT)
commit2a739cee5e02ba828e59bcf8348ff158ef53db67 (patch)
tree617942b27e4145ce929f01bbc318fd08728b8945 /generic/tkTextDisp.c
parent73d34baf565c3f2e0c8d2170107eb971e5a8aeb6 (diff)
downloadtk-2a739cee5e02ba828e59bcf8348ff158ef53db67.zip
tk-2a739cee5e02ba828e59bcf8348ff158ef53db67.tar.gz
tk-2a739cee5e02ba828e59bcf8348ff158ef53db67.tar.bz2
another elide/tkchat/tkTextDisp.c fix
Diffstat (limited to 'generic/tkTextDisp.c')
-rw-r--r--generic/tkTextDisp.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 08680f9..ebe9b4c 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextDisp.c,v 1.22 2003/11/03 16:10:12 vincentdarley Exp $
+ * RCS: @(#) $Id: tkTextDisp.c,v 1.23 2003/11/07 12:06:47 vincentdarley Exp $
*/
#include "tkPort.h"
@@ -955,6 +955,7 @@ LayoutDLine(textPtr, indexPtr)
*/
elide = TkTextIsElided(textPtr, indexPtr); /* save a malloc */
if (elide && indexPtr->byteIndex==0) {
+ int tagElidePriority = -1;
maxBytes = 0;
for (segPtr = indexPtr->linePtr->segPtr;
segPtr != NULL;
@@ -969,11 +970,25 @@ LayoutDLine(textPtr, indexPtr)
break;
}
maxBytes += segPtr->size;
+ /*
+ * Reset tag elide priority, since we're on a new
+ * character.
+ */
+ tagElidePriority = -1;
} else if ((segPtr->typePtr == &tkTextToggleOffType)
- || (segPtr->typePtr == &tkTextToggleOnType)) {
- if (segPtr->body.toggle.tagPtr->elideString != NULL) {
- elide = (segPtr->typePtr == &tkTextToggleOffType)
- ^ segPtr->body.toggle.tagPtr->elide;
+ || (segPtr->typePtr == &tkTextToggleOnType)) {
+ TkTextTag *tagPtr = segPtr->body.toggle.tagPtr;
+ if (tagPtr->elideString != NULL) {
+ /*
+ * Only update the elide status if this tag has
+ * higher priority than any other we've so far
+ * seen at this index.
+ */
+ if (tagPtr->priority > tagElidePriority) {
+ elide = ((segPtr->typePtr == &tkTextToggleOffType)
+ ^ tagPtr->elide);
+ tagElidePriority = tagPtr->priority;
+ }
}
}
}