From 24b4a3cdfb7412ee9337695296ec28a02a1f08ad Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 27 Apr 2019 15:49:23 +0000 Subject: More generic fix, for [8261c517af] and [2513186fff]. --- generic/ttk/ttkEntry.c | 8 -------- generic/ttk/ttkScroll.c | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 1ef2423..e6365b2 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1652,14 +1652,6 @@ static int EntryXViewCommand( { Entry *entryPtr = recordPtr; - /* - * Ensure that the scroll info is up-to-date before a scrolling command. - */ - - if (entryPtr->core.flags & REDISPLAY_PENDING) { - EntryDoLayout(entryPtr); - } - if (objc == 3) { int newFirst; if (EntryIndex(interp, entryPtr, objv[2], &newFirst) != TCL_OK) { diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index 184f5f2..60f0480 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -197,7 +197,16 @@ int TtkScrollviewCommand( if (objc == 2) { Tcl_Obj *result[2]; - result[0] = Tcl_NewDoubleObj((double)s->first / s->total); + + /* + * Update the scroll info (first, last, total) if needed. + */ + + if (h->corePtr->flags & REDISPLAY_PENDING) { + h->corePtr->widgetSpec->layoutProc(h->corePtr); + } + + result[0] = Tcl_NewDoubleObj((double)s->first / s->total); result[1] = Tcl_NewDoubleObj((double)s->last / s->total); Tcl_SetObjResult(interp, Tcl_NewListObj(2, result)); return TCL_OK; @@ -235,6 +244,14 @@ void TtkScrollTo(ScrollHandle h, int newFirst) { Scrollable *s = h->scrollPtr; + /* + * Update the scroll info (first, last, total) if needed. + */ + + if (h->corePtr->flags & REDISPLAY_PENDING) { + h->corePtr->widgetSpec->layoutProc(h->corePtr); + } + if (newFirst >= s->total) newFirst = s->total - 1; if (newFirst > s->first && s->last >= s->total) /* don't scroll past end */ -- cgit v0.12