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

Added some control code to KeyEvent mappings #506

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

fabi321
Copy link

@fabi321 fabi321 commented Oct 30, 2020

No description provided.

This code is throwing some errors I'm unable to understand. Blaming about b'\x09' and b'\x0d'.
Added some control code to KeyEvent translations.
@TimonPost
Copy link
Member

I tried this branch but it gives me the wrong results. When pressing Backspace only or Backspace with CTRL I get only Backspace. When I change the code to be:

 b'\x7F' => Ok(Some(InternalEvent::Event(Event::Key(KeyEvent::new(
            KeyCode::Backspace,
            KeyModifiers::NONE,
        ))))),
        // Backspace control code
        b'\x08' => Ok(Some(InternalEvent::Event(Event::Key(KeyEvent::new(
            KeyCode::Backspace,
            KeyModifiers::CONTROL,
        ))))),

I do get the correct results. x08 seems to be the CTRL + Backspace while /x7F seems to be the normal backspace.

@fabi321
Copy link
Author

fabi321 commented Nov 3, 2020

That is indeed what you get on the gnome console or Konsole. But in ASCII, 0x08 or ^H is defined as backspace. i.e. if you go to a shell and press ^H or ctrl + backspace, you delete only the last char. if you want to delete the last word on a shell, you need to press ^W. 0x7F is delete according to ASCII.

@fabi321
Copy link
Author

fabi321 commented Nov 3, 2020

Gnome console bug and Konsole bug so it seems like all major Unix terminals have this behavior

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 this pull request may close these issues.

2 participants