mirror of
https://github.com/atuinsh/atuin.git
synced 2025-01-26 00:00:40 +01:00
refactor(shell): refactor and localize HISTORY => __atuin_output
(#1535)
This commit is contained in:
parent
803b2fed5c
commit
a80ca27cc4
@ -135,25 +135,26 @@ __atuin_history() {
|
|||||||
fi
|
fi
|
||||||
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.
|
# We do nothing when the search is canceled.
|
||||||
[[ $HISTORY ]] || return 0
|
[[ $__atuin_output ]] || return 0
|
||||||
|
|
||||||
if [[ $HISTORY == __atuin_accept__:* ]]; then
|
if [[ $__atuin_output == __atuin_accept__:* ]]; then
|
||||||
HISTORY=${HISTORY#__atuin_accept__:}
|
__atuin_output=${__atuin_output#__atuin_accept__:}
|
||||||
|
|
||||||
if [[ ${BLE_ATTACHED-} ]]; then
|
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
|
ble/widget/accept-line
|
||||||
else
|
else
|
||||||
__atuin_accept_line "$HISTORY"
|
__atuin_accept_line "$__atuin_output"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
READLINE_LINE=""
|
READLINE_LINE=""
|
||||||
READLINE_POINT=${#READLINE_LINE}
|
READLINE_POINT=${#READLINE_LINE}
|
||||||
else
|
else
|
||||||
READLINE_LINE=$HISTORY
|
READLINE_LINE=$__atuin_output
|
||||||
READLINE_POINT=${#READLINE_LINE}
|
READLINE_POINT=${#READLINE_LINE}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ _atuin_search() {
|
|||||||
|
|
||||||
# swap stderr and stdout, so that the tui stuff works
|
# swap stderr and stdout, so that the tui stuff works
|
||||||
# TODO: not this
|
# TODO: not this
|
||||||
|
local output
|
||||||
# shellcheck disable=SC2048
|
# shellcheck disable=SC2048
|
||||||
output=$(ATUIN_SHELL_ZSH=t ATUIN_LOG=error atuin search $* -i -- $BUFFER 3>&1 1>&2 2>&3)
|
output=$(ATUIN_SHELL_ZSH=t ATUIN_LOG=error atuin search $* -i -- $BUFFER 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user