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

Separate InputSplitter for transforming whole cells #3203

Merged
merged 4 commits into from Apr 21, 2013

Conversation

takluyver
Copy link
Member

This allows cell magics to include blank lines once again (#3178).

InteractiveShell now has two input splitters:

  • input_splitter is used to determine when a block of input is complete, so you can use a cell magic in the terminal by leaving a blank line at the end.
  • input_transformer_manager is used to transform whole cells, so cell magics affect the whole of their cell.

I removed the similar concept of 'input modes' for InputSplitter, because it was bound to get conflated, and it made the code rather hard to follow.

@takluyver
Copy link
Member Author

I'm going to be away for a couple of days, so if this needs any changes, I'll get onto them when I'm back. But I've verified that it fixes the issue with cell magics containing blank lines.

@minrk
Copy link
Member

minrk commented Apr 20, 2013

Is there a test for the regression? I don't see a test for a cell magic with an empty line.

@takluyver
Copy link
Member Author

The modified CellModeCellMagics test case covers this in a slightly
sideways manner. Specifically, it tests that the input splitter used to
transform whole cells doesn't think the input is complete after a blank
line. A more explicit test for code after a blank line might be worthwhile.

On 20 April 2013 20:34, Min RK notifications@github.com wrote:

Is there a test for the regression? I don't see a test for a cell magic
with an empty line.


Reply to this email directly or view it on GitHubhttps://github.com//pull/3203#issuecomment-16709946
.

@markusbaden
Copy link

This fixes the problem for me, see gist on nbviewer, thanks for the fast fix!

@minrk
Copy link
Member

minrk commented Apr 21, 2013

Since this is important and looks clean enough, I will go ahead and merge. We can add more tests in a later PR.

minrk added a commit that referenced this pull request Apr 21, 2013
Separate InputSplitter for transforming whole cells

This allows cell magics to include blank lines once again (closes #3178).

InteractiveShell now has two input splitters:

- `input_splitter` is used to determine when a block of input is complete, so you can use a cell magic in the terminal by leaving a blank line at the end.
- `input_transformer_manager` is used to transform whole cells, so cell magics affect the whole of their cell.

I removed the similar concept of 'input modes' for InputSplitter, because it was bound to get conflated, and it made the code rather hard to follow.
@minrk minrk merged commit 410df96 into ipython:master Apr 21, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Separate InputSplitter for transforming whole cells

This allows cell magics to include blank lines once again (closes ipython#3178).

InteractiveShell now has two input splitters:

- `input_splitter` is used to determine when a block of input is complete, so you can use a cell magic in the terminal by leaving a blank line at the end.
- `input_transformer_manager` is used to transform whole cells, so cell magics affect the whole of their cell.

I removed the similar concept of 'input modes' for InputSplitter, because it was bound to get conflated, and it made the code rather hard to follow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants