summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkTextDisp.c4
-rw-r--r--tests/textDisp.test31
2 files changed, 34 insertions, 1 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index be77550..4d9d042 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -5181,7 +5181,9 @@ TkTextSetYView(
* If the line is not close, place it in the center of the window.
*/
- lineHeight = CalculateDisplayLineHeight(textPtr, indexPtr, NULL, NULL);
+ tmpIndex = *indexPtr;
+ TkTextFindDisplayLineEnd(textPtr, &tmpIndex, 0, NULL);
+ lineHeight = CalculateDisplayLineHeight(textPtr, &tmpIndex, NULL, NULL);
/*
* It would be better if 'bottomY' were calculated using the actual height
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 954c1f6..1f85117 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -1492,6 +1492,37 @@ test textDisp-11.18 {TkTextSetYView, see in elided lines} {
# The index "8.0 lineend" is on screen despite elided -> no scroll
.top.t index @0,0
} {4.0}
+test textDisp-11.19 {TkTextSetYView, see in elided lines} {
+ .top.t delete 1.0 end
+ for {set i 1} {$i < 50} {incr i} {
+ .top.t insert end "Line $i\n"
+ }
+ # button just for having a line with a larger height
+ button .top.t.b -text "Test" -bd 2 -highlightthickness 2
+ .top.t window create 21.0 -window .top.t.b
+ .top.t tag add hidden 15.36 21.0
+ .top.t tag configure hidden -elide true
+ .top.t configure -height 15
+ wm geometry .top 300x200+0+0
+ # Indices 21.0, 17.0 and 15.0 are all on the same display line
+ # therefore index @0,0 shall be the same for all of them
+ .top.t see end
+ update
+ .top.t see 21.0
+ update
+ set ind1 [.top.t index @0,0]
+ .top.t see end
+ update
+ .top.t see 17.0
+ update
+ set ind2 [.top.t index @0,0]
+ .top.t see end
+ update
+ .top.t see 15.0
+ update
+ set ind3 [.top.t index @0,0]
+ list [expr {$ind1 == $ind2}] [expr {$ind1 == $ind3}]
+} {1 1}
.t configure -wrap word
.t delete 50.0 51.0