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

SHIFT + TAB KeyEvent is inconsistant between linux and windows #442

Closed
MCord opened this issue Jun 8, 2020 · 1 comment · Fixed by #490
Closed

SHIFT + TAB KeyEvent is inconsistant between linux and windows #442

MCord opened this issue Jun 8, 2020 · 1 comment · Fixed by #490

Comments

@MCord
Copy link

MCord commented Jun 8, 2020

Describe the bug
when in raw mode the KeyEvent that is read for SHIFT + TAB sequence is not the same for linux and windows platforms.

Linux : KeyEvent { code: BackTab, modifiers: NONE }
Windows: KeyEvent { code: BackTab, modifiers: SHIFT }

To Reproduce
Steps to reproduce the behavior:
I have used this code snippet to confirm the issue.

use crossterm::{terminal::{disable_raw_mode, enable_raw_mode}, event::{read, KeyCode, KeyEvent, KeyModifiers}};

fn main() {
    print_events().unwrap();
    disable_raw_mode().unwrap();
}

fn print_events() -> crossterm::Result<()> {
    loop {
        enable_raw_mode()?;

        match read()? {
            crossterm::event::Event::Key(KeyEvent {
                code: KeyCode::Esc, 
                modifiers: KeyModifiers::NONE}) => break,
            x => println!("{:?}", x),
        }
    }
    Ok(())
}

Expected behavior
The same value for both platfroms. Either the linux implementation should return 'SHIFT' as modifier or the windows implementation should return NONE as modifier.

OS
Windows 10 / Ubuntu 18.04.2 LTS

Terminal/Console
CMD / Windows Terminal on Windows
Bash on Ubuntu

@almindor
Copy link

Not sure if related but it seems SHIFT is "broken" in this way along possibly other modifiers? I just found out that trying to respond to a :-press event doesn't work in Windows but works in Linux. The event itself is built without a modifier so I suspect in windows it's being matched to a : + SHIFT modifier but on Linux it's just : + NONE

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.

2 participants