Remove ineffective attempt of redraw-current-line in Bash integration
The current version attempts to run "redraw-current-line" and "__zoxide_z_complete_helper" by 1) first replacing the keybinding to \[0n to "redraw-current-line", 2) printing \e[5n, 3) replacing the keybinding to \e[0n with "__zoxide_z_complete_helper", and 4) finally printing \e[5n. However, this does not work as expected. This ends up running "__zoxide_z_complete_helper" twice. This is because Bash/Readline processes the next inputs after the current completion finishes. Since the above steps 1-4 are performed inside the completion function, Bash/Readline starts processing the response \e[0n (even if it is immediately returned with zero time) only after the keybinding to \e[0n is replaced with "__zoxide_z_complete_helper". In the first place, Bash/Readline automatically redraws the command line after processing the keybinding with "bind -x", so one does not need to explicitly call "redraw-current-line". This patch simply removes steps 1-2, which did not perform what was expected.
This commit is contained in:
parent
095b270fea
commit
891fa79e06
|
|
@ -157,9 +157,6 @@ if [[ ${BASH_VERSINFO[0]:-0} -eq 4 && ${BASH_VERSINFO[1]:-0} -ge 4 || ${BASH_VER
|
|||
elif [[ -z ${COMP_WORDS[-1]} ]]; then
|
||||
# shellcheck disable=SC2312
|
||||
__zoxide_result="$(\command zoxide query --exclude "$(__zoxide_pwd)" --interactive -- "{{ "${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" }}")" && {
|
||||
\builtin bind '"\e[0n": redraw-current-line'
|
||||
\builtin printf '\e[5n'
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
\builtin bind -x '"\e[0n": __zoxide_z_complete_helper "${result}"'
|
||||
\builtin printf '\e[5n'
|
||||
|
|
|
|||
Loading…
Reference in New Issue