mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2026-04-25 15:53:27 +02:00
Add feature detection
Checks whether `zpty` gives a file descriptor, which was not the case in older versions of zsh. Based on https://github.com/mafredri/zsh-async/blob/a4b2f81c966a00eeb38876d505d97423cc8addfd/async.zsh#L395-L401
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
# Feature Detection #
|
||||
#--------------------------------------------------------------------#
|
||||
|
||||
_zsh_autosuggest_feature_detect() {
|
||||
typeset -g _ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD
|
||||
typeset -h REPLY
|
||||
|
||||
zpty $ZSH_AUTOSUGGEST_PTY_NAME :
|
||||
|
||||
if (( REPLY )); then
|
||||
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=1
|
||||
else
|
||||
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=0
|
||||
fi
|
||||
|
||||
zpty -d $ZSH_AUTOSUGGEST_PTY_NAME
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
_zsh_autosuggest_start() {
|
||||
add-zsh-hook -d precmd _zsh_autosuggest_start
|
||||
|
||||
_zsh_autosuggest_feature_detect
|
||||
_zsh_autosuggest_check_deprecated_config
|
||||
_zsh_autosuggest_bind_widgets
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user