Permalink
Browse files

fixing issue #56

  • Loading branch information...
1 parent ef03f85 commit 609d83efd325a6d9b89cc6baa182134cb111e7fa Daniel Velkov committed Oct 12, 2011
Showing with 8 additions and 5 deletions.
  1. +7 −4 IPython/core/magic.py
  2. +1 −1 IPython/frontend/terminal/interactiveshell.py
View
11 IPython/core/magic.py
@@ -3187,11 +3187,14 @@ def _get_pasted_lines(self, sentinel):
from IPython.core import interactiveshell
print "Pasting code; enter '%s' alone on the line to stop." % sentinel
while True:
- l = self.shell.raw_input_original(':')
- if l == sentinel:
+ try:
+ l = self.shell.raw_input_original(':')
+ if l == sentinel:
+ return
+ else:
+ yield l
+ except EOFError:
return
- else:
- yield l
def _strip_pasted_lines_for_code(self, raw_lines):
""" Strip non-code parts of a sequence of lines to return a block of
View
2 IPython/frontend/terminal/interactiveshell.py
@@ -487,7 +487,7 @@ def magic_autoindent(self, parameter_s = ''):
def magic_cpaste(self, parameter_s=''):
"""Paste & execute a pre-formatted code block from clipboard.
- You must terminate the block with '--' (two minus-signs) alone on the
+ You must terminate the block with '--' (two minus-signs) or Ctrl-D alone on the
line. You can also provide your own sentinel with '%paste -s %%' ('%%'
is the new sentinel for this operation)

0 comments on commit 609d83e

Please sign in to comment.