diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 85b6dde361..cb7e28c3b6 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -6,7 +6,6 @@ - outliners don't work - browser responder doesn't work - tests in a loop runs out of memory eventually -- fix word wrap with tables in panes - fix this: diff --git a/doc/handbook/handbook.facts b/doc/handbook/handbook.facts index e280d40fc9..d1cf0a59d8 100644 --- a/doc/handbook/handbook.facts +++ b/doc/handbook/handbook.facts @@ -1,12 +1,11 @@ USING: help inspector parser prettyprint ; ARTICLE: "handbook" "Factor documentation" -"Factor is a dynamically-typed stack based language. I hope you like it." { $subsection "changes" } { $heading "Survival guide" } { $list - { "Load source files using " { $link run-file } ":" } - { $code "\"contrib/httpd/load.factor\" run-file" } + { "Load source files using " { $link run-file } ":" + { $code "\"contrib/httpd/load.factor\" run-file" } } { { $link .s } " prints the contents of the stack." } { { $link . } " prints the object at the top of the stack." } } diff --git a/library/help/markup.factor b/library/help/markup.factor index fd12c4222e..d01f715892 100644 --- a/library/help/markup.factor +++ b/library/help/markup.factor @@ -157,7 +157,8 @@ M: f >link ; : $see-also ( content -- ) "See also" $heading $links ; -: $table ( content -- ) [ print-element ] tabular-output ; +: $table ( content -- ) + [ [ print-element ] tabular-output ] ($block) ; : $values ( content -- ) "Arguments and values" $heading diff --git a/library/ui/gadgets/paragraphs.factor b/library/ui/gadgets/paragraphs.factor index b7110f09be..afbb9ad580 100644 --- a/library/ui/gadgets/paragraphs.factor +++ b/library/ui/gadgets/paragraphs.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2006 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -IN: gadgets -USING: arrays gadgets-labels generic kernel math +IN: gadgets-paragraphs +USING: arrays gadgets gadgets-labels generic kernel math namespaces sequences ; ! A word break gadget @@ -20,22 +20,30 @@ SYMBOL: x SYMBOL: max-x SYMBOL: y SYMBOL: max-y +SYMBOL: line-height + SYMBOL: margin : overrun? ( width -- ? ) x get + margin get >= ; -: wrap-line ( height -- ) 0 x set y [ + ] change ; +: wrap-line ( -- ) + line-height get y +@ + 0 { x line-height } [ set ] each-with ; : wrap-pos ( -- pos ) x get y get 0 3array ; -: advance-x ( x -- ) x [ + dup ] change max-x [ max ] change ; +: advance-x ( x -- ) + x +@ + x get max-x [ max ] change ; -: advance-y ( y -- ) y get + max-y [ max ] change ; +: advance-y ( y -- ) + dup line-height [ max ] change + y get + max-y [ max ] change ; : wrap-step ( quot child -- | quot: pos child -- ) dup pref-dim [ over word-break-gadget? [ - dup first overrun? [ dup second wrap-line ] when + dup first overrun? [ wrap-line ] when ] unless drop wrap-pos rot call ] keep first2 advance-y advance-x ; inline @@ -43,7 +51,7 @@ SYMBOL: margin : init-wrap ( paragraph -- ) paragraph-margin margin set - 0 { x max-x y max-y } [ set ] each-with ; + 0 { x max-x y max-y line-height } [ set ] each-with ; : do-wrap ( paragraph quot -- dim | quot: pos child -- ) [ diff --git a/library/ui/gadgets/presentations.factor b/library/ui/gadgets/presentations.factor index 3642b499d3..152624c30e 100644 --- a/library/ui/gadgets/presentations.factor +++ b/library/ui/gadgets/presentations.factor @@ -1,10 +1,10 @@ ! Copyright (C) 2005, 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: gadgets-presentations -USING: arrays gadgets gadgets-borders -gadgets-buttons gadgets-labels gadgets-outliner -gadgets-panes generic hashtables inspector io kernel prettyprint -sequences strings styles words ; +USING: arrays gadgets gadgets-borders gadgets-buttons +gadgets-labels gadgets-outliner gadgets-panes gadgets-paragraphs +generic hashtables inspector io kernel prettyprint sequences +strings styles words ; ! Clickable objects TUPLE: object-button object ; diff --git a/library/ui/timers.factor b/library/ui/timers.factor index b2a0204e60..4575ed6b40 100644 --- a/library/ui/timers.factor +++ b/library/ui/timers.factor @@ -27,11 +27,8 @@ GENERIC: tick ( ms object -- ) [ timer-last [-] ] 2keep set-timer-last ; : do-timer ( ms timer -- ) - dup next-time pick <= [ - [ advance-timer ] keep timer-object tick - ] [ - 2drop - ] if ; + dup next-time pick <= + [ [ advance-timer ] keep timer-object tick ] [ 2drop ] if ; : do-timers ( -- ) millis timers hash-values [ do-timer ] each-with ;