summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2014-12-28 20:58:10 (GMT)
committerfvogel <fvogelnew1@free.fr>2014-12-28 20:58:10 (GMT)
commit3c2b8c528158a93d619459fb955cfb489b11b705 (patch)
treeda9941a9756ac0c3e03ea20b0207f748beccb3ec
parent00c90a36f723fb24cce340db3aaadeac2d26c23b (diff)
downloadtk-3c2b8c528158a93d619459fb955cfb489b11b705.zip
tk-3c2b8c528158a93d619459fb955cfb489b11b705.tar.gz
tk-3c2b8c528158a93d619459fb955cfb489b11b705.tar.bz2
Further fixed text see with indices in elided lines, [5f352f3a71] was not always correct
-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