diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 12 | ||||
-rw-r--r-- | tests/textDisp.test | 26 |
3 files changed, 40 insertions, 4 deletions
@@ -1,3 +1,9 @@ +2010-01-07 Donal K. Fellows <dkf@users.sf.net> + + * generic/tkTextDisp.c (AsyncUpdateLineMetrics): [Bug 2677890]: Fix + odd text widget update problem that had scrollbars being unable to + cover the whole widget. Fix is to reify the range to update sooner. + 2010-01-06 Donal K. Fellows <dkf@users.sf.net> * library/tk.tcl: Centralize the definition of keys that diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index be9dd3b..9dc4316 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTextDisp.c,v 1.76 2010/01/02 22:52:38 dkf Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.77 2010/01/07 15:32:18 dkf Exp $ */ #include "tkInt.h" @@ -2902,9 +2902,15 @@ AsyncUpdateLineMetrics( return; } + /* + * Reify where we end or all hell breaks loose with the calculations when + * we try to update. [Bug 2677890] + */ + lineNum = dInfoPtr->currentMetricUpdateLine; - if (lineNum == -1) { - dInfoPtr->lastMetricUpdateLine = 0; + if (dInfoPtr->lastMetricUpdateLine == -1) { + dInfoPtr->lastMetricUpdateLine = + TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr); } /* diff --git a/tests/textDisp.test b/tests/textDisp.test index 6d3212c..1d72ca5 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: textDisp.test,v 1.43 2008/10/08 20:15:26 dgp Exp $ +# RCS: @(#) $Id: textDisp.test,v 1.44 2010/01/07 15:32:18 dkf Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -3846,6 +3846,30 @@ test textDisp-33.5 {bold or italic fonts} win { } {italic font measurement ok} destroy .tt +test textDisp-34.1 {Text widgets multi-scrolling problem: Bug 2677890} -setup { + pack [text .t1 -width 10 -yscrollcommand {.sy set}] \ + [ttk::scrollbar .sy -orient vertical -command {.t1 yview}] \ + -side left -fill both + bindtags .sy {}; # No clicky! + set txt "" + for {set i 0} {$i < 99} {incr i} { + lappend txt "$i" [list pc $i] "\n" "" + } + set result {} +} -body { + .t1 insert end {*}$txt + update + lappend result [.sy get] + .t1 replace 6.0 6.0+1c "*" + lappend result [.sy get] + after 0 {lappend result [.sy get]} + after 1000 {lappend result [.sy get]} + vwait result;vwait result + return $result +} -cleanup { + destroy .t1 .sy +} -result {{0.0 1.0} {0.0 1.0} {0.0 1.0} {0.0 0.24}} + deleteWindows option clear |