From 19ffc2c1611e82a4397a98778fbf66430b1171dc Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Mon, 9 Aug 2004 22:00:41 +0000 Subject: [PATCH] 0.8.13.44: One more FORMAT bug for today. ... in ~@< ~@:>, do not induce :FILL newlines for the spaces following ~. --- NEWS | 4 +++- src/code/late-format.lisp | 46 ++++++++++++++++++++++++++++++++------------- version.lisp-expr | 2 +- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index 1a89b99..f6cc23b 100644 --- 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 ~ 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 diff --git a/src/code/late-format.lisp b/src/code/late-format.lisp index 5a509cd..500bf06 100644 --- a/src/code/late-format.lisp +++ b/src/code/late-format.lisp @@ -1036,19 +1036,39 @@ 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)) diff --git a/version.lisp-expr b/version.lisp-expr index 5a21c5d..17732f1 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4