summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam Hennebury <liamhennebury@gmail.com>2023-09-27 12:20:56 -0300
committerLiam Hennebury <liamhennebury@gmail.com>2023-09-27 12:20:56 -0300
commit020a1019b6b4bd33851de7886e76e30e179f36c6 (patch)
treeed45ed686395ba8034745afbb47cac383e4599f5
parent5975d2010278fda42aa224be5770113fc15ee28f (diff)
Add key binding to accept completion with the right-arrow key
-rw-r--r--litecli/key_bindings.py8
-rw-r--r--tests/test_smart_completion_public_schema_only.py2
2 files changed, 9 insertions, 1 deletions
diff --git a/litecli/key_bindings.py b/litecli/key_bindings.py
index 44d59d2..96eed50 100644
--- a/litecli/key_bindings.py
+++ b/litecli/key_bindings.py
@@ -81,4 +81,12 @@ def cli_bindings(cli):
b = event.app.current_buffer
b.complete_state = None
+ @kb.add("right", filter=completion_is_selected)
+ def _(event):
+ """Accept the completion that is selected in the dropdown menu."""
+ _logger.debug("Detected right-arrow key.")
+
+ b = event.app.current_buffer
+ b.complete_state = None
+
return kb
diff --git a/tests/test_smart_completion_public_schema_only.py b/tests/test_smart_completion_public_schema_only.py
index e532118..c4a076a 100644
--- a/tests/test_smart_completion_public_schema_only.py
+++ b/tests/test_smart_completion_public_schema_only.py
@@ -376,7 +376,7 @@ def test_auto_escaped_col_names(completer, complete_event):
Completion(text="id", start_position=0),
]
+ list(map(Completion, completer.functions))
- + [Completion(text="`select`", start_position=0)]
+ + [Completion(text="select", start_position=0)]
+ list(map(Completion, sorted(completer.keywords)))
)