dbuenzli / down

An OCaml toplevel (REPL) upgrade
http://erratique.ch/software/down
ISC License
81 stars 3 forks source link

Issue when pasting a long text consisting of large number of lines #37

Closed aqjune closed 4 months ago

aqjune commented 4 months ago

Hi all,

I found down was a useful tool for developing on OCaml REPL, thanks!

So far everything was great, but one glitch that I've found was a long latency when pasting a long text consisting of multiple number of lines.

When the pasted text has multiple lines of code which is more than the number of lines of a terminal screen, the pasting speed is slow and takes a significant amount of time compared to the original OCaml REPL.

I will be happy if the latency issue is fixed, thanks

dbuenzli commented 4 months ago

Can you please share the exact setup in which this happens ? Since v0.2.0 down should implement bracketed pastes see https://github.com/dbuenzli/down/issues/16. But maybe your terminal doesn't support them (or there is an issue in the implemetation).

dbuenzli commented 4 months ago

In fact there an easy way to find out. Have something in your clipboard. For example This is too slow.

Now in the REPL do a:

# Down.Private.tty_test ();;

if when you paste you get:

"This is too slow"

then your terminal supports bracketed pastes.

If not you will get:

"T"
"h"
"i"
"s"
" "
"i"
"s"
" "
"t"
"o"
"o"
" "
"s"
"l"
"o"
"w"
aqjune commented 4 months ago

I am running OCaml REPL on WSL2 and VSCode terminal, According to your test it seems both of these don't support bracketed paste. It was valuable information, thanks for the pointer.

--

Actually, in the VSCode terminal case, the reason seems to be related to the fact that the OCaml REPL process was not a 'plain' one, but one revived from a process-checkpointing tool. VSCode terminal indeed supports bracketed paste. WSL2 terminal does not support bracketed paste though. The process checkpointing was done on WSL2 terminal, so its bracketed paste behavior might be inherited from the property of WSL2 terminal.

--

For anyone who is interested in this issue, this is my record:

dbuenzli commented 4 months ago

Thanks for the details !