summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2018-01-16 20:29:03 (GMT)
committerfvogel <fvogelnew1@free.fr>2018-01-16 20:29:03 (GMT)
commit0d081ffec083a435733efdf54b85b97517643831 (patch)
tree9c9c8e3b57b80b192136186ae29f30093f50132a /generic/tkText.c
parent09f7781c81fdf230a784fa3c74d7898a894f3c94 (diff)
downloadtk-0d081ffec083a435733efdf54b85b97517643831.zip
tk-0d081ffec083a435733efdf54b85b97517643831.tar.gz
tk-0d081ffec083a435733efdf54b85b97517643831.tar.bz2
Deal with the case of selection modification by deletion. This makes text-27.15b and text-27.15c pass.
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 28fca76..136686b 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -3069,6 +3069,9 @@ DeleteIndexRange(
int *lineAndByteIndex;
int resetViewCount;
int pixels[2*PIXEL_CLIENTS];
+ Tcl_HashSearch search;
+ Tcl_HashEntry *hPtr;
+ int i;
if (sharedTextPtr == NULL) {
sharedTextPtr = textPtr->sharedTextPtr;
@@ -3133,42 +3136,36 @@ DeleteIndexRange(
}
}
- 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.
- */
-
- Tcl_HashSearch search;
- Tcl_HashEntry *hPtr;
- int i;
+ /*
+ * 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.
+ */
- for (i=0, hPtr=Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search);
- hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
- TkTextTag *tagPtr = Tcl_GetHashValue(hPtr);
+ for (i=0, hPtr=Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search);
+ hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
+ TkTextTag *tagPtr = Tcl_GetHashValue(hPtr);
- TkBTreeTag(&index1, &index2, tagPtr, 0);
- }
+ TkBTreeTag(&index1, &index2, tagPtr, 0);
+ }
- /*
- * Special case for the sel tag which is not in the hash table. We
- * need to do this once for each peer text widget.
- */
+ /*
+ * Special case for the sel tag which is not in the hash table. We
+ * need to do this once for each peer text widget.
+ */
- for (tPtr = sharedTextPtr->peers; tPtr != NULL ;
- tPtr = tPtr->next) {
- if (TkBTreeTag(&index1, &index2, tPtr->selTagPtr, 0)) {
- /*
- * Send an event that the selection changed. This is
- * equivalent to:
- * event generate $textWidget <<Selection>>
- */
+ for (tPtr = sharedTextPtr->peers; tPtr != NULL ;
+ tPtr = tPtr->next) {
+ if (TkBTreeTag(&index1, &index2, tPtr->selTagPtr, 0)) {
+ /*
+ * Send an event that the selection changed. This is
+ * equivalent to:
+ * event generate $textWidget <<Selection>>
+ */
- TkTextSelectionEvent(textPtr);
- tPtr->abortSelections = 1;
- }
- }
+ TkTextSelectionEvent(textPtr);
+ tPtr->abortSelections = 1;
+ }
}
/*