Subject: Use GetMaxOffset when possible to reduce code duplication. The change in ListboxScanTo is not exactly equivalent but I believe the previous version was a bug.

From: fvogel <[email-masked]>
Date: Mon, 18 Jan 2016 10:08:58 +0000

---
 generic/tkListbox.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index ee6941e..795ec0f 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -2887,9 +2887,7 @@ ChangeListboxOffset(
      */
 
     offset += listPtr->xScrollUnit / 2;
-    maxOffset = listPtr->maxWidth - (Tk_Width(listPtr->tkwin) -
-	    2*listPtr->inset - 2*listPtr->selBorderWidth)
-	    + listPtr->xScrollUnit - 1;
+    maxOffset = GetMaxOffset(listPtr);
     if (offset > maxOffset) {
 	offset = maxOffset;
     }
@@ -2930,9 +2928,7 @@ ListboxScanTo(
     int newTopIndex, newOffset, maxIndex, maxOffset;
 
     maxIndex = listPtr->nElements - listPtr->fullLines;
-    maxOffset = listPtr->maxWidth + (listPtr->xScrollUnit - 1)
-	    - (Tk_Width(listPtr->tkwin) - 2*listPtr->inset
-	    - 2*listPtr->selBorderWidth - listPtr->xScrollUnit);
+    maxOffset = GetMaxOffset(listPtr);
 
     /*
      * Compute new top line for screen by amplifying the difference between
-- 
cgit v0.12