summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkListbox.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 9ff9d23..e29c637 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -3630,7 +3630,8 @@ MigrateHashEntries(
*
* GetMaxOffset --
*
- * Passing in a listbox pointer, returns the maximum offset for the box.
+ * Passing in a listbox pointer, returns the maximum offset for the box,
+ * i.e. the maximum possible horizontal scrolling value (in pixels).
*
* Results:
* Listbox's maxOffset.
@@ -3649,6 +3650,11 @@ static int GetMaxOffset(
(Tk_Width(listPtr->tkwin) - 2*listPtr->inset -
2*listPtr->selBorderWidth) + listPtr->xScrollUnit - 1;
if (maxOffset < 0) {
+
+ /*
+ * Listbox is larger in width than its largest width item.
+ */
+
maxOffset = 0;
}
maxOffset -= maxOffset % listPtr->xScrollUnit;