diff options
author | Amjith Ramanujam <amjith.r@gmail.com> | 2023-09-27 08:33:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-27 08:33:32 -0700 |
commit | fbaf48d9f6d9c33794ca25876f851b6318c402a6 (patch) | |
tree | ed45ed686395ba8034745afbb47cac383e4599f5 | |
parent | 5975d2010278fda42aa224be5770113fc15ee28f (diff) | |
parent | 020a1019b6b4bd33851de7886e76e30e179f36c6 (diff) |
Merge pull request #165 from liamhennebury/liamhennebury/right-arrow-completion
Add key binding to accept completion with the right-arrow key
-rw-r--r-- | litecli/key_bindings.py | 8 | ||||
-rw-r--r-- | tests/test_smart_completion_public_schema_only.py | 2 |
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))) ) |