Scroll to the top when pane control changes

slava 2006-11-10 20:45:06 +00:00
parent 5e17832dbb
commit 071fca9916
3 changed files with 7 additions and 1 deletions

View File

@ -56,8 +56,10 @@ M: gadget equal? eq? ;
: nth-gadget gadget-children nth ;
: <zero-rect> { 0 0 } dup <rect> ;
C: gadget ( -- gadget )
{ 0 0 } dup <rect> over set-delegate
<zero-rect> over set-delegate
{ 0 1 } over set-gadget-orientation
t over set-gadget-visible? ;

View File

@ -97,6 +97,7 @@ M: duplex-stream write-gadget
: with-pane ( pane quot -- )
#! Clear the pane and run the quotation in a scope with
#! stdio set to the pane.
over scroll>top
over pane-clear >r <pane-stream> r>
over >r with-stream r> ?terpri ; inline

View File

@ -87,6 +87,9 @@ C: scroller ( gadget -- scroller )
: (scroll>bottom) ( scroller -- )
dup scroller-viewport viewport-dim { 0 1 } v* scroll ;
: scroll>top ( gadget -- )
<zero-rect> swap scroll>rect ;
: update-scroller ( scroller -- )
dup scroller-follows [
dup scroller-follows t eq? [