Remove vertical bars in multi-line editing in REPL to make copy-paste easier #17652
Replies: 9 comments 2 replies
-
The vertical bar comes from https://github.com/lampepfl/dotty/blob/3d251d6fd1bb1e98d66760ee50b824861a87ca57/compiler/src/dotty/tools/repl/JLineTerminal.scala#L35 |
Beta Was this translation helpful? Give feedback.
-
I don't have a strong opinion either way, but I do worry that removing the visual indicator will confuse users, since they might not realize that the REPL is waiting for them to input more code. We would need to replace it by another visual indicator that doesn't break copy-paste. |
Beta Was this translation helpful? Give feedback.
-
I guess that just replacing the vertical bar with a space is not enough as the bars are assumed elsewhere, as @som-snytt pointed out, such as error messages, carets etc. Perhaps the .stripMargin needs to be replaced by a smarter .stripSpaceMargin ? |
Beta Was this translation helpful? Give feedback.
-
another idea would be to use a space with a different background color as a visual indicator since copy-pasting should ignore markup. |
Beta Was this translation helpful? Give feedback.
-
Well that might be so, but I have also seen users confused by the vertical bar. "What is that and why is nothing happening???" can still be a reaction.
That would be nice as it would not break copy-paste!! |
Beta Was this translation helpful? Give feedback.
-
Color space as secondary prompt is a very clever idea, as we've come to expect from dotty team. I recall wanting to "compose" in repl like a worksheet and get the result out. Maybe a Also if we keep VBAR, it could blink like a cursor on the current line of input, to make it more obvious that it is waiting. |
Beta Was this translation helpful? Give feedback.
-
😱 |
Beta Was this translation helpful? Give feedback.
-
might be a bit too irritating... |
Beta Was this translation helpful? Give feedback.
-
Another idea: reformat on enter and strip the secondary prompt. Stripping the prompt could be a JLine feature contribution. |
Beta Was this translation helpful? Give feedback.
-
The Scala REPL starts emitting vertical bars when entering multi-line editing (e.g. with incomplete code or Alt+Enter):
This makes copy-paste from REPL to an editor/IDE/Scastie/REPL very tedious as all the bars needs to be removed. We often paste in forums etc and people cannot easily try things out by a simple copy paste from the post.
An indented line with no
scala>
promptiscould be enough as an indication of multi-line editing.Edit: An idea by @smarter from comments below: use another background color as visual cue for multi-line editing mode, which does not affect copy-paste.
Beta Was this translation helpful? Give feedback.
All reactions