Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restrict to certain vim modes #1652

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/prompt_toolkit/key_binding/vi_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def __init__(self) -> None:
#: The Vi mode we're currently in to.
self.__input_mode = InputMode.INSERT

#: Prevent input modes not listed here
self.allowed_input_modes = list(InputMode)

#: Waiting for digraph.
self.waiting_for_digraph = False
self.digraph_symbol1: Optional[str] = None # (None or a symbol.)
Expand Down Expand Up @@ -89,7 +92,8 @@ def input_mode(self, value: InputMode) -> None:
self.operator_func = None
self.operator_arg = None

self.__input_mode = value
if value in self.allowed_input_modes:
self.__input_mode = value

def reset(self) -> None:
"""
Expand Down