summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2014-12-05 20:36:25 (GMT)
committerfvogel <fvogelnew1@free.fr>2014-12-05 20:36:25 (GMT)
commitc3d0229cec20604126fb0074106c96fc3f082d02 (patch)
treec5ce3069e1073e46d58d978fa84abf56ccc1a1c2
parent4ccd3392912d78e23be5aad9be104d58f301c4b7 (diff)
parentdd3a3ee0e1986dacd24474e62f1a63a002362c4e (diff)
downloadtk-c3d0229cec20604126fb0074106c96fc3f082d02.zip
tk-c3d0229cec20604126fb0074106c96fc3f082d02.tar.gz
tk-c3d0229cec20604126fb0074106c96fc3f082d02.tar.bz2
Merged from branch bug-7703f947aa
-rw-r--r--generic/tkTextDisp.c8
-rw-r--r--tests/textDisp.test21
2 files changed, 26 insertions, 3 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 3d442af..851ee3e 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -3382,7 +3382,8 @@ TkTextFindDisplayLineEnd(
* of the original index within its display
* line. */
{
- if (!end && indexPtr->byteIndex == 0) {
+ if (!end && indexPtr->byteIndex == 0
+ && !TkTextIsElided(textPtr, indexPtr, NULL)) {
/*
* Nothing to do.
*/
@@ -3461,8 +3462,9 @@ TkTextFindDisplayLineEnd(
* this now.
*/
- *xOffset = DlineXOfIndex(textPtr, dlPtr,
- indexPtr->byteIndex - dlPtr->index.byteIndex);
+ *xOffset = DlineXOfIndex(textPtr, dlPtr,
+ TkTextIndexCount(textPtr, &dlPtr->index, indexPtr,
+ COUNT_INDICES));
}
if (end) {
/*
diff --git a/tests/textDisp.test b/tests/textDisp.test
index fff52d4..c3ed43f 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -2065,6 +2065,27 @@ test textDisp-16.40 {text count -xpixels} {
[.t count -xpixels 1.0 "1.0 displaylineend"] \
[.t count -xpixels 1.0 end]
} {35 -35 0 42 42 42 0}
+test textDisp-16.41 {text count -xpixels with indices in elided lines} {
+ set res {}
+ .t delete 1.0 end
+ for {set i 1} {$i < 40} {incr i} {
+ .t insert end [string repeat "Line $i" 20]
+ .t insert end "\n"
+ }
+ .t configure -wrap none
+ .t tag add hidden 5.15 20.15
+ .t tag configure hidden -elide true
+ lappend res [.t count -xpixels 5.15 6.0] \
+ [.t count -xpixels 5.15 6.1] \
+ [.t count -xpixels 6.0 6.1] \
+ [.t count -xpixels 6.1 6.2] \
+ [.t count -xpixels 6.1 6.0] \
+ [.t count -xpixels 6.0 7.0] \
+ [.t count -xpixels 6.1 7.1] \
+ [.t count -xpixels 15.0 20.15] \
+ [.t count -xpixels 20.15 20.16] \
+ [.t count -xpixels 20.16 20.15]
+} [list 0 0 0 0 0 0 0 0 $fixedWidth -$fixedWidth]
.t delete 1.0 end
foreach i {a b c d e f g h i j k l m n o p q r s t u v w x y z} {