Disable enter-accept for bash (#1385)

* Disable enter-accept for bash

* pretty sure ignoring those lints is correct
This commit is contained in:
Ellie Huxtable 2023-11-11 16:51:03 +00:00 committed by GitHub
parent 31653ed996
commit db70e8c52a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -64,8 +64,10 @@ struct StyleState {
impl State { impl State {
async fn query_results(&mut self, db: &mut dyn Database) -> Result<Vec<History>> { async fn query_results(&mut self, db: &mut dyn Database) -> Result<Vec<History>> {
let results = self.engine.query(&self.search, db).await?; let results = self.engine.query(&self.search, db).await?;
self.results_state.select(0); self.results_state.select(0);
self.results_len = results.len(); self.results_len = results.len();
Ok(results) Ok(results)
} }
@ -703,7 +705,7 @@ pub async fn history(
if index < results.len() { if index < results.len() {
let mut command = results.swap_remove(index).command; 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; command = String::from("__atuin_accept__:") + &command;
} }

View file

@ -28,6 +28,7 @@ __atuin_history() {
then then
HISTORY=${HISTORY#__atuin_accept__:} HISTORY=${HISTORY#__atuin_accept__:}
# Reprint the prompt, accounting for multiple lines # Reprint the prompt, accounting for multiple lines
# shellcheck disable=SC2046
tput cuu $(echo -n "${PS1@P}" | tr -cd '\n' | wc -c) tput cuu $(echo -n "${PS1@P}" | tr -cd '\n' | wc -c)
echo "${PS1@P}$HISTORY" echo "${PS1@P}$HISTORY"
@ -49,6 +50,7 @@ __atuin_history() {
fi fi
fi fi
done done
# shellcheck disable=SC2154
__bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command" __bp_set_ret_value "$preexec_ret_value" "$__bp_last_argument_prev_command"
fi fi
eval "$HISTORY" eval "$HISTORY"