Skip to content
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

Merged
merged 1 commit into from
Aug 22, 2017
Merged

Conversation

rfourquet
Copy link
Member

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.

@rfourquet rfourquet added the REPL Julia's REPL (Read Eval Print Loop) label Jul 25, 2017
@rfourquet
Copy link
Member Author

This would be ready to go now. One question is whether auto-indent is the default (my vote is yes).

@rfourquet
Copy link
Member Author

Given the 3 upvotes, I will keep auto-indent as the default and will merge in a couple of days if no objecting comment.

@StefanKarpinski StefanKarpinski merged commit 85cb4a8 into master Aug 22, 2017
@StefanKarpinski StefanKarpinski deleted the rf/repl-newline branch August 22, 2017 13:56
@fredrikekre
Copy link
Member

This is very nice! But would be very annoying without #22939 👍

@StefanKarpinski
Copy link
Sponsor Member

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.

@rfourquet
Copy link
Member Author

Oups sorry! I will investigate ASAP.

@StefanKarpinski
Copy link
Sponsor Member

No worries – lots of moving parts in the REPL code!

@rfourquet
Copy link
Member Author

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!)

@KristofferC
Copy link
Sponsor Member

I have also seen this previously and can repo on an oldish master.

@Keno
Copy link
Member

Keno commented Aug 22, 2017

I've also seen this before (should still be fixed of course).

@fredrikekre
Copy link
Member

Here is something that has to be caused by this:
https://asciinema.org/a/QMnau9w3uZzogut7QfhYct3YP?t=7

rfourquet added a commit that referenced this pull request Aug 23, 2017
Cf. problem reported there:
#22948 (comment)
Bracket pasting was not removing the indentation corresponding
to the prompt (i.e. 7 spaces for "julia> ").
rfourquet added a commit that referenced this pull request Aug 24, 2017
Cf. problem reported there:
#22948 (comment)
Bracket pasting was not removing the indentation corresponding
to the prompt (i.e. 7 spaces for "julia> ").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants