Ticket UUID: | 1739605 | |||
Title: | [text see] misbehaves following widget create/populate | |||
Type: | Bug | Version: | obsolete: 8.5a6 | |
Submitter: | aric_b | Created on: | 2007-06-19 10:04:36 | |
Subsystem: | 18. [text] | Assigned To: | fvogel | |
Priority: | 6 | Severity: | Minor | |
Status: | Closed | Last Modified: | 2015-12-13 19:43:17 | |
Resolution: | Fixed | Closed By: | fvogel | |
Closed on: | 2015-12-13 19:43:17 | |||
Description: |
[text see] adjusts the text widget to the wrong place when called immediately after a text widget is created and programmatically populated. (Subsequent calls to [text see] produce the correct behavior--even if they immediately follow the faulty call.) # test script 1 # demonstrates [text see] bug package require Tcl 8.5 package require Tk 8.5 set t [text .t -wrap none] set s [scrollbar .s -command [list $t yview]] $t configure -yscrollcommand [list $s set] grid $t $s -sticky nsew for {set i 1} {$i <= 100} {incr i} { $t insert end "This is line $i\n" } $t see 1.0 raise . | |||
User Comments: |
fvogel added on 2015-12-13 19:43:17:
Fix merged in core-8-5-branch and trunk. fvogel added on 2015-12-06 10:19:01: No test case of the test suite shows regression with this patch. fvogel added on 2015-12-05 13:49:50: Many thanks for the patch! Now available in branch bug-1739605fff for testing and review. danckaert added on 2015-12-02 15:49:51: The [update idletasks] is really required to make the [see] operation work correctly. However, we could indeed make a better choice about which pixel to display, when the window size is smaller than the lineheight. I will attach a patch to accomplish this. aric_b added on 2007-06-30 00:52:02: Logged In: YES user_id=1326110 Originator: YES I can understand that the widget doesn't have all the information it needs before [update idletasks]. But the choice of which pixel to put at the top of the screen in this situation seems arbitrary--my limited tests show that it's not always the bottom pixel, but never the top pixel, which would seem to be the logical choice. The end result seems wrong. Tk 8.4 deals with the same [update] limitation, but produces a satisfactory result in spite of this by positioning the top pixel of the requested line at the top of the widget. Shouldn't 8.5 do the same thing? (I realize the 8.4 text widget has no choice but to work with the top pixel, whereas the 8.5 text widget does have such a choice, but still...) danckaert added on 2007-06-29 16:39:12: Logged In: YES user_id=1388916 Originator: NO I do not think this is really a bug. You have to do 'update idletasks' after gridding the text widget. Otherwise the see operation doesn't know the size of the widget yet. In fact, [winfo height .t] == 1 then, and the see operation puts the bottom pixel line of the top text line at the top. aric_b added on 2007-06-19 17:04:36: File Added - 233665: textseebug2.tcl |