diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | generic/tkText.c | 21 |
2 files changed, 25 insertions, 1 deletions
@@ -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, |