Tk Source Code

View Ticket
Login
Ticket UUID: e51941c1b925a782cf0ee710b3a4d0a38e2a9eb3
Title: text-9.2.47 fails sometimes
Type: Bug Version: trunk
Submitter: fvogel Created on: 2015-10-31 20:12:53
Subsystem: 18. [text] Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2015-10-31 20:33:17
Resolution: Fixed Closed By: fvogel
    Closed on: 2015-10-31 20:33:17
Description:
text-9.2.47 fails sometimes

For me on Win 7 it's almost always.

==== text-9.2.47 TextWidgetCmd procedure, "count" option FAILED
==== Contents of test case:

    for {set i 1} {$i < 25} {incr i} {
        .t insert end "Line $i\n"
    }
    .t tag configure hidden -elide true
    .t tag add hidden 5.7 11.0
    update
    set y1 [lindex [.t yview] 1]
    .t count -displaylines 5.0 11.0
    set y2 [lindex [.t yview] 1]
    .t count -displaylines 5.0 12.0
    set y3 [lindex [.t yview] 1]
    list [expr {$y1 == $y2}] [expr {$y1 == $y3}]

---- Result was:
0 0
---- Result should have been (exact matching):
1 1
==== text-9.2.47 FAILED
User Comments: fvogel added on 2015-10-31 20:33:17:
Fixed in core-8-5-branch and trunk.

fvogel added on 2015-10-31 20:20:27:

Root cause is that at the time .t yview is called, the asynchronous calculation of the line heights is not finished.

This can be worked around by calling .t count -update -ypixels 1.0 end before .t yview

See also [1566949].