From 14ce825dcd0062ad80540787437ee9decddd4ba1 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 7 Jan 2010 15:35:04 +0000 Subject: [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. --- ChangeLog | 6 ++++++ generic/tkTextDisp.c | 7 ++++--- tests/textDisp.test | 26 +++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index db34d60..ce22a68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-01-07 Donal K. Fellows + + * 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 Jan Nijtmans * unix/tcl.m4 Sync with Tcl version diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 8477739..4256c36 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.68.2.1 2009/08/04 21:46:03 dkf Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.68.2.2 2010/01/07 15:35:04 dkf Exp $ */ #include "tkInt.h" @@ -2902,8 +2902,9 @@ AsyncUpdateLineMetrics( } 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 116d623..d349b17 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.42.2.1 2008/10/10 16:28:25 dgp Exp $ +# RCS: @(#) $Id: textDisp.test,v 1.42.2.2 2010/01/07 15:35:04 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 -- cgit v0.12