-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Indent on new line by looking at the text before the cursor. #10264
Conversation
that would allow edit like the following to insert the right amount of space on the newline (`|` is the cursor) class Bar: def __init__(self):|<enter> self.filed=0 Instead of inserting a blank line with 0 space. Closes ipython#9283
d.cursor_position_row >= d.line_count - d.empty_line_count_at_the_end() | ||
): | ||
b.insert_text('\n' + (' ' * (indent or 0))) | ||
return |
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.
ALso I'm unsure, but it seem to me that this block is completely redundant and can be remove. It is taken care of by the block below. (this is due to the fact that we cut the text at the cursor position, so status
will never be 'ready'
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.
Scratch that.
In [1]: def foo():
...: pass
...: |<enter>
...: def bar():
...: pass
Above example insert a new line with this patch.
Execute if I remove above block.
Closes ipython#9588 Similar to ipython#10264, but with a simpler logic as we never execute.
Closes ipython#9588 Similar to ipython#10264, but with a simpler logic as we never execute.
Closes ipython#9588 Similar to ipython#10264, but with a simpler logic as we never execute.
@meeseeksdev backport to 5.x |
…the cursor. that would allow edit like the following to insert the right amount of space on the newline (`|` is the cursor) class Bar: def __init__(self):|<enter> self.filed=0 Instead of inserting a blank line with 0 space. Closes 9283 --- takluyver can you have a look ?
Backport PR #10264 on branch 5.x
that would allow edit like the following to insert the right amount of
space on the newline (
|
is the cursor)Instead of inserting a blank line with 0 space.
Closes #9283
@takluyver can you have a look ?