See technique used in `fast-syntax-highlighting`:
- ca2e18bbc9
- http://www.zsh.org/mla/users/2018/msg00424.html
Also see http://www.zsh.org/mla/users/2018/msg00432.html
In async response handler:
- We only want to read data in case of POLLIN or POLLHUP. Not POLLNVAL
or select error.
- We always want to remove the handler, so it doesn't get called in an
infinite loop when error is nval or err.
There is an upstream bug that prevents ctrl-c from resetting the prompt
immediately after a suggestion has been fetched asynchronously. A patch
has been submitted, but a workaround for now is to add `command true`
after the exec.
See https://github.com/zsh-users/zsh-autosuggestions/issues/364
otherwise users are obliged to set the config values *after* sourcing
the plugin. They're not able to do it before. Also, re-sourcing the
plugin will reset the values to the defaults again.
See zimfw/zimfw#301
Fixes#335
otherwise users are obliged to set the config values *after* sourcing
the plugin. They're not able to do it before. Also, re-sourcing the
plugin will reset the values to the defaults again.
See zimfw/zimfw#301
Fixes#335
We only want to read data in case of POLLIN or POLLHUP. Not POLLNVAL or
select error.
We always want to remove the handler, so it doesn't get called in an
infinite loop when error is nval or err.
In zsh source, see main zle event loop in zle_main.c raw_getbyte
function.
If running in sync mode and a completion takes a long time, the user can
^C out of it. Without this patch, the pty will not be destroyed in this
case and the next time we go to create it, it will fail, making the
shell unusable.
Error looked something like:
```
% echo 'f(zpty):8: unmatched '
_zsh_autosuggest_capture_completion:zpty:9: no such pty command: zsh_autosuggest_completion_pty
_zsh_autosuggest_capture_completion:zpty:14: no such pty command: zsh_autosuggest_completion_pty
_zsh_autosuggest_capture_completion:zpty:21: no such pty command: zsh_autosuggest_completion_pty
```
According to `man zshmodules`, the args to `zpty` are "concatenated with
spaces between, then executed as a command, as if passed to the eval
builtin." So we need to escape the `$` so that `$1` is passed to eval
instead of the value of `$1`.