-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable pasted lines to switch to pkg, shell and help repl modes #40604
Enable pasted lines to switch to pkg, shell and help repl modes #40604
Conversation
@@ -76,6 +76,9 @@ end | |||
answer_color(::AbstractREPL) = "" | |||
|
|||
const JULIA_PROMPT = "julia> " | |||
const PKG_PROMPT = "pkg> " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this lands, perhaps Pkg should use this const for constructing the prefix
ffce624
to
0d515aa
Compare
Can I paste in
? |
Ah no, good point. That one needs to be a regex |
@KristofferC I've fixed the pkg prompt with env prefixes, but I didn't see the shell issue coming.. This is the result of pasting in your example. Why isn't the newline executing the echo??
If I then press return I get
|
Pretty sure that is the expected behavior for multiline commands. Not great, I agree, but it is what it is. |
I think the thing to do is to check if the next line is indented to the prompt start, and if so, treat it like a multiline command and add a return at the end to execute it |
0b24cae
to
ee3d6c8
Compare
Multiline shell commands are now handled by identifying them if they are indented in alignment with the prompt. Also, the indented prompts in the docstrings that might show in help mode are ignored until the next non-indented prompt. So indented prompts are still handled as before, just not within a a So pasting this in looks identical after execution
|
84d80a0
to
f7a46cc
Compare
Good to merge? |
…aLang#40604) * allow pasted lines to switch to pkg, shell and help modes
…aLang#40604) * allow pasted lines to switch to pkg, shell and help modes
Currently it's possible to paste
julia> 1+1
into the repl, andjulia>
will be stripped, and the1+1
evaluated, etc.This adds the handling of
pkg>
,shell>
, andhelp?>
prefixes, which are stripped and the mode changed.With this PR, for instance if I copy this
and paste it into the
julia>
repl mode, I get:Note that this only works for pasted text. Typing
pkg> st
into thejulia>
repl won't trigger the same behavior as it is paste-specific like the existingjulia>
prefix handling