ocaml-community / utop

Universal toplevel for OCaml
Other
847 stars 113 forks source link

pasting input into utop #324

Closed nilsbecker closed 4 years ago

nilsbecker commented 4 years ago

Text pasted from the system clipboard is interpreted character-by-character. This generates a lot of unnecessary overhead. For instance, all completion options are shown at each character. As a result, pasting code is slow.

I believe this is a regression introduced in UTop 2.5.0 in order to work around a problem in the new vi edit mode.

kandu commented 4 years ago

Hi, @nilsbecker Sorry for the late response. Would you please record the window so the issue will be exposed more intuitively.

run xwininfo, click the terminal window to get the x, y, width, height info of the window and then byzanz-record -x x -y x -w width -h height -d time record-name.gif or any recorder you prefer.

You may record the pasting processing of utop version 2.3.0, 2.4.0 and 2.5.0 so The issue will be located precisely.

mvanier commented 4 years ago

I'm running utop on Mac OS X and I've noticed this too. I also noticed that the C-y ("yank") keybinding doesn't seem to do anything (even when there is something in the clipboard and Command-y works), though this may be a separate issue.

EDIT: C-y does in fact work in some circumstances. If you do a C-u to kill a line, then C-y recalls it. C-y just doesn't seem to interact with the system clipboard (on both Mac OS X and Linux).

mvanier commented 4 years ago

output

nilsbecker commented 4 years ago

thanks @mvanier for recording, this is what i see as well.

nilsbecker commented 4 years ago

this is a recording with utop 2.4.3. the code example is probably not the best but i hope this shows that pasting is essentially instantaneous.

animation

kandu commented 4 years ago

Thanks for reporting this, @nilsbecker and @mvanier.

I'm running utop on Mac OS X and I've noticed this too. I also noticed that the C-y ("yank") keybinding doesn't seem to do anything (even when there is something in the clipboard and Command-y works), though this may be a separate issue.

EDIT: C-y does in fact work in some circumstances. If you do a C-u to kill a line, then C-y recalls it. C-y just doesn't seem to interact with the system clipboard (on both Mac OS X and Linux).

This is because utop, lambda-term are not x-window or gui system aware. The clipboard, and the upcoming register support are builtin private storage.

mvanier commented 4 years ago

Thanks for the clarification. Since the list of key bindings includes this:

C-y : yank -> paste the contents of the clipboard at current position.

I would argument that the wording is very confusing. Most people will read "clipboard" as "system clipboard" not as "private clipboard for utop that is not related to the system clipboard". This should be a separate issue, though.