# HG changeset patch
# User Dominic LoBue <dominic.lobue@gmail.com>
# Date 1259120345 28800
# Node ID 3112ac099b77fc8d3ac4bf93b15ef67ee0a0f2cc
# Parent  733cb2e091115b3f6fda0bf661405ae88cdf1e63
bug fix to disable scroll snapping in listboxes when the widget that would have been snapped to is larger than the max amount of rows available

diff -r 733cb2e09111 -r 3112ac099b77 urwid/listbox.py
--- a/urwid/listbox.py	Tue Nov 24 13:19:16 2009 -0500
+++ b/urwid/listbox.py	Tue Nov 24 19:39:05 2009 -0800
@@ -609,13 +609,15 @@
         if ( coming_from == 'above' 
                 and target.selectable()
                 and offset_inset > align_bottom
-                and align_bottom >= offset_inset-snap_rows ):
+                and align_bottom >= offset_inset-snap_rows
+                and snap_rows >= tgt_rows ):
             offset_inset = align_bottom
             
         if ( coming_from == 'below' 
                 and target.selectable() 
                 and offset_inset < align_top
-                and align_top <= offset_inset+snap_rows ):
+                and align_top <= offset_inset+snap_rows
+                and snap_rows >= tgt_rows ):
             offset_inset = align_top
         
         # convert offset_inset to offset_rows or inset_fraction
