Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Reset readline delimiters after loading rmagic.

Closes gh-2759
  • Loading branch information...
commit 1d350efb7899ca37ea6b474868ac74b82d766495 1 parent e3f3a0c
@takluyver authored
View
4 IPython/core/interactiveshell.py
@@ -358,6 +358,7 @@ def _prompt_trait_changed(self, name, old, new):
# but for now, we can't do that as readline is welded in everywhere.
readline_use = CBool(True, config=True)
readline_remove_delims = Unicode('-/~', config=True)
+ readline_delims = Unicode() # set by init_readline()
# don't use \M- bindings by default, because they
# conflict with 8-bit encodings. See gh-58,gh-88
readline_parse_and_bind = List([
@@ -1866,6 +1867,9 @@ def init_readline(self):
delims = delims.replace(d, "")
delims = delims.replace(ESC_MAGIC, '')
readline.set_completer_delims(delims)
+ # Store these so we can restore them if something like rpy2 modifies
+ # them.
+ self.readline_delims = delims
# otherwise we end up with a monster history after a while:
readline.set_history_length(self.history_length)
View
4 IPython/extensions/rmagic.py
@@ -617,3 +617,7 @@ def R(self, line, cell=None, local_ns=None):
def load_ipython_extension(ip):
"""Load the extension in IPython."""
ip.register_magics(RMagics)
+ # Initialising rpy2 interferes with readline. Since, at this point, we've
+ # probably just loaded rpy2, we reset the delimiters. See issue gh-2759.
+ if ip.has_readline:
+ ip.readline.set_completer_delims(ip.readline_delims)
Please sign in to comment.
Something went wrong with that request. Please try again.