0.8.13.44:
authorChristophe Rhodes <csr21@cam.ac.uk>
Mon, 9 Aug 2004 22:00:41 +0000 (22:00 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Mon, 9 Aug 2004 22:00:41 +0000 (22:00 +0000)
One more FORMAT bug for today.
... in ~@< ~@:>, do not induce :FILL newlines for the spaces
following ~<Newline>.

NEWS
src/code/late-format.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 1a89b99..f6cc23b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -41,7 +41,9 @@ changes in sbcl-0.8.14 relative to sbcl-0.8.13:
        values as 0.
     ** literal commas as character parameters to FORMAT directives are
        parsed correctly.
-
+    ** literal spaces directly after ~<Newline> directives within a
+       format-logical-block (~:< ~@:>) do not induce :FILL-style
+       conditional newlines.
 
 changes in sbcl-0.8.13 relative to sbcl-0.8.12:
   * new feature: SB-PACKAGE-LOCKS. See the "Package Locks" section of
index 5a509cd..500bf06 100644 (file)
            insides
            suffix)))
 
-(defun add-fill-style-newlines (list string offset)
-  (if list
-      (let ((directive (car list)))
-       (if (simple-string-p directive)
-           (nconc (add-fill-style-newlines-aux directive string offset)
-                  (add-fill-style-newlines (cdr list)
-                                           string
-                                           (+ offset (length directive))))
-           (cons directive
-                 (add-fill-style-newlines (cdr list)
-                                          string
-                                          (format-directive-end directive)))))
-      nil))
+(defun add-fill-style-newlines (list string offset &optional last-directive)
+  (cond
+    (list
+     (let ((directive (car list)))
+       (cond
+        ((simple-string-p directive)
+         (let* ((non-space (position #\Space directive :test #'char/=))
+                (newlinep (and last-directive
+                               (char=
+                                (format-directive-character last-directive)
+                                #\Newline))))
+           (cond
+             ((and newlinep non-space)
+              (nconc
+               (list (subseq directive 0 non-space))
+               (add-fill-style-newlines-aux
+                (subseq directive non-space) string (+ offset non-space))
+               (add-fill-style-newlines
+                (cdr list) string (+ offset (length directive)))))
+             (newlinep
+              (cons directive
+                    (add-fill-style-newlines
+                     (cdr list) string (+ offset (length directive)))))
+             (t
+              (nconc (add-fill-style-newlines-aux directive string offset)
+                     (add-fill-style-newlines
+                      (cdr list) string (+ offset (length directive))))))))
+        (t
+         (cons directive
+               (add-fill-style-newlines
+                (cdr list) string
+                (format-directive-end directive) directive))))))
+    (t nil)))
 
 (defun add-fill-style-newlines-aux (literal string offset)
   (let ((end (length literal))
index 5a21c5d..17732f1 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.13.43"
+"0.8.13.44"