Skip to content

Commit 29ef64f

Browse files
Use CLI.vi_state.
1 parent 05e8591 commit 29ef64f

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

ptpython/history_browser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@ def create_key_bindings(python_input, history_mapping):
424424
manager = KeyBindingManager(
425425
enable_search=True,
426426
enable_vi_mode=Condition(lambda cli: python_input.vi_mode),
427-
enable_extra_page_navigation=True,
428-
get_vi_state=python_input.key_bindings_manager.get_vi_state)
427+
enable_extra_page_navigation=True)
429428
handle = manager.registry.add_binding
430429

431430
@handle(' ', filter=HasFocus(HISTORY_BUFFER))

ptpython/key_bindings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ def _(event):
8282
event.cli.current_buffer.insert_text(' ')
8383

8484
@handle(Keys.ControlJ, filter= ~sidebar_visible & ~has_selection &
85-
~(vi_mode_enabled &
86-
ViStateFilter(key_bindings_manager.get_vi_state, InputMode.NAVIGATION)) &
85+
~(vi_mode_enabled & ViStateFilter(InputMode.NAVIGATION)) &
8786
HasFocus(DEFAULT_BUFFER) & IsMultiline())
8887
def _(event):
8988
"""

ptpython/layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def toggle_vi_mode(cli, mouse_event):
339339

340340
token = Token.Toolbar.Status
341341

342-
mode = python_input.key_bindings_manager.get_vi_state(cli).input_mode
342+
mode = cli.vi_state.input_mode
343343
result = []
344344
append = result.append
345345

ptpython/python_input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,13 +626,13 @@ def enter_history(self, cli):
626626
"""
627627
Display the history.
628628
"""
629-
self.key_bindings_manager.get_vi_state(cli).input_mode = InputMode.NAVIGATION
629+
cli.vi_state.input_mode = InputMode.NAVIGATION
630630

631631
def done(result):
632632
if result is not None:
633633
cli.buffers[DEFAULT_BUFFER].document = result
634634

635-
self.key_bindings_manager.get_vi_state(cli).input_mode = InputMode.INSERT
635+
cli.vi_state.input_mode = InputMode.INSERT
636636

637637
cli.run_sub_application(create_history_application(
638638
self, cli.buffers[DEFAULT_BUFFER].document), done)

0 commit comments

Comments
 (0)