Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirm dialogue doesn't work with non latin alphabet characters #256

Open
kpids opened this issue Apr 20, 2023 · 4 comments · May be fixed by #279
Open

Confirm dialogue doesn't work with non latin alphabet characters #256

kpids opened this issue Apr 20, 2023 · 4 comments · May be fixed by #279

Comments

@kpids
Copy link

kpids commented Apr 20, 2023

I'm using Linux, Pop OS. If I change the keyboard layout to Russian, Ukrainian or Japanese, the confirm dialogue doesn't work.

This can be fixed by checking for a physical key, rather than a literal character. But as far as I've researched this is not a trivial thing to do. I'm not sure how to approach this issue with all the different languages and layouts in mind.

There is also a band aid solution. Just check against multiple characters from different languages.

@Gordon01
Copy link
Contributor

Gordon01 commented Sep 5, 2023

Yeah, I don't like this either. But most of the CLI tools are like this. htop is a good example.
Getting a scancode is possible, but it would require support from console. https://docs.rs/console/latest/console/struct.Term.html

Which is also possible, but I came to an alternative solution:
What if we offer backup keys (like 1 / 0) if we detect a non-ascii char scanned?

So add here: https://github.com/console-rs/dialoguer/blob/master/src/prompts/confirm.rs#L181-L205

Key::Char(c) if !c.is_ascii() => { offer_10(); }

@Gordon01 Gordon01 linked a pull request Sep 11, 2023 that will close this issue
@pksunkara
Copy link
Collaborator

@Gordon01 I am unsure how #279 fixes this. Did I miss something?

@Gordon01
Copy link
Contributor

Alternative keys 1 and 0 would work on any keyboard layout. I don't have any other ideas on how to make confirm dialog work on non-latin keyboards 😔

@pksunkara
Copy link
Collaborator

That makes sense, I missed the "keyboard" in the issue description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants