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

Make Ctrl-d behaviour match other tools #1040

Merged
merged 1 commit into from
Jun 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion atuin/src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl State {
// reset the state, will be set to true later if user really did change it
self.switched_search_mode = false;
match input.code {
KeyCode::Char('c' | 'd' | 'g') if ctrl => return Some(RETURN_ORIGINAL),
KeyCode::Char('c' | 'g') if ctrl => return Some(RETURN_ORIGINAL),
KeyCode::Esc => {
return Some(match settings.exit_mode {
ExitMode::ReturnOriginal => RETURN_ORIGINAL,
Expand Down Expand Up @@ -165,6 +165,12 @@ impl State {
KeyCode::Delete => {
self.search.input.remove();
}
KeyCode::Char('d') if ctrl => {
if self.search.input.as_str().is_empty() {
return Some(RETURN_ORIGINAL);
}
self.search.input.remove();
}
KeyCode::Char('w') if ctrl => {
// remove the first batch of whitespace
while matches!(self.search.input.back(), Some(c) if c.is_whitespace()) {}
Expand Down