summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2023-11-07 18:01:54 +1100
committerMaxime Coste <mawww@kakoune.org>2023-11-14 21:39:03 +1100
commit11f0ace9b6bf7cf618a42de7e37d9608d2d86d99 (patch)
tree5ad940ddb9c8286a33dbd86514c6d129df346758 /test
parent719512b308f1d5165037775cb314094f1bb870ad (diff)
Make shell-script-candidates completer run in the background
Read output from the script as it comes and update the candidate list progressively. Disable updating of the list when a completion has been explicitely selected.
Diffstat (limited to 'test')
-rw-r--r--test/regression/0-nothing-selected-on-prompt-initial-shift-tab/cmd2
-rw-r--r--test/regression/0-nothing-selected-on-prompt-initial-shift-tab/rc1
-rw-r--r--test/regression/0-nothing-selected-on-prompt-initial-shift-tab/script6
-rw-r--r--test/shell/prompt-shell-script-candidates/cmd2
-rw-r--r--test/shell/prompt-shell-script-candidates/rc1
-rw-r--r--test/shell/prompt-shell-script-candidates/script7
6 files changed, 17 insertions, 2 deletions
diff --git a/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/cmd b/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/cmd
index 3a6c3b74..8b137891 100644
--- a/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/cmd
+++ b/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/cmd
@@ -1 +1 @@
-:my-command <s-tab><s-tab><ret>
+
diff --git a/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/rc b/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/rc
index 53ad0d14..16ae8a38 100644
--- a/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/rc
+++ b/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/rc
@@ -1 +1,2 @@
+set global autocomplete prompt
def my-command -params 0..1 -shell-script-candidates %{ printf "aaa\nbbb\nccc" } %{ exec i %arg{1} <esc> }
diff --git a/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/script b/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/script
new file mode 100644
index 00000000..f73d1c08
--- /dev/null
+++ b/test/regression/0-nothing-selected-on-prompt-initial-shift-tab/script
@@ -0,0 +1,6 @@
+ui_out -ignore 7
+ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ ":my-command " ] }'
+ui_out -ignore 7
+ui_out '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
+ui_out '{ "jsonrpc": "2.0", "method": "menu_show", "params": [[[{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "aaa" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "bbb" }], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "ccc" }]], { "line": 0, "column": 0 }, { "fg": "white", "bg": "blue", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "white", "underline": "default", "attributes": [] }, "prompt"] }'
+ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "<s-tab><ret>" ] }'
diff --git a/test/shell/prompt-shell-script-candidates/cmd b/test/shell/prompt-shell-script-candidates/cmd
index 7cc38390..8b137891 100644
--- a/test/shell/prompt-shell-script-candidates/cmd
+++ b/test/shell/prompt-shell-script-candidates/cmd
@@ -1 +1 @@
-:foo<ret>b<tab><tab><ret>
+
diff --git a/test/shell/prompt-shell-script-candidates/rc b/test/shell/prompt-shell-script-candidates/rc
index 6aaaf259..82e4e62e 100644
--- a/test/shell/prompt-shell-script-candidates/rc
+++ b/test/shell/prompt-shell-script-candidates/rc
@@ -1,3 +1,4 @@
+set-option global autocomplete prompt
define-command foo %{
prompt -shell-script-candidates %{ printf 'foo\nbar\nhaz\n' } ': ' %{exec i %val{text} <esc>}
}
diff --git a/test/shell/prompt-shell-script-candidates/script b/test/shell/prompt-shell-script-candidates/script
new file mode 100644
index 00000000..231c8725
--- /dev/null
+++ b/test/shell/prompt-shell-script-candidates/script
@@ -0,0 +1,7 @@
+ui_out -ignore 7
+ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ ":foo<ret>b" ] }'
+ui_out -ignore 4
+ui_out '{ "jsonrpc": "2.0", "method": "refresh", "params": [false] }'
+ui_out -ignore 3
+ui_out '{ "jsonrpc": "2.0", "method": "menu_show", "params": [[[{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "bar" }]], { "line": 0, "column": 0 }, { "fg": "white", "bg": "blue", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "white", "underline": "default", "attributes": [] }, "prompt"] }'
+ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "<tab><ret>" ] }'