Skip to content

Commit

Permalink
Merge pull request #4730 from takluyver/i4728
Browse files Browse the repository at this point in the history
Fix stripping continuation prompts when copying from Qt console
  • Loading branch information
minrk committed Dec 22, 2013
2 parents d929163 + 113961b commit 65981cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions IPython/core/inputtransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,7 @@ def classic_prompt():
def ipy_prompt():
"""Strip IPython's In [1]:/...: prompts."""
# FIXME: non-capturing version (?:...) usable?
# FIXME: r'^(In \[\d+\]: | {3}\.{3,}: )' clearer?
prompt_re = re.compile(r'^(In \[\d+\]: |\ \ \ \.\.\.+: )')
prompt_re = re.compile(r'^(In \[\d+\]: |\ {3,}\.{3,}: )')
return _strip_prompts(prompt_re)


Expand Down
5 changes: 5 additions & 0 deletions IPython/core/tests/test_inputtransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ def transform_checker(tests, transformer, **kwargs):
(' ....: print i',' print i'),
(' ....: ', ''),
],
[('In [24]: for i in range(10):','for i in range(10):'),
# Qt console prompts expand with spaces, not dots
(' ...: print i',' print i'),
(' ...: ', ''),
],
[('In [2]: a="""','a="""'),
(' ...: 123"""','123"""'),
],
Expand Down

0 comments on commit 65981cb

Please sign in to comment.