preserve margins when using Ctrl-O for newline #9770

Merged
merged 2 commits into from Jul 22, 2016

Projects

None yet

3 participants

@gforsyth
Contributor

This should address ipython/ipython#9588. Control-O will insert a new
line, preserve the current cursor position and preserve the indentation
level on the newline

@gforsyth gforsyth preserve margins when using Ctrl-O for newline
This should address ipython/ipython#9588.  Control-O will insert a new
line, preserve the current cursor position and preserve the indentation
level on the newline
0d8a785
@gforsyth
Contributor

@njsmith -- do you want to try this out and see if it meets your needs?

@takluyver takluyver commented on an outdated diff Jul 16, 2016
IPython/terminal/shortcuts.py
@@ -56,6 +56,10 @@ def register_ipython_shortcuts(registry, shell):
& cursor_in_leading_ws
))(indent_buffer)
+ registry.add_binding(Keys.ControlO,
+ filter=(HasFocus(DEFAULT_BUFFER)
+ & insert_mode))(newline_with_copy_margin)
@takluyver
takluyver Jul 16, 2016 Member

I guess that the filter probably needs to check for Emacs mode too.

@gforsyth
Contributor

@takluyver -- I think this is ready for another look. I removed the insert_mode filter since the emacs mode filter (I think) always overlaps with that.

@takluyver
Member

Thanks. Yes, I think that works - EmacsInsertMode should be effectively emacs & insert.

@takluyver
Member

@njsmith I have given this a quick test, but I'd like you to test that it actually behaves as you want.

@Carreau Carreau added this to the 5.1 milestone Jul 19, 2016
@Carreau
Member
Carreau commented Jul 19, 2016

Marking as 5.1

@Carreau
Member
Carreau commented Jul 22, 2016

Ok, looks good.

@Carreau Carreau merged commit 0c67401 into ipython:master Jul 22, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment