- minibuffer should show a title
- clean up listener's minibuffer-related code
- help search looks funny
-- list action: if nothing selected, don't NPE
+- parse errors: clickable pathnames
+ ui:
: (file.) ( name path -- )
<pathname> write-object ;
-: path. ( path -- ) dup (file.) ;
+: write-pathname ( path -- ) dup (file.) ;
DEFER: directory.
] with-scope ;\r
\r
: parsing-file ( file -- )\r
- "Loading " write path. terpri flush ;\r
+ "Loading " write write-pathname terpri flush ;\r
\r
: record-file ( file -- )\r
[ <source-file> ] keep source-files get set-hash ;\r
IN: scratchpad
USING: kernel kernel-internals math memory namespaces sequences
-test ;
+test errors ;
[ 0 ] [ f size ] unit-test
[ t ] [ [ \ = \ = ] all-equal? ] unit-test
[ [ 3 ] ] [ 3 f curry ] unit-test
[ [ \ + ] ] [ \ + f curry ] unit-test
[ [ \ + = ] ] [ \ + [ = ] curry ] unit-test
+
+! Make sure we report the correct error on stack underflow
+[ { kernel-error 11 f f } ]
+[ [ clear drop ] catch ] unit-test
: parse-dump ( error -- )
"Parsing " write
- dup parse-error-file [ "<interactive>" ] unless* write
+ dup parse-error-file
+ [ "<interactive>" ] unless*
+ write-pathname
":" write
dup parse-error-line [ 1 ] unless* number>string print
: failed.
"Tests failed:" print
- failures get [ first2 swap path. ": " write error. ] each ;
+ failures get [
+ first2 swap write-pathname ": " write error.
+ ] each ;
: run-tests ( seq -- )
prepare-tests [ run-test ] subset terpri passed. failed. ;
M: list focusable-child* drop t ;
: list-value ( list -- object )
- dup control-value empty? [
- drop f
- ] [
- dup list-index swap control-value nth
- ] if ;
+ dup list-index swap control-value ?nth ;
: scroll>selected ( list -- )
dup selected-rect swap scroll>rect ;
+: list-empty? ( list -- ? ) control-value empty? ;
+
: select-index ( n list -- )
- dup control-value empty? [
+ dup list-empty? [
2drop
] [
[ control-value length rem ] keep
dup list-index 1+ swap select-index ;
: call-action ( list -- )
- dup list-value swap list-action call ;
+ dup list-empty? [
+ dup list-value over list-action call
+ ] unless drop ;
list H{
{ T{ button-down } [ request-focus ] }
: slide-by-page ( -1/1 gadget -- )
[ slider-page * ] keep slide-by ;
-: elevator-click ( elevator -- )
- dup hand-click-rel >r find-slider r>
+: page-direction ( elevator -- -1/1 )
+ dup find-slider swap hand-click-rel
over gadget-orientation v.
- over screen>slider over slider-value - sgn
- [ swap slide-by-page ] curry start-timer-gadget ;
+ over screen>slider
+ swap slider-value - sgn ;
+
+: elevator-click ( elevator -- )
+ dup page-direction
+ [ swap find-slider slide-by-page ] curry
+ start-timer-gadget ;
elevator H{
{ T{ button-down } [ elevator-click ] }
"test/gadgets.factor"
"test/models.factor"
"test/document.factor"
+ "test/lists.factor"
"test/rectangles.factor"
"test/commands.factor"
"test/panes.factor"
"test/editor.factor"
"test/search.factor"
+ "test/sliders.factor"
"test/tracks.factor"
} ;
--- /dev/null
+IN: temporary
+USING: gadgets-lists models prettyprint math test ;
+
+[ ] [ f <model> [ ] [ 3 + . ] <list> call-action ] unit-test
make-shelf 1 over set-pack-align ;
! The UI tool
-TUPLE: dataflow-gadget history search ;
+TUPLE: dataflow-gadget history ;
dataflow-gadget "Toolbar" {
{ "Back" T{ key-down f { C+ } "b" } [ dataflow-gadget-history go-back ] }