mirror of
https://github.com/atuinsh/atuin.git
synced 2025-08-13 08:57:25 +02:00
Add Alt+backspace and Ctrl+u keybinds for deleting by word and by line, respectively (#243)
* remove unused environment var loading entire history into an env var * Add Alt+backspace and Ctrl+u keybinds for deleting by word and by line, respectively
This commit is contained in:
@ -207,6 +207,23 @@ async fn key_handler(
|
|||||||
app.input.pop();
|
app.input.pop();
|
||||||
query_results(app, search_mode, db).await.unwrap();
|
query_results(app, search_mode, db).await.unwrap();
|
||||||
}
|
}
|
||||||
|
// \u{7f} is escape sequence for backspace
|
||||||
|
Key::Alt('\u{7f}') => {
|
||||||
|
let words: Vec<&str> = app.input.split(' ').collect();
|
||||||
|
if words.is_empty() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
if words.len() == 1 {
|
||||||
|
app.input = String::from("");
|
||||||
|
} else {
|
||||||
|
app.input = words[0..(words.len() - 1)].join(" ");
|
||||||
|
}
|
||||||
|
query_results(app, search_mode, db).await.unwrap();
|
||||||
|
}
|
||||||
|
Key::Ctrl('u') => {
|
||||||
|
app.input = String::from("");
|
||||||
|
query_results(app, search_mode, db).await.unwrap();
|
||||||
|
}
|
||||||
Key::Down | Key::Ctrl('n') => {
|
Key::Down | Key::Ctrl('n') => {
|
||||||
let i = match app.results_state.selected() {
|
let i = match app.results_state.selected() {
|
||||||
Some(i) => {
|
Some(i) => {
|
||||||
|
Reference in New Issue
Block a user