Fork me on GitHub
#babashka
<
2022-08-19
>
hairfire14:08:09

I have this simple program:

(ns test-read-line.core)

(def prompt "user> ")
(defn -main [& args]
  (loop []
    (print prompt)
    (flush)
    (let [input (read-line)]
      (when input
        (println (str "input: >>>" input "<<<"))
        (recur)))))
When I execute it without rlwrap I get this:
$ bb -m test-read-line.core
user> hello
input: >>>hello<<<
user>
When I execute it with rlwrap I get this:
$ rlwrap bb -m test-read-line.core
hello
input: >>>hello<<<
user>
Does anyone know why the "user> " before "hello" is deleted when using rlwrap?

1
scgilardi15:08:56

as a data point, I don't see what you see on my Mac using iTerm:

➜  ~ bb -cp . -m test-read-line.core
user> hi
input: >>>hi<<<
user> %

➜  ~ rlwrap bb -cp . -m test-read-line.core
user> hi
input: >>>hi<<<
user>

➜  ~ bb --version
babashka v0.9.161

➜  ~ rlwrap --version
rlwrap 0.45
➜  ~

hairfire15:08:27

I'm running Linux Mint 21. I found this : https://github.com/hanslub42/rlwrap/issues/108 and, using the suggested fix:

thus, adding set enable-bracketed-paste off to my ~/.inputrc fixes the problem
fixes the problem.

babashka 2
hairfire14:08:05

BTW, not surprisingly, the same thing happens with clj