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

Ctrl+Backspace and Alt+Backspace are not working #941

Open
nh2 opened this issue May 6, 2023 · 6 comments
Open

Ctrl+Backspace and Alt+Backspace are not working #941

nh2 opened this issue May 6, 2023 · 6 comments

Comments

@nh2
Copy link
Contributor

nh2 commented May 6, 2023

In my Atuin v14.0.1 in gnome-terminal and zsh, Ctrl+Backspace just moves the cursor one to the left instead of deleting as per the documented keybindings:

atuin-ctrl-backspace-not-working.mp4

Alt+Backspace also doesn't work, it deletes 1 character backwards instead of a word as added in e.g. #227

Ctrl+Delete works as described.

Is there some way I may have misconfigured my shell or terminal to brack the Backspace-involving keyboard shortcuts?

Thanks!

@YummyOreo
Copy link
Contributor

YummyOreo commented May 6, 2023

seems like you can't detect ctrl+backspace in a terminal. Although alt+backspace should be detectable

@nh2
Copy link
Contributor Author

nh2 commented May 6, 2023

seems like you can't detect ctrl+backspace in a terminal

@YummyOreo Not sure exactly what you mean.

https://atuin.sh/docs/config/key-binding#atuin-ui-shortcuts lists ctrl + backspace as a shortcut so I guess somebody must have tried it as working on some system.

Although alt+backspace should be detectable

That defintitely is, it works for me right now zsh and skim.

@YummyOreo
Copy link
Contributor

YummyOreo commented May 6, 2023

@YummyOreo Not sure exactly what you mean.

It seems like (at least for my terminal) that if i press ctrl + backspace it does not detect the ctrl.

Here is a simple repo of this:

// main.rs
use crossterm::event::{read, Event, KeyCode};

fn main() -> std::io::Result<()> {
    loop {
        if let Event::Key(key) = read().unwrap() {
            if key.code == KeyCode::Char('q') {
                break;
            }
            println!("{key:?}")
        }
    }

    Ok(())
}
# Cargo.toml
[package]
name = "key"
version = "0.1.0"
edition = "2021"

[dependencies]
crossterm = "0.23"

When I press ctrl+backspace it prints:

KeyEvent { code: Backspace, modifiers: NONE }

@paul-nameless
Copy link

There is the same issue for me on macos and kitty terminal
alt+delete does not delete work though emacs in terminal works fine

@iwahbe
Copy link

iwahbe commented Feb 28, 2024

I'm experience the same issue. option-f and option-b work correctly, but option-DEL doesn't work for me. I get the same behavior on Alacritty and Termanal.app.

It seems like atuin is designed to support this correctly:

KeyCode::Backspace if ctrl => self
.search
.input
.remove_prev_word(&settings.word_chars, settings.word_jump_mode),
KeyCode::Backspace => {
self.search.input.back();
}
KeyCode::Delete if ctrl => self
.search
.input
.remove_next_word(&settings.word_chars, settings.word_jump_mode),
KeyCode::Delete => {
self.search.input.remove();
}

@paul-nameless
Copy link

If you're feeling frustrated because you can't use the Alt + Backspace or Alt + D shortcuts, check out PR #2457

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

4 participants