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

feat(search): process [C-h] and [C-?] as representations of backspace #1857

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions atuin/src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,21 @@ impl State {
KeyCode::Backspace => {
self.search.input.back();
}
KeyCode::Char('h' | '?') if ctrl => {
// Depending on the terminal, [Backspace] can be transmitted as
// \x08 or \x7F. Also, [Ctrl+Backspace] can be transmitted as
// \x08 or \x7F or \x1F. On the other hand, [Ctrl+h] and
// [Ctrl+?] are also transmitted as \x08 or \x7F by the
// terminals.
//
// The crossterm library translates \x08 and \x7F to C-h and
// Backspace, respectively. With the extended keyboard
// protocol enabled, crossterm can faithfully translate
// [Ctrl+h] and [Ctrl+?] to C-h and C-?. There is no perfect
// solution, but we treat C-h and C-? the same as backspace to
// suppress quirks as much as possible.
self.search.input.back();
}
KeyCode::Delete if ctrl => self
.search
.input
Expand Down
Loading