Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix for issue #56 #861

Merged
merged 3 commits into from Oct 14, 2011
Jump to file or symbol
Failed to load files and symbols.
+9 −5
Split
View
@@ -3187,11 +3187,15 @@ 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:
+ print '<EOF>'
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
@@ -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)