[Git][cmucl/cmucl][master] 2 commits: Fix #121: fill-pointer-misc off by one for charpos

Raymond Toy (@rtoy) gitlab at common-lisp.net
Thu Dec 16 18:56:55 UTC 2021



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/b93156783b639cabd83aedaddd616b63daf139a3...ca3deab27d85d3fbfbc6d9650b456e8c006e5ef6

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/b93156783b639cabd83aedaddd616b63daf139a3...ca3deab27d85d3fbfbc6d9650b456e8c006e5ef6
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20211216/d065d8bd/attachment-0001.html>


More information about the cmucl-cvs mailing list