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

Keymaps that requires holding down "Shift" to trigger such as "!", "?" or "#" are not working #26

Closed
teknogit opened this issue Dec 15, 2023 · 3 comments

Comments

@teknogit
Copy link

teknogit commented Dec 15, 2023

A keymap that requires holding down "Shift" to generate e.g. "!" or "?" characters will not trigger correctly.

For example, this will fail.

{
    "keybindings": {
        "StockWatch": {
            ...
            "<?>": "ToggleShowHelp", // Shift-/
            "<@>": "DummyAction1", // Shift-1
            "<#>": "DummyAction2",  // Shift-3
            ...
        },
    }
}

But this works:

{
    "keybindings": {
        "StockWatch": {
            ...
            "<Shift-?>": "ToggleShowHelp", 
            "<Shift-@>": "DummyAction1", 
            "<Shift-#>": "DummyAction2",  
            ...
        },
    }
}
@teknogit
Copy link
Author

This modification works fine enough for me to take care of various characters from Shift-1 for "!", Shift-2 for "@"... Shift-0 for ")" on my keyboard.

if c.len() == 1 => {            
            let mut c = c.chars().next().unwrap();
            if modifiers.contains(KeyModifiers::SHIFT) {c = c.to_ascii_uppercase();}
            else if "!@#$%^&*()_+{}|:\"<>?".contains(c) { modifiers.insert(KeyModifiers::SHIFT);}            
            KeyCode::Char(c)
        }

@kdheepak
Copy link
Contributor

kdheepak commented Jan 2, 2024

I'm actually not able to reproduce this issue.

I changed the ratatui-counter example to use ? to "ToggleHelp" and it uses / to EnterInsert mode, and it seems to be working fine for me:

"<?>": "ToggleShowHelp",
"</>": "EnterInsert",

@orhun
Copy link
Sponsor Member

orhun commented May 18, 2024

Closing for now, let us know if this is still an issue!

@orhun orhun closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2024
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

No branches or pull requests

3 participants