From db70e8c52a6ecf6f8cc6c552955bba16e0061ffd Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Sat, 11 Nov 2023 16:51:03 +0000 Subject: [PATCH] Disable enter-accept for bash (#1385) * Disable enter-accept for bash * pretty sure ignoring those lints is correct --- atuin/src/command/client/search/interactive.rs | 4 +++- atuin/src/shell/atuin.bash | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/atuin/src/command/client/search/interactive.rs b/atuin/src/command/client/search/interactive.rs index da6d9cb..167eb23 100644 --- a/atuin/src/command/client/search/interactive.rs +++ b/atuin/src/command/client/search/interactive.rs @@ -64,8 +64,10 @@ struct StyleState { impl State { async fn query_results(&mut self, db: &mut dyn Database) -> Result> { let results = self.engine.query(&self.search, db).await?; + self.results_state.select(0); self.results_len = results.len(); + Ok(results) } @@ -703,7 +705,7 @@ pub async fn history( if index < results.len() { let mut command = results.swap_remove(index).command; - if accept && (utils::is_zsh() || utils::is_fish() || utils::is_bash()) { + if accept && (utils::is_zsh() || utils::is_fish()) { command = String::from("__atuin_accept__:") + &command; } diff --git a/atuin/src/shell/atuin.bash b/atuin/src/shell/atuin.bash index 0c87e42..3da296b 100644 --- a/atuin/src/shell/atuin.bash +++ b/atuin/src/shell/atuin.bash @@ -28,6 +28,7 @@ __atuin_history() { then HISTORY=${HISTORY#__atuin_accept__:} # Reprint the prompt, accounting for multiple lines + # shellcheck disable=SC2046 tput cuu $(echo -n "${PS1@P}" | tr -cd '\n' | wc -c) echo "${PS1@P}$HISTORY" @@ -49,6 +50,7 @@ __atuin_history() { fi fi done + # shellcheck disable=SC2154 __bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command" fi eval "$HISTORY"