Skip to content

Commit

Permalink
Merge pull request #142 from kshramt/c-z
Browse files Browse the repository at this point in the history
Support suspending with C-z
  • Loading branch information
takluyver committed Oct 24, 2017
2 parents ee120cb + 15fc977 commit bf67a20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jupyter_console/ptshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.document import Document
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
from prompt_toolkit.filters import HasFocus, HasSelection, ViInsertMode, EmacsInsertMode
from prompt_toolkit.filters import Condition, HasFocus, HasSelection, ViInsertMode, EmacsInsertMode
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_output
from prompt_toolkit.interface import CommandLineInterface
Expand All @@ -42,6 +42,7 @@
from prompt_toolkit.keys import Keys
from prompt_toolkit.layout.lexers import PygmentsLexer
from prompt_toolkit.styles import PygmentsStyle
from prompt_toolkit.utils import suspend_to_background_supported

from pygments.styles import get_style_by_name
from pygments.lexers import get_lexer_by_name
Expand Down Expand Up @@ -379,6 +380,10 @@ def _(event):
def _(event):
raise EOFError

@kbmanager.registry.add_binding(Keys.ControlZ, filter=Condition(lambda cli: suspend_to_background_supported()))
def _(event):
event.cli.suspend_to_background()

# Pre-populate history from IPython's history database
history = InMemoryHistory()
last_cell = u""
Expand Down

0 comments on commit bf67a20

Please sign in to comment.