summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogelnew1@free.fr <fvogel>2015-07-13 10:10:03 (GMT)
committerfvogelnew1@free.fr <fvogel>2015-07-13 10:10:03 (GMT)
commit5aaa77ff6b497a67b07cc2e84f9a854582112021 (patch)
treed5fdcaddca6295905f126cfa519e8f1c501e707e
parent1d6289e80067ffc4e9825e085230320d5d5ec8e8 (diff)
parent4b5d8ab38539e4a8d31f27c942967248b761cbc8 (diff)
downloadtk-5aaa77ff6b497a67b07cc2e84f9a854582112021.zip
tk-5aaa77ff6b497a67b07cc2e84f9a854582112021.tar.gz
tk-5aaa77ff6b497a67b07cc2e84f9a854582112021.tar.bz2
Fixed bug [3f1f79abcf] - Text widget crash when seeing or bboxing (or selecting, moving the cursor...) in elided text
-rw-r--r--generic/tkTextIndex.c2
-rw-r--r--tests/textIndex.test13
2 files changed, 14 insertions, 1 deletions
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 6a60faf..b886975 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -1695,7 +1695,7 @@ IndexCountBytesOrdered(
byteCount += segPtr->size;
}
- linePtr = indexPtr1->linePtr->nextPtr;
+ linePtr = TkBTreeNextLine(textPtr, indexPtr1->linePtr);
while (linePtr != indexPtr2->linePtr) {
for (segPtr = linePtr->segPtr; segPtr != NULL;
segPtr = segPtr->nextPtr) {
diff --git a/tests/textIndex.test b/tests/textIndex.test
index abed3d4..e78e54b 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -943,6 +943,19 @@ test textIndex-24.1 {text mark prev} {
set res
} {1.0}
+test textIndex-25.1 {IndexCountBytesOrdered, bug [3f1f79abcf]} {
+ pack [text .t2]
+ .t2 tag configure elided -elide 1
+ .t2 insert end "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n"
+ .t2 insert end "11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"
+ .t2 insert end "21\n22\n23\n25\n26\n27\n28\n29\n30\n31"
+ .t2 insert end "32\n33\n34\n36\n37\n38\n39" elided
+ # then this used to crash Tk:
+ .t2 see end
+ focus -force .t2 ; # to see the cursor blink
+ destroy .t2
+} {}
+
# cleanup
rename textimage {}
catch {destroy .t}