From d2181a9e71852d10ead3ba25db2f64129062634d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= <bjourne@gmail.com> Date: Fri, 16 Oct 2015 10:55:48 +0200 Subject: [PATCH] ui.gadgets.incremental: trivial scrolling, maybe solves #1488? --- basis/ui/gadgets/incremental/incremental.factor | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/basis/ui/gadgets/incremental/incremental.factor b/basis/ui/gadgets/incremental/incremental.factor index 952252a5cd..55d4ca612a 100644 --- a/basis/ui/gadgets/incremental/incremental.factor +++ b/basis/ui/gadgets/incremental/incremental.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors combinators kernel math.vectors namespaces -ui.gadgets ui.gadgets.packs ui.gadgets.private ; +USING: accessors combinators kernel math math.vectors namespaces +sequences ui.gadgets ui.gadgets.packs ui.gadgets.private ; IN: ui.gadgets.incremental TUPLE: incremental < pack cursor ; @@ -34,8 +34,16 @@ M: incremental pref-dim* M: incremental dim-changed drop ; +: scroll-children ( incremental -- ) + dup children>> length 200,000 > [ + ! We let the length oscillate between 100k-200k, so we don't + ! have to tail* the sequence on every gadget add. + [ 100,000 short tail* ] change-children drop + ] [ drop ] if ; + : add-incremental ( gadget incremental -- ) not-in-layout + dup scroll-children 2dup (add-gadget) t in-layout? [ {