fix(bash): prevent input to be interpreted as options for blesh auto-complete (#1511)

Apply the change for zsh-autosuggestions in
https://github.com/atuinsh/atuin/pull/1506 to the code for blesh
auto-complete.
This commit is contained in:
Koichi Murase 2024-01-07 01:48:10 +09:00 committed by GitHub
parent 86f2c8e588
commit 179c6d20ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,7 +153,7 @@ if [[ -n "${BLE_VERSION-}" ]] && ((_ble_version >= 400)); then
# #
function ble/complete/auto-complete/source:atuin-history { function ble/complete/auto-complete/source:atuin-history {
local suggestion local suggestion
suggestion=$(atuin search --cmd-only --limit 1 --search-mode prefix "$_ble_edit_str") suggestion=$(atuin search --cmd-only --limit 1 --search-mode prefix -- "$_ble_edit_str")
[[ $suggestion == "$_ble_edit_str"?* ]] || return 1 [[ $suggestion == "$_ble_edit_str"?* ]] || return 1
ble/complete/auto-complete/enter h 0 "${suggestion:${#_ble_edit_str}}" '' "$suggestion" ble/complete/auto-complete/enter h 0 "${suggestion:${#_ble_edit_str}}" '' "$suggestion"
} }