]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.gadgets: refactor scroll-at-bottom?.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 30 Mar 2021 20:41:11 +0000 (13:41 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 30 Mar 2021 20:41:11 +0000 (13:41 -0700)
basis/ui/gadgets/panes/panes.factor
basis/ui/gadgets/scrollers/scrollers.factor

index 8f92ecd02afc84bdc76423c94ad6d7d12d6b1741..14dad8e281cc431b4663160a414274a8be3d7c7b 100644 (file)
@@ -121,11 +121,7 @@ GENERIC: pane-line ( str style gadget -- )
     [ 1string H{ } ] dip current>> pane-line ;
 
 : pane-scrolls? ( pane -- ? )
-    dup scrolls?>> [
-        find-scroller control-value [
-            second first4 nip [ + ] [ >= ] bi*
-        ] [ f ] if*
-    ] [ drop f ] if ;
+    dup scrolls?>> [ find-scroller scroll-at-bottom? ] [ drop f ] if ;
 
 : do-pane-stream ( pane-stream quot -- )
     [ pane>> ] dip dup pane-scrolls? [ keep ] dip
index 9b9ae8c690cdf094880d22ad9e1fc4bbadb8b532..d989c6f056cc2bcf457e517d0e4b01cf7561988a 100644 (file)
@@ -36,6 +36,11 @@ M: gadget viewport-column-header drop f ;
     ] keep
     2dup control-value = [ 2drop ] [ set-control-value ] if ;
 
+: scroll-at-bottom? ( scroller -- ? )
+    control-value [
+        second first4 nip [ + ] [ >= ] bi*
+    ] [ f ] if* ;
+
 <PRIVATE
 
 : do-mouse-scroll ( scroller -- )