From 6dc655898df34ad424dfc467a8b276fdf31bd791 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 5 Jun 2024 06:45:15 +0200 Subject: Merging upstream version 3.0.46. Signed-off-by: Daniel Baumann --- src/prompt_toolkit/key_binding/bindings/basic.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/prompt_toolkit/key_binding/bindings/basic.py') 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: """ -- cgit v1.2.3