]> gitweb.factorcode.org Git - factor.git/blobdiff - library/ui/gadgets/lists.factor
Menus
[factor.git] / library / ui / gadgets / lists.factor
index f52a7d4b05a0e2344d0651195ffaf70b3b468249..9e8ae8149cb1af79d8677d8bcaebc8df660b5395 100644 (file)
@@ -41,7 +41,10 @@ M: list focusable-child* drop t ;
     dup list-index swap control-value ?nth ;
 
 : scroll>selected ( list -- )
-    dup selected-rect swap scroll>rect ;
+    #! We change the rectangle's width to zero to avoid
+    #! scrolling right.
+    [ selected-rect rect-bounds { 0 1 } v* <rect> ] keep
+    scroll>rect ;
 
 : list-empty? ( list -- ? ) control-value empty? ;