summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2006-09-06 19:53:22 (GMT)
committerhobbs <hobbs>2006-09-06 19:53:22 (GMT)
commit87caa3a60c4200a5a79707791643a555407a1271 (patch)
treea863cb0570e5e13ab60b0d6001e51aad68a57f03
parentc205e2f533cdd989f00a0c10dcec801c3e6ad6dc (diff)
downloadtk-87caa3a60c4200a5a79707791643a555407a1271.zip
tk-87caa3a60c4200a5a79707791643a555407a1271.tar.gz
tk-87caa3a60c4200a5a79707791643a555407a1271.tar.bz2
* generic/tkText.c (DeleteChars): backport of 8.5 text delete
speedup that removes tags from deleted area first. [Bug 1456342]
-rw-r--r--ChangeLog5
-rw-r--r--generic/tkText.c21
2 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c7dba42..b88b3ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-09-06 Jeff Hobbs <jeffh@ActiveState.com>
+
+ * generic/tkText.c (DeleteChars): backport of 8.5 text delete
+ speedup that removes tags from deleted area first. [Bug 1456342]
+
2006-08-30 Jeff Hobbs <jeffh@ActiveState.com>
* win/tkWinKey.c: Add WM_UNICHAR window message support (used by
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,