Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUG: Don't use readline in the ZMQShell.

Closes gh-617.
  • Loading branch information...
commit 14ae4c0f28d14eae1e22288e4572484d58c456b6 1 parent 2205dbc
@epatters epatters authored
View
18 IPython/core/interactiveshell.py
@@ -108,6 +108,11 @@ def softspace(file, newvalue):
def no_op(*a, **kw): pass
+class NoOpContext(object):
+ def __enter__(self): pass
+ def __exit__(self, type, value, traceback): pass
+no_op_context = NoOpContext()
+
class SpaceInInput(Exception): pass
class Bunch: pass
@@ -242,6 +247,15 @@ class InteractiveShell(SingletonConfigurable, Magic):
default_value=get_default_colors(), config=True,
help="Set the color scheme (NoColor, Linux, or LightBG)."
)
+ colors_force = CBool(False, help=
+ """
+ Force use of ANSI color codes, regardless of OS and readline
+ availability.
+ """
+ # FIXME: This is essentially a hack to allow ZMQShell to show colors
+ # without readline on Win32. When the ZMQ formatting system is
+ # refactored, this should be removed.
+ )
debug = CBool(False, config=True)
deep_reload = CBool(False, config=True, help=
"""
@@ -1636,10 +1650,12 @@ def init_readline(self):
self.has_readline = False
self.readline = None
# Set a number of methods that depend on readline to be no-op
+ self.readline_no_record = no_op_context
self.set_readline_completer = no_op
self.set_custom_completer = no_op
self.set_completer_frame = no_op
- warn('Readline services not available or not loaded.')
+ if self.readline_use:
+ warn('Readline services not available or not loaded.')
else:
self.has_readline = True
self.readline = readline
View
5 IPython/core/magic.py
@@ -2496,7 +2496,8 @@ def color_switch_err(name):
import IPython.utils.rlineimpl as readline
- if not readline.have_readline and sys.platform == "win32":
+ if not shell.colors_force and \
+ not readline.have_readline and sys.platform == "win32":
msg = """\
Proper color support under MS Windows requires the pyreadline library.
You can find it at:
@@ -2510,7 +2511,7 @@ def color_switch_err(name):
warn(msg)
# readline option is 0
- if not shell.has_readline:
+ if not shell.colors_force and not shell.has_readline:
new_scheme = 'NoColor'
# Set prompt colors
View
9 IPython/zmq/zmqshell.py
@@ -84,13 +84,8 @@ class ZMQInteractiveShell(InteractiveShell):
# Override the traitlet in the parent class, because there's no point using
# readline for the kernel. Can be removed when the readline code is moved
# to the terminal frontend.
-
- # FIXME. This is disabled for now, even though it may cause problems under
- # Windows, because it breaks %run in the Qt console. See gh-617 for more
- # details. Re-enable once we've fully tested that %run works in the Qt
- # console with syntax highlighting in tracebacks.
- # readline_use = CBool(False)
- # /FIXME
+ colors_force = CBool(True)
+ readline_use = CBool(False)
exiter = Instance(ZMQExitAutocall)
def _exiter_default(self):
Please sign in to comment.
Something went wrong with that request. Please try again.