summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2006-09-06 19:53:22 (GMT)
committerhobbs <hobbs>2006-09-06 19:53:22 (GMT)
commit4912d9573af7ec34498035d73747de8a7f729510 (patch)
treea863cb0570e5e13ab60b0d6001e51aad68a57f03 /generic/tkText.c
parent476e78dd9f30bea8238afddd29e801150c99f6bf (diff)
downloadtk-4912d9573af7ec34498035d73747de8a7f729510.zip
tk-4912d9573af7ec34498035d73747de8a7f729510.tar.gz
tk-4912d9573af7ec34498035d73747de8a7f729510.tar.bz2
* generic/tkText.c (DeleteChars): backport of 8.5 text delete
speedup that removes tags from deleted area first. [Bug 1456342]
Diffstat (limited to 'generic/tkText.c')
-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,