Skip to content

[REPL] printed representations getting mangled (occasionally, but repeatably) #3853

@harold

Description

@harold

Thanks for CIDER! We live inside it and love ❤️ it... -- happy new year to all who celebrate!

Expected behavior

REPL would print verbatim - not dropping any characters in the printed representation

Actual behavior

Seeing characters being omitted, at least sometimes related to newlines in printed representation.

Steps to reproduce the problem

user> (deftype Foo []
        Object
        (toString [this] "[[1 2 3]\n [4 5 6]\n [7 8 9]]"))
user.Foo
user> (defmethod print-method Foo [x writer] (.write writer (.toString x)))
#multifn[print-method 0x61590795]
user> (Foo.)
[[1 2 3]
 [4 5 6]
[7 8 9]]
user> (str (Foo.))
"[[1 2 3]\n [4 5 6]\n [7 8 9]]"

Note: the string has a space after the newline and before [7 8 9], but the actual REPL printed output does not. (!)

Environment & Version information

CIDER version information

;; Connected to nREPL server - nrepl://localhost:40317
;; CIDER 1.20.0 (Lanzarote), nREPL 1.5.1
;; Clojure 1.12.3, Java 21.0.9
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
;;  Startup: /usr/local/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.5.1\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.58.0\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[cider.nrepl/cider-middleware\]\"\]\}\}\} -M:cider/nrepl

Lein / Clojure CLI version

harold@straylight:~$ clj --version
Clojure CLI version 1.12.3.1577

Emacs version

GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.50, cairo version 1.18.4) of 2025-08-28, modified by Debian

Operating system

harold@straylight:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 25.10
Release:	25.10
Codename:	questing

JDK distribution

harold@straylight:~$ java --version
openjdk 21.0.9 2025-10-21
OpenJDK Runtime Environment (build 21.0.9+10-Ubuntu-125.10)
OpenJDK 64-Bit Server VM (build 21.0.9+10-Ubuntu-125.10, mixed mode, sharing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions