summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkText.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index f1fb16d..a06b90f 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.33.2.1 2006/04/05 19:48:43 hobbs Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.33.2.2 2006/09/06 19:53:22 hobbs Exp $
*/
#include "default.h"
@@ -1585,6 +1585,25 @@ DeleteChars(textPtr, index1String, index2String, indexPtr1, indexPtr2)
}
}
+ if (line1 < line2) {
+ /*
+ * We are deleting more than one line. For speed, we remove all tags
+ * from the range first. If we don't do this, the code below can (when
+ * there are many tags) grow non-linearly in execution time.
+ * [Bug 1456342]
+ */
+
+ Tcl_HashSearch search;
+ Tcl_HashEntry *hPtr;
+
+ for (hPtr=Tcl_FirstHashEntry(&textPtr->tagTable, &search);
+ hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
+ TkTextTag *tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr);
+
+ TkBTreeTag(&index1, &index2, tagPtr, 0);
+ }
+ }
+
/*
* Tell the display what's about to happen so it can discard
* obsolete display information, then do the deletion. Also,