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

Prefer execution when there's only a single line entered #10489

Merged
merged 1 commit into from May 4, 2017

Conversation

@takluyver
Copy link
Member

@takluyver takluyver commented Apr 26, 2017

Closes gh-10425

The heuristic here is to treat a single line specially, and always evaluate it as if the cursor was at the end. An alternative heuristic could be to do this if the cursor is on the last line of the input.

This could also cause some weird effects if you e.g. type for a in range(5):, move the cursor back a few places and press enter - you'll get a newline inserted in the text, but it will indent as if it were after the colon. I'm still trying to think if there's a better way to approach it.

Closes ipythongh-10425

The heuristic here is to treat a single line specially, and always
evaluate it as if the cursor was at the end. An alternative heuristic
could be to do this if the cursor is on the last line of the input.
minrk
minrk approved these changes May 2, 2017
@minrk
Copy link
Member

@minrk minrk commented May 2, 2017

AOK by me. Do you want to merge this as an incremental improvement, or keep thinking before landing this one?

Loading

@takluyver
Copy link
Member Author

@takluyver takluyver commented May 4, 2017

I think let's do this as an incrememental improvement (@Carreau seems enthusiastic, going by #10498 ), and I'll try to keep thinking about it.

Loading

@Carreau
Copy link
Member

@Carreau Carreau commented May 4, 2017

Loading

@Carreau
Copy link
Member

@Carreau Carreau commented May 4, 2017

Loading

@meeseeksdev meeseeksdev bot merged commit bbb0bc2 into ipython:master May 4, 2017
4 checks passed
Loading
@Carreau
Copy link
Member

@Carreau Carreau commented May 4, 2017

@meeseeksdev[bot] backport

Loading

meeseeksdev bot added a commit that referenced this issue May 4, 2017
…entered

Closes gh-10425

The heuristic here is to treat a single line specially, and always evaluate it as if the cursor was at the end. An alternative heuristic could be to do this if the cursor is on the last line of the input.

This could also cause some weird effects if you e.g. type `for a in range(5):`, move the cursor back a few places and press enter - you'll get a newline inserted in the text, but it will indent as if it were after the colon. I'm still trying to think if there's a better way to approach it.
takluyver added a commit that referenced this issue May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants