summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2018-01-28 15:46:03 (GMT)
committerfvogel <fvogelnew1@free.fr>2018-01-28 15:46:03 (GMT)
commit0022103e87c66db4d4af3491fa01601b58bf6a1e (patch)
treec86afe9a44ab976e1ffffd85d6a45ac0fcb54631 /generic/tkText.c
parent2309df33fd2926c26e2b4eb8f01faf6441c893cd (diff)
parent45ee94dff4405aa24cdccccbe00b5bab3d549c43 (diff)
downloadtk-0022103e87c66db4d4af3491fa01601b58bf6a1e.zip
tk-0022103e87c66db4d4af3491fa01601b58bf6a1e.tar.gz
tk-0022103e87c66db4d4af3491fa01601b58bf6a1e.tar.bz2
Fix [b68710aed6]: Minor fixes to library/text.tcl bindings, and generation of <<Selection>> events. Legacy text widget.
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c65
1 files changed, 33 insertions, 32 deletions
diff --git a/generic/tkText.c b/generic/tkText.c
index 14ff7e0..279400d 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -2726,10 +2726,14 @@ InsertChars(
}
/*
- * Invalidate any selection retrievals in progress.
+ * Invalidate any selection retrievals in progress, and send an event
+ * that the selection changed if that is the case.
*/
for (tPtr = sharedTextPtr->peers; tPtr != NULL ; tPtr = tPtr->next) {
+ if (TkBTreeCharTagged(indexPtr, tPtr->selTagPtr)) {
+ TkTextSelectionEvent(tPtr);
+ }
tPtr->abortSelections = 1;
}
@@ -3118,6 +3122,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;
@@ -3182,42 +3189,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;
+ }
}
/*