adjust `pretty-printing' parameter for single-line printing
make it #f in that case, as opposed to printing in multi-line mode when the content doesn't fit on a single line
This commit is contained in:
parent
1b6b721aee
commit
97d078a156
|
@ -152,7 +152,7 @@
|
|||
(make-parameter (lambda (line port offset width)
|
||||
(when (and (number? width)
|
||||
(not (eq? 0 line)))
|
||||
(newline port))
|
||||
(newline port))
|
||||
0)
|
||||
(lambda (x)
|
||||
(unless (can-accept-n? 4 x)
|
||||
|
@ -653,7 +653,7 @@
|
|||
(expr-found pport ref))
|
||||
(n-k)))))))
|
||||
|
||||
(define (write-custom recur obj pport depth display? width qd)
|
||||
(define (write-custom recur obj pport depth display? width qd multi-line?)
|
||||
(let-values ([(l c p) (port-next-location pport)])
|
||||
(let ([p (relocate-output-port pport l c p)])
|
||||
(port-count-lines! p)
|
||||
|
@ -668,7 +668,7 @@
|
|||
(port-display-handler p displayer)
|
||||
(port-print-handler p printer))
|
||||
(register-printing-port-like p pport)
|
||||
(parameterize ([pretty-printing #t]
|
||||
(parameterize ([pretty-printing multi-line?]
|
||||
[pretty-print-columns (or width 'infinity)])
|
||||
((custom-write-accessor obj) obj p (or qd (not display?)))))))
|
||||
|
||||
|
@ -844,7 +844,7 @@
|
|||
(if (memq kind '(self never))
|
||||
qd
|
||||
(to-quoted out qd obj)))])
|
||||
(write-custom wr* obj pport depth display? width qd)))))]
|
||||
(write-custom wr* obj pport depth display? width qd #f)))))]
|
||||
[(struct? obj)
|
||||
(if (and print-struct?
|
||||
(not (and depth
|
||||
|
@ -1027,7 +1027,7 @@
|
|||
(if (memq kind '(self never))
|
||||
qd
|
||||
(to-quoted out qd obj)))])
|
||||
(write-custom pp* obj pport depth display? width qd))]
|
||||
(write-custom pp* obj pport depth display? width qd #t))]
|
||||
[(struct? obj) ; print-struct is on if we got here
|
||||
(let* ([v (struct->vector obj struct-ellipses)]
|
||||
[pf? (prefab?! obj v)])
|
||||
|
|
|
@ -328,9 +328,10 @@ or @scheme[pretty-display] (or the current output port).}
|
|||
@defboolparam[pretty-printing on?]{
|
||||
|
||||
A parameter that is set to @scheme[#t] when the pretty printer calls a
|
||||
custom-write procedure (see @scheme[prop:custom-write]) for output.
|
||||
When pretty printer calls a custom-write procedure merely to detect
|
||||
cycles, it sets this parameter to @scheme[#f].}
|
||||
custom-write procedure (see @scheme[prop:custom-write]) for output in
|
||||
a mode that supports line breaks. When pretty printer calls a
|
||||
custom-write procedure merely to detect cycles or to try to print on a
|
||||
single line, it sets this parameter to @scheme[#f].}
|
||||
|
||||
|
||||
@defproc[(make-tentative-pretty-print-output-port
|
||||
|
|
Loading…
Reference in New Issue
Block a user