Handbook
Glossary
section-fits? ( section -- ? )
Factor handbook
»
Developer tools
»
The prettyprinter
»
Extending the prettyprinter
»
Prettyprinter sections
»
Prettyprinter section protocol
Next:
indent-section? ( section -- ? )
Vocabulary
prettyprint
.
sections
Inputs
section
a
section
Outputs
?
a
boolean
Generic word contract
Tests if a section fits in the space that remains on the current line.
Definition
IN:
prettyprint.sections
GENERIC:
section-fits?
( section -- ? )
Methods
USING:
generic
kernel
prettyprint.sections
;
M:
block
section-fits?
line-limit?
[
drop
t
]
[
M\
block
section-fits?
(call-next-method)
]
if
;
USING:
accessors
kernel
math
namespaces
prettyprint.sections
;
M:
section
section-fits?
[
end>>
1
-
pprinter
get
last-newline>>
-
]
[
overhang>>
]
bi
+
text-fits?
;