wrap.strings: empty strings should wrap as the indent.

db4
John Benediktsson 2013-08-05 11:25:01 -07:00
parent 9aeb3b9579
commit 109b35572f
2 changed files with 3 additions and 1 deletions

View File

@ -47,3 +47,5 @@ word wrap."""
[ "" ] [ "" 10 wrap-string ] unit-test [ "" ] [ "" 10 wrap-string ] unit-test
[ "Hello" ] [ "\nHello\n" 10 wrap-string ] unit-test [ "Hello" ] [ "\nHello\n" 10 wrap-string ] unit-test
{ " > > > " } [ "" 70 " > > > " wrap-indented-string ] unit-test

View File

@ -34,4 +34,4 @@ PRIVATE>
: wrap-indented-string ( string width indent -- newstring ) : wrap-indented-string ( string width indent -- newstring )
make-indent [ length - wrap-lines ] keep make-indent [ length - wrap-lines ] keep
'[ _ prepend ] map! join-lines ; over empty? [ nip ] [ '[ _ prepend ] map! join-lines ] if ;