Skip to content

Commit 0b97478

Browse files
Fixed open_in_editor and suspend key bindings.
1 parent d570e83 commit 0b97478

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

ptpython/key_bindings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ def _(event):
4747
"""
4848
event.app.renderer.clear()
4949

50+
@handle('c-z')
51+
def _(event):
52+
"""
53+
Suspend.
54+
"""
55+
if python_input.enable_system_bindings:
56+
event.app.suspend_to_background()
57+
5058
@handle('f2')
5159
def _(event):
5260
"""

ptpython/python_input.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory, ConditionalAutoSuggest, ThreadedAutoSuggest
1010
from prompt_toolkit.buffer import Buffer
1111
from prompt_toolkit.key_binding.bindings.auto_suggest import load_auto_suggest_bindings
12+
from prompt_toolkit.key_binding.bindings.open_in_editor import load_open_in_editor_bindings
1213
from prompt_toolkit.completion import ThreadedCompleter
1314
from prompt_toolkit.document import Document
1415
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
@@ -564,6 +565,9 @@ def _create_application(self):
564565
load_auto_suggest_bindings(),
565566
load_sidebar_bindings(self),
566567
load_confirm_exit_bindings(self),
568+
ConditionalKeyBindings(
569+
load_open_in_editor_bindings(),
570+
Condition(lambda: self.enable_open_in_editor)),
567571
# Extra key bindings should not be active when the sidebar is visible.
568572
ConditionalKeyBindings(
569573
self.extra_key_bindings,

0 commit comments

Comments
 (0)