2019-08-06 15:40:53 +02:00
|
|
|
This implements a variation of `s:put` which wraps text based
|
|
|
|
on a maximum width set by the user.
|
|
|
|
|
|
|
|
~~~
|
2020-06-29 21:07:57 +02:00
|
|
|
#80 'WrapAt var-n
|
2019-08-06 15:40:53 +02:00
|
|
|
|
|
|
|
{{
|
|
|
|
'Displayed var
|
|
|
|
:wrap? dup @Displayed + @WrapAt gt? ;
|
|
|
|
:display [ nl !Displayed ] [ &Displayed v:inc-by ] choose s:put sp ;
|
|
|
|
---reveal---
|
2020-06-29 21:07:57 +02:00
|
|
|
:s:put-wrapped (s-)
|
2019-08-06 15:40:53 +02:00
|
|
|
#0 !WrapAt
|
|
|
|
&Heap [ ASCII:SPACE s:tokenize [ dup s:length wrap? display ] a:for-each ] v:preserve ;
|
|
|
|
}}
|
|
|
|
~~~
|