From f224eda78ca4d15239bf0758ea87f5571fb04129 Mon Sep 17 00:00:00 2001 From: Dominik Reh Date: Tue, 11 Oct 2022 23:32:29 +0200 Subject: [PATCH] Added left/right arrow capture Also fixes unexpected insertion behavior when moving after the window opened --- tagAutocomplete.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tagAutocomplete.js b/tagAutocomplete.js index 9186444..82fed8f 100644 --- a/tagAutocomplete.js +++ b/tagAutocomplete.js @@ -250,7 +250,7 @@ function autocomplete(prompt) { } function navigateInList(event) { - validKeys = ["ArrowUp", "ArrowDown", "Enter", "Escape"]; + validKeys = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter", "Escape"]; if (!validKeys.includes(event.key)) return; if (!isVisible) return @@ -270,6 +270,12 @@ function navigateInList(event) { selectedTag = (selectedTag + 1) % resultCount; } break; + case "ArrowLeft": + selectedTag = 0; + break; + case "ArrowRight": + selectedTag = resultCount - 1; + break; case "Enter": if (selectedTag != null) { insertTextAtCursor(results[selectedTag][0], tagword);