Commit graph

13 commits

Author SHA1 Message Date
Eric Freese
6c634c1e35 Enable async mode by default in newer versions of zsh
Allow users to override the default by unsetting (or setting) the
ZSH_AUTOSUGGEST_USE_ASYNC variable.

See GitHub issue #498.
2020-01-26 21:18:49 -07:00
Eric Freese
78e4379711 Fix moving cursor to end of buffer when suggestion accepted
$max_cursor_pos in this case was not the correct value to use. It was
calculated based on the old length of the $BUFFER. After the suggestion
is accepted, we need to recalculate the new max cursor length and use it
to set the $CURSOR.

Fixes issue #452. Follow-up to issue #302 (PR #450).
2019-06-23 12:37:08 -06:00
Eric Freese
b9fee8a324 Allow disabling of automatic widget re-binding
Addresses github #411
2019-04-10 11:43:21 -06:00
Eric Freese
e405afab29 Refactor async mode to no longer use zpty
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
2019-04-09 14:45:22 -06:00
Eric Freese
f0f1332e6b Add after_sourcing hook for tests
Is executed immediately after sourcing the plugin
2018-11-24 09:56:52 -07:00
Eric Freese
a78ea16c50 Support fallback strategies by setting array in config 2018-11-24 09:56:30 -07:00
Eric Freese
62f5f14f2f default => history 2018-11-24 09:56:00 -07:00
Eric Freese
83129dd796 Make asynchronous suggestions disabled by default
While they are still experimental
2017-04-14 08:48:54 -06:00
Eric Freese
ea505b01e5 Add a spec for unlisted widgets fetching a new suggestion 2017-03-03 18:43:10 -05:00
Eric Freese
2cd99e64b7 Add a test for modifying widget list vars after sourcing plugin 2017-02-18 11:15:53 -07:00
Eric Freese
c70d685d15 Clean up widget list spec 2017-02-18 11:12:10 -07:00
Eric Freese
255359dbb8 Use += to be a bit more true to the spec language 2017-02-18 10:35:30 -07:00
Eric Freese
ed8056c5e8 Lots of async changes 2017-02-16 19:19:30 -07:00