Commit Graph

13 Commits (c0315e96d84a9f992d236131783aaecc9117004f)

Author SHA1 Message Date
Eric Freese c0315e96d8 Don't use `-s` option to `zmodload`
It is not available in zsh versions older than 5.3
7 years ago
Eric Freese 5529102afc zpty module is only needed for `completion` strategy 7 years ago
Eric Freese 7d968869e3 Return if no completion found 7 years ago
Eric Freese 1ec43c7291 Fix error when single quote entered into buffer
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`.
7 years ago
Martin Väth 43a011026f Do not leak global variables REPLY and strategy
https://github.com/zsh-users/zsh-autosuggestions/issues/341
7 years ago
Eric Freese b0ffc34fb8 completion should be a local var 7 years ago
Eric Freese 949c374195 Fix `completion` strategy on older versions of zsh
`zpty -r` with a pattern seems to have some funky behavior on older
versions, giving unpredictable results
7 years ago
Eric Freese 973205005c Add spec for `completion` strategy 7 years ago
Eric Freese cf458d2a3b Fix completion suggestions when compinit is not enabled
Need to make sure compinit is called in the pty or the shell hangs
7 years ago
Eric Freese 3dbd9afaec Fix completion strategy killing other pty's
Only a problem in synchronous mode
7 years ago
Eric Freese 6ffaec725a Allow completion suggestions from current shell
The `zsh -f` running in the PTY doesn't know about the non-exported
variables and functions defined in the original shell, thus can't make
suggestions for them. Run local functions in the PTY instead of a new
`zsh` process.

We have to handle things differently based on whether zle is active or
not (async vs. sync mode).
7 years ago
Eric Freese 4cca26ec84 Modify completion code to better fit our needs
Only need the first completion result
7 years ago
Eric Freese 82b08e2dc8 First pass at getting suggestions from completion engine (#111)
Uses https://github.com/Valodim/zsh-capture-completion with some slight
modifications.
7 years ago