[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 04/05: Fix allow-newline? in call-with-truncating-output
From: |
Andy Wingo |
Subject: |
[Guile-commits] 04/05: Fix allow-newline? in call-with-truncating-output-string |
Date: |
Fri, 2 Jun 2023 16:29:50 -0400 (EDT) |
wingo pushed a commit to branch wip-custom-ports
in repository guile.
commit b1913f5e7d37fb0cf34d733a76bc96b48f626beb
Author: Andy Wingo <wingo@pobox.com>
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"