aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoichi Murase <myoga.murase@gmail.com>2024-01-10 22:21:13 +0900
committerGitHub <noreply@github.com>2024-01-10 13:21:13 +0000
commita80ca27cc45270e233f169ba721e63a621ba7351 (patch)
tree95411d0c4a51b5df200ece04d40834070da9f63b
parentdocs: Improve style (#1537) (diff)
downloadatuin-a80ca27cc45270e233f169ba721e63a621ba7351.zip
refactor(shell): refactor and localize `HISTORY => __atuin_output` (#1535)
-rw-r--r--atuin/src/shell/atuin.bash15
-rw-r--r--atuin/src/shell/atuin.zsh1
2 files changed, 9 insertions, 7 deletions
diff --git a/atuin/src/shell/atuin.bash b/atuin/src/shell/atuin.bash
index 8db23b4b..c6967942 100644
--- a/atuin/src/shell/atuin.bash
+++ b/atuin/src/shell/atuin.bash
@@ -135,25 +135,26 @@ __atuin_history() {
fi
fi
- HISTORY=$(ATUIN_SHELL_BASH=t ATUIN_LOG=error atuin search "$@" -i -- "$READLINE_LINE" 3>&1 1>&2 2>&3)
+ local __atuin_output
+ __atuin_output=$(ATUIN_SHELL_BASH=t ATUIN_LOG=error atuin search "$@" -i -- "$READLINE_LINE" 3>&1 1>&2 2>&3)
# We do nothing when the search is canceled.
- [[ $HISTORY ]] || return 0
+ [[ $__atuin_output ]] || return 0
- if [[ $HISTORY == __atuin_accept__:* ]]; then
- HISTORY=${HISTORY#__atuin_accept__:}
+ if [[ $__atuin_output == __atuin_accept__:* ]]; then
+ __atuin_output=${__atuin_output#__atuin_accept__:}
if [[ ${BLE_ATTACHED-} ]]; then
- ble-edit/content/reset-and-check-dirty "$HISTORY"
+ ble-edit/content/reset-and-check-dirty "$__atuin_output"
ble/widget/accept-line
else
- __atuin_accept_line "$HISTORY"
+ __atuin_accept_line "$__atuin_output"
fi
READLINE_LINE=""
READLINE_POINT=${#READLINE_LINE}
else
- READLINE_LINE=$HISTORY
+ READLINE_LINE=$__atuin_output
READLINE_POINT=${#READLINE_LINE}
fi
}
diff --git a/atuin/src/shell/atuin.zsh b/atuin/src/shell/atuin.zsh
index cd076ab9..26294ae9 100644
--- a/atuin/src/shell/atuin.zsh
+++ b/atuin/src/shell/atuin.zsh
@@ -54,6 +54,7 @@ _atuin_search() {
# swap stderr and stdout, so that the tui stuff works
# TODO: not this
+ local output
# shellcheck disable=SC2048
output=$(ATUIN_SHELL_ZSH=t ATUIN_LOG=error atuin search $* -i -- $BUFFER 3>&1 1>&2 2>&3)