wingo pushed a commit to branch main
in repository guile.
commit 5af66570bb2b4a0f6b47361f9d028d4ef42d8b46
Author: Andy Wingo <[email protected]>
AuthorDate: Fri Jun 2 22:21:23 2023 +0200
Fix allow-newline? in call-with-truncating-output-string
* module/ice-9/pretty-print.scm (call-with-truncating-output-string):
Actually detect newlines.
---
module/ice-9/pretty-print.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/module/ice-9/pretty-print.scm b/module/ice-9/pretty-print.scm
index 21a80e9a5..38d05b7f3 100644
--- a/module/ice-9/pretty-print.scm
+++ b/module/ice-9/pretty-print.scm
@@ -36,7 +36,9 @@
(define (write-string str)
(set! length (+ length (string-length str)))
(set! strs (cons str strs))
- (when (< (- max-column initial-column) length)
+ (when (or (< (- max-column initial-column) length)
+ (and (not allow-newline?)
+ (not (zero? (port-line port)))))
(abort-to-prompt tag)))
(define port
(make-soft-port #:id "truncating-output-port"