deno-cliffy
deno-cliffy copied to clipboard
up down left right don't response
run command
deno run --unstable https://deno.land/x/cliffy/examples/keycode/read_key.ts
up down left right don't response, But the other keys on the area like number keys can use normally.
It lead to the module such as 'checkbox' 'select' which need to use with 'up/down' key can not use conveniently. Change c configuration button parameter were not found either.
It seems like the 'deno' doesn't response to key-press originally.
deno 1.12.2 win10 1809 system locale zh-cn
Hi @Lnncoco, this is a known issue with deno, some special keys do not work on Windows and there is currently no workaround for this. https://github.com/denoland/deno/issues/5945
In the meantime you can use u
and d
for the select and checkbox prompt.
Hi @Lnncoco, this is a known issue with deno, some special keys do not work on Windows and there is currently no workaround for this. denoland/deno#5945 In the meantime you can use
u
andd
for the select and checkbox prompt.
It's not convenient with u
and d
key-press in the actually use. And we need to give the clear prompt to users.
We hope that the settings could be changed, like using the j
and k
key-press.
In addition, it can't make the up and down move with u
and d
when checkbox
use with parameters search
.
u
and d
means up
and down
, someone made a pr to add these aliases. 8
and 2
works for up
and down
too.
But you can also override all keys with the keys
option and show some info with ether the info
or hint
option.
const colors: Array<string> = await Checkbox.prompt({
message: "Pick a color",
options: [
{ name: "Red", value: "#ff0000" },
{ name: "Green", value: "#00ff00" },
{ name: "Blue", value: "#0000ff" },
{ name: "White", value: "#ffffff" },
{ name: "Black", value: "#000000" },
],
keys: {
next: ["down", "j"],
previous: ["up", "k"],
},
info: true,
hint: "Press k or j for up and down.",
});
The info
option prints something like:
ℹ 1/5 Next: ↓, Previous: ↑, Next Page: ⇟, Previous Page: ⇞, Submit: ↵
But the symbols are currently hardcoded, will make a pr to fix this so it will look like this:
ℹ 1/5 Next: ↓, j, Previous: ↑, k, Next Page: ⇟, Previous Page: ⇞, Submit: ↵
With the hint
option you can display any info you want.
Thank
I noticed the fix in #274 is not complete.
Here's a prompt with info: true
? Select a kit module from your repository
❯ azure/bootstrap azure\bootstrap
azure/org azure\org
ℹ 1/2 Next: ↓, d, n, 2, Previous: ↑, u, p, 8, Next Page: ⇟, →, Previous Page: ⇞, ←, Submit: ↵
and here's a prompt with info: true, search: true
? Select a kit module from your repository ⌕
❯ azure/bootstrap azure\bootstrap
azure/org azure\org
ℹ 1/2 Next: ↓, Previous: ↑, Next Page: ⇟, →, Previous Page: ⇞, ←, Submit: ↵
The problem is that the up & down arrows suggested to the user by cliffy don't work. I get why search and u/d keys are incompatible - so for now I'm just disabling search on windows, which provides a very degraded experience.
Not sure what a good fix it, this is really an upstream deno problem.
@c4spar we have an upstream fix in Deno 🎉 https://github.com/denoland/deno/pull/16904
Yep i saw this a few days ago as well thx 👍 Then we can close this issue 🙂