OhMyREPL.jl icon indicating copy to clipboard operation
OhMyREPL.jl copied to clipboard

Paste is extremely slow in Windows

Open MarcMush opened this issue 4 years ago • 3 comments

This is probably th same problem as #113

to reproduce try pasting this in the terminal

t=time()
[0.43912318100061554, 0.2408249629318424, 0.6393827166684662, 0.05552161271079359, 0.8877925867281946, 0.04821241219039485, 0.6166086405675315, 0.07929950085562876, 0.35735580500474606, 0.10135755195766483, 0.8211942651701207, 0.5114543838322341, 0.35195762350172743, 0.5692967957478432, 0.639211345676779, 0.6974275160979715, 0.49284929001053035, 0.41357352755706844, 0.2472478887652465, 0.08655378411138703, 0.12605029882675267, 0.1121537670468189, 0.761864542065076, 0.13496847736678297, 0.43612248275523857, 0.036142418664661946, 0.6469245791018945, 0.18686882848441044, 0.8159413467594498, 0.22306210874102383, 0.6237468503566708, 0.23545710591067004, 0.2823232014262571, 0.9286618330003151, 0.1703116031102465, 0.6514236728451641, 0.38418702246459646, 0.44238831288955316, 0.3759112431110687, 0.3055198789361957, 0.20874452546163935, 0.21915953293957058, 0.23756613108198876, 0.13167152263470427, 0.33758768281843654, 0.510073725666188, 0.47102535916439603, 0.17526518684093495, 0.5640564463933417, 0.01816703759631011, 0.6076174852038867, 0.23897208455624575, 0.2841273398017692, 0.03772303456581083, 0.4372239265885882, 0.7563672765122404, 0.488181670730675, 0.8983245464002554, 0.9369346236486082, 0.8893735030772532, 0.7427259195537133, 0.8685524227902928, 0.9616645835021356, 0.23638070203576245, 0.35588123036831054, 0.5984720413567068, 0.9995327452409797, 0.40358882847937605, 0.3312798588731698, 0.5718834032632476, 0.21005423991549055, 0.21079283878114374, 0.5556469505496051, 0.0019388213845445978, 0.43838091327840667, 0.6612246665147761, 0.5061009063756918, 0.9497455922039302, 0.4561900573663429, 0.9796730770104884, 0.327912692455506, 0.15847598024767162, 0.6288763701948628, 0.6607149953447, 0.17405258302200655, 0.44735230237061163, 0.4279097412129851, 0.014005664515038374, 0.9626901523163278, 0.19327324051854844, 0.39521527979735316, 0.9216371125787401, 0.6462017071694226, 0.33307940494029165, 0.6672066006597677, 0.9774853220411182, 0.673928490949778, 0.05210828051624494, 0.28850457078229774, 0.6051749168924059];
time()-t
#newline

I tested it with julia 1.5.2 as well as julia 1.6.0-rc1, in windows and ubuntu 20.04 in WSL Note that these tests are made in Windows Terminal with Powershell. using the crappy default terminal gives much much worst result (wsl 1.7 is 4s) edit: added test with 1.7.0-beta4

without OhMyREPL, I get:

  • 1.5 : 4.9 s
  • 1.6 : 0.7 s
  • 1.7 : 0.25 s
  • wsl 1.5 : 0.6 s
  • wsl 1.6 : 0.5 s
  • wsl 1.7 : instant 🎉

this is a problem already without OhMyREPL so this might be to fix in REPL ?

well, with OhMyREPL it's way worst, presumably because OhMyREPL recolors everything after each character

  • 1.5 : 42 s !!!
  • 1.6 : 1.7 s
  • 1.7 : 1.2 s
  • wsl 1.5 : 1.8 s
  • wsl 1.6 : 1.5 s
  • wsl 1.7 : instant 🎉

(I have found a potential fix, I will do a PR) edit: #240

MarcMush avatar Feb 24 '21 16:02 MarcMush

Yeah its basically unusable when you try to copy in a large codeblock to vscode.

Since the broken indentation causes the lines to go past the end, it ends up copying the codeblock thousands and thousands of times, completely filling stdout with garbage.

Hopefully gets fixed lol. I stopped using OhMyREPL because of this. Thanks for the PR

anandijain avatar Apr 24 '21 17:04 anandijain

Waiting for a proper fix, I added this to my startup.jl file: it enables Ctrl+V as the “clipboard()” paste (“normal” paste is Ctrl+Shift+V for me): (discussed in discourse)

using OhMyREPL
Base.active_repl.interface = REPL.setup_interface(Base.active_repl; extra_repl_keymap = Dict{Any,Any}(
      "^V" => (s, data, c) -> (REPL.LineEdit.edit_insert(REPL.LineEdit.buffer(s), REPL.InteractiveUtils.clipboard()); OhMyREPL.Prompt.rewrite_with_ANSI(s))
))

MarcMush avatar Apr 26 '21 10:04 MarcMush

related https://github.com/JuliaLang/julia/issues/15787

MarcMush avatar Aug 31 '21 10:08 MarcMush