Fix a handful of bugs

darcs
slava 2006-06-14 06:27:57 +00:00
parent 490c8f4835
commit 23bc02dab6
5 changed files with 9 additions and 6 deletions

View File

@ -58,7 +58,6 @@
- fix listener scroll to
- { } H{ } [ ] tabular-output -- excess newline
- multiple listener-run-files is broken
- word wrap in UI broken again
- table line styles
- x11 input methods
- roundoff is still not quite right with tracks

View File

@ -97,15 +97,13 @@ strings vectors ;
: split-next, V{ } clone , ;
: split-end, building get dup peek empty? [ pop* ] [ drop ] if ;
: (split) ( separator elt -- | separator: elt -- ? )
[ swap call ] keep swap
[ drop split-next, ] [ split,, ] if ; inline
: split* ( seq separator -- split | separator: elt -- ? )
over >r
[ split-next, swap [ (split) ] each-with split-end, ]
[ split-next, swap [ (split) ] each-with ]
{ } make r> swap [ swap like ] map-with ; inline
: split ( seq separators -- split )

View File

@ -24,7 +24,7 @@ SYMBOL: stdio
swap stdio get with-nested-stream ;
: tabular-output ( grid style quot -- )
-rot stdio get with-stream-table ;
swap stdio get with-stream-table ;
: print ( string -- ) stdio get stream-print ;

View File

@ -28,7 +28,7 @@ M: sbuf stream-flush drop ;
M: plain-writer with-stream-table ( grid quot style stream -- )
[
nip swap
drop swap
[ [ swap string-out ] map-with ] map-with
flip [ format-column ] map-last
flip [ " " join ] map

View File

@ -55,6 +55,12 @@ unit-test
[ { "a" "b" "c" "d" "e" "f" } ]
[ "aXbYcXdYeXf" "XY" split ] unit-test
[ { "" "" } ]
[ " " " " split ] unit-test
[ { "hey" } ]
[ "hey" " " split ] unit-test
[ "Hello world" t ] [ "Hello world\n" "\n" ?tail ] unit-test
[ "Hello world" f ] [ "Hello world" "\n" ?tail ] unit-test
[ "" t ] [ "\n" "\n" ?tail ] unit-test