-
-
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
REPL: newline auto-indents like line above #22948
Conversation
0dd4390
to
33f8f64
Compare
This would be ready to go now. One question is whether auto-indent is the default (my vote is yes). |
Given the 3 upvotes, I will keep auto-indent as the default and will merge in a couple of days if no objecting comment. |
This is very nice! But would be very annoying without #22939 👍 |
I think this messed up pasting repl code: julia> for i = 1:10
println(i)
# didn't need to press tab here!
end
1
2
3
4
5
6
7
8
9
10
julia> for i = 1:10
println(i)
# didn't need to press tab here!
end
1
2
3
4
5
6
7
8
9
10 I typed the first one with the lovely new auto-indent, then cut the whole input and output and pasted it back into the REPL, which resulting in double indents in the pasted code. |
Oups sorry! I will investigate ASAP. |
No worries – lots of moving parts in the REPL code! |
Actually, I see the same behavior in the oldest julia I have from almost 2 months ago; can you confirm that you observe this problem only since this PR? (And I still can't think of a change made here that could break this pasting behavior; but surely needs to be investigated anyway!) |
I have also seen this previously and can repo on an oldish master. |
I've also seen this before (should still be fixed of course). |
Here is something that has to be caused by this: |
Cf. problem reported there: #22948 (comment) Bracket pasting was not removing the indentation corresponding to the prompt (i.e. 7 spaces for "julia> ").
Cf. problem reported there: #22948 (comment) Bracket pasting was not removing the indentation corresponding to the prompt (i.e. 7 spaces for "julia> ").
This is a dumb heuristic, but easily predictable, and probably more useful than the current behavior of placing the cursor at the beginning of the line.
To make it more practical, this is probably conditionned to merging #22939 first, because the pattern of needing to delete 1 indentation (i.e. 4 spaces at a time) would become much more common.