atuin icon indicating copy to clipboard operation
atuin copied to clipboard

Ctrl+Backspace and Alt+Backspace are not working

Open nh2 opened this issue 1 year ago • 5 comments

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:

https://user-images.githubusercontent.com/399535/236631661-f43ac441-5a33-4437-9183-235ab1226f5f.mp4

Alt+Backspace also doesn't work, it deletes 1 character backwards instead of a word as added in e.g. https://github.com/ellie/atuin/issues/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!

nh2 avatar May 06 '23 14:05 nh2

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

YummyOreo avatar May 06 '23 15:05 YummyOreo

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.

nh2 avatar May 06 '23 16:05 nh2

@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 }

YummyOreo avatar May 06 '23 16:05 YummyOreo

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

paul-nameless avatar Feb 22 '24 17:02 paul-nameless

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:

https://github.com/atuinsh/atuin/blob/593dc410eb3d5d7d409b780b9c7bd22ee4aa8654/atuin/src/command/client/search/interactive.rs#L375-L388

iwahbe avatar Feb 28 '24 15:02 iwahbe