Skip to content

Commit

Permalink
Don't trim spaces for literal newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
yitzchak committed Mar 7, 2024
1 parent 4b8374e commit 8efca53
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions code/pretty-stream.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -562,22 +562,23 @@
last)))
:overflow-lines)
(t
(loop with fragments = (fragments stream)
for index from (1- (length fragments)) downto 0
for fragment = (aref fragments index)
do (typecase fragment
(number
(setf (aref fragments index) nil))
(string
(let ((pos (break-position client stream fragment)))
(cond ((zerop pos)
(setf (aref fragments index) nil))
((= pos (length fragment))
(loop-finish))
(t
(setf (aref fragments index)
(cons fragment pos))
(loop-finish)))))))
(unless (typep instruction 'literal-newline)
(loop with fragments = (fragments stream)
for index from (1- (length fragments)) downto 0
for fragment = (aref fragments index)
do (typecase fragment
(number
(setf (aref fragments index) nil))
(string
(let ((pos (break-position client stream fragment)))
(cond ((zerop pos)
(setf (aref fragments index) nil))
((= pos (length fragment))
(loop-finish))
(t
(setf (aref fragments index)
(cons fragment pos))
(loop-finish))))))))
(write-fragments stream)
(terpri (target stream))
(setf (column stream) 0
Expand Down

0 comments on commit 8efca53

Please sign in to comment.