From b815e78622eaeef8487fb0f4d084c18f279b8e52 Mon Sep 17 00:00:00 2001
From: Raymond Toy <rtoy@google.com>
Date: Fri, 21 Oct 2011 09:28:16 -0700
Subject: [PATCH] Fix (format t "a~0&b"):  No newline should be printed.

---
 code/format.lisp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/code/format.lisp b/code/format.lisp
index b8a9e76fb..704ec347a 100644
--- a/code/format.lisp
+++ b/code/format.lisp
@@ -1999,9 +1999,10 @@
   (if params
       (expand-bind-defaults ((count 1)) params
 	`(progn
-	   (fresh-line stream)
-	   (dotimes (i (1- ,count))
-	     (terpri stream))))
+	   (when (plusp ,count)
+	     (fresh-line stream)
+	     (dotimes (i (1- ,count))
+	       (terpri stream)))))
       '(fresh-line stream)))
 
 (def-format-interpreter #\& (colonp atsignp params)
@@ -2010,9 +2011,10 @@
 	   :complaint
 	   (intl:gettext "Cannot specify either colon or atsign for this directive.")))
   (interpret-bind-defaults ((count 1)) params
-    (fresh-line stream)
-    (dotimes (i (1- count))
-      (terpri stream))))
+    (when (plusp count)
+      (fresh-line stream)
+      (dotimes (i (1- count))
+	(terpri stream)))))
 
 (def-format-directive #\| (colonp atsignp params)
   (when (or colonp atsignp)
-- 
GitLab