Handbook
Glossary
long-section ( section -- )
Factor handbook
»
Developer tools
»
The prettyprinter
»
Extending the prettyprinter
»
Prettyprinter sections
»
Prettyprinter section protocol
Prev:
short-section ( section -- )
Next:
new-section ( length class -- section )
Vocabulary
prettyprint
.
sections
Inputs
section
a
section
Outputs
None
Generic word contract
Prints a section which spans multiple lines. This should use a layout strategy maximizing readability and minimizing line length. Default implementation calls
short-section
.
Definition
IN:
prettyprint.sections
GENERIC:
long-section
( section -- )
Methods
USING:
accessors
kernel
prettyprint.sections
sequences
;
M:
block
long-section
[
sections>>
chop-break
group-flow
[
dup
?break-group
[
dup
line-break?
[
do-break
]
[
[
advance
]
[
pprint-section
]
bi
]
if
]
each
]
each
]
unless-empty-block
;
USING:
accessors
generic
kernel
prettyprint.sections
;
M:
inset
long-section
dup
narrow?>>
[
[
<fresh-line
]
pprint-sections
]
[
M\
inset
long-section
(call-next-method)
]
if
;
USING:
prettyprint.sections
;
M:
section
long-section
short-section
;