mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-07 03:55:23 +00:00
fix(shell): add space if needed when using smart autocomplete (#200)
This commit is contained in:
parent
690e88dd1a
commit
a74deceb98
@ -4,6 +4,9 @@ function tv_smart_autocomplete() {
|
||||
local output=$(tv --autocomplete-prompt "$current_prompt")
|
||||
|
||||
if [[ -n $output ]]; then
|
||||
# add a space if the prompt does not end with one
|
||||
[[ "${current_prompt}" != *" " ]] && current_prompt="${current_prompt} "
|
||||
|
||||
READLINE_LINE=$current_prompt$output
|
||||
READLINE_POINT=${#READLINE_LINE}
|
||||
fi
|
||||
|
@ -4,6 +4,8 @@ function tv_smart_autocomplete
|
||||
set -l output (tv --autocomplete-prompt "$current_prompt")
|
||||
|
||||
if test -n "$output"
|
||||
# add a space if the prompt does not end with one
|
||||
string match -q "* " -- "$current_prompt" || set current_prompt "$current_prompt "
|
||||
commandline -r "$current_prompt$output"
|
||||
end
|
||||
end
|
||||
|
@ -13,6 +13,8 @@ _tv_smart_autocomplete() {
|
||||
if [[ -n $output ]]; then
|
||||
zle reset-prompt
|
||||
RBUFFER=""
|
||||
# add a space if the prompt does not end with one
|
||||
[[ "${current_prompt}" != *" " ]] && current_prompt="${current_prompt} "
|
||||
LBUFFER=$current_prompt$output
|
||||
|
||||
# uncomment this to automatically accept the line
|
||||
|
Loading…
x
Reference in New Issue
Block a user