diff options
Diffstat (limited to 'src/prompt_toolkit/key_binding/bindings/basic.py')
-rw-r--r-- | src/prompt_toolkit/key_binding/bindings/basic.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/prompt_toolkit/key_binding/bindings/basic.py b/src/prompt_toolkit/key_binding/bindings/basic.py index 084548d..ad18df9 100644 --- a/src/prompt_toolkit/key_binding/bindings/basic.py +++ b/src/prompt_toolkit/key_binding/bindings/basic.py @@ -29,6 +29,16 @@ def if_no_repeat(event: E) -> bool: return not event.is_repeat +@Condition +def has_text_before_cursor() -> bool: + return bool(get_app().current_buffer.text) + + +@Condition +def in_quoted_insert() -> bool: + return get_app().quoted_insert + + def load_basic_bindings() -> KeyBindings: key_bindings = KeyBindings() insert_mode = vi_insert_mode | emacs_insert_mode @@ -171,10 +181,6 @@ def load_basic_bindings() -> KeyBindings: # CTRL keys. - @Condition - def has_text_before_cursor() -> bool: - return bool(get_app().current_buffer.text) - handle("c-d", filter=has_text_before_cursor & insert_mode)( get_by_name("delete-char") ) @@ -240,10 +246,6 @@ def load_basic_bindings() -> KeyBindings: event.current_buffer.insert_text(data) - @Condition - def in_quoted_insert() -> bool: - return get_app().quoted_insert - @handle(Keys.Any, filter=in_quoted_insert, eager=True) def _insert_text(event: E) -> None: """ |