Raymond Toy pushed to branch master at cmucl / cmucl
Commits: bd79fc27 by Raymond Toy at 2021-12-16T18:56:43+00:00 Fix #121: fill-pointer-misc off by one for charpos
- - - - - ca3deab2 by Raymond Toy at 2021-12-16T18:56:43+00:00 Merge branch 'issue-121-fill-pointer-misc' into 'master'
Fix #121: fill-pointer-misc off by one for charpos
Closes #121
See merge request cmucl/cmucl!83 - - - - -
3 changed files:
- src/code/stream.lisp - src/general-info/release-21e.md - tests/issues.lisp
Changes:
===================================== src/code/stream.lisp ===================================== @@ -1928,7 +1928,10 @@ output to Output-stream" (let ((found (position #\newline string :test #'char= :end end :from-end t))) (if found - (- end (the fixnum found)) + ;; END points to where the next character goes, not the + ;; last character. FOUND is where the newline is. + ;; Subtract 1 to adjust for the difference. + (- end (the fixnum found) 1) current))))) (:element-type 'base-char)))
===================================== src/general-info/release-21e.md ===================================== @@ -48,6 +48,7 @@ public domain. * ~~#108~~ Update ASDF * ~~#112~~ CLX can't connect to X server via inet sockets * ~~#113~~ REQUIRE on contribs can pull in the wrong things vai ASDF. + * ~~#121~~ Wrong column index in FILL-POINTER-OUTPUT-STREAM * Other changes: * Improvements to the PCL implementation of CLOS: * Changes to building procedure:
===================================== tests/issues.lisp ===================================== @@ -556,3 +556,17 @@ (assert-equalp 3.0380154777955097d205 (expt 1.7976931348623157d308 0.6666))) + +(define-test issue.121 + (:tag :issues) + ;; Output should only have one newline character in it. Previously, + ;; we printed two. + (assert-equalp + (concatenate 'string "xxx" (string #\Newline)) + (let ((a (make-array 0 :element-type 'character :fill-pointer 0 + :adjustable t))) + (with-output-to-string (s a) + (format s "xxx") + (terpri s) + (fresh-line s)) + a)))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/b93156783b639cabd83aeda...