Eric Freese
41657e3565
Revert async process substitution & completion strategy
...
They're not quite ready. Keep them on a feature branch for now.
2018-12-16 20:49:06 -07:00
Eric Freese
b8bf86f6ab
Merge pull request #359 from zsh-users/fixes/async-bad-file-descriptor
...
Fixes/async bad file descriptor
2018-07-13 20:50:31 -07:00
Eric Freese
7ab2124904
Kill async process by id when job control disabled
2018-07-13 21:48:25 -06:00
Eric Freese
88fe824ddf
Add some error handling to 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.
In zsh source, see main zle event loop in zle_main.c raw_getbyte
function.
2018-07-13 11:26:57 -06:00
Eric Freese
93877f6b76
We also need to remove the handler when cancelling async request
...
Should fix GitHub #353
2018-07-13 11:25:59 -06:00
Martin Väth
8ae0283c90
Do not rely on implicit NULLCMD=cat
2018-07-02 12:21:49 -06:00
Eric Freese
cd81522b30
Attempt to kill async worker process when new request comes in
...
See http://www.zsh.org/mla/users/2018/msg00432.html
2018-06-12 23:45:29 -06:00
Eric Freese
9cb0101512
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
2018-06-11 02:12:47 -06:00
Eric Freese
63789e96b5
Fix handling of newline + carriage return in async pty ( #333 )
2018-05-26 14:16:00 -06:00
Eric Freese
df5fb858aa
Destroy old pty even if it's no longer running ( #249 )
...
For unknown reasons, the pty will occasionally quit running. In these
cases, we still want to remove it so that a fresh one can be created. We
don't actually need this check because error messages from `zle` and
`zpty` are redirected to /dev/null.
One sure way to kill all currently running pty's is to run `exit` in a
subshell. Even without zsh-autosuggestions loaded, the following works:
% zmodload zsh/zpty
% zpty -b foo cat
% zpty -b bar cat
% zpty
(31689) bar: cat
(31666) foo: cat
% $(exit)
% zpty
(finished) bar: cat
(finished) foo: cat
2018-05-15 13:55:37 -06:00
Eric Freese
60aff2d944
Remove unused local `$suggestion` variable
2018-03-27 14:51:37 -06:00
Kaleb Elwert
940e10a691
Fix conditionals to use [[ and (( rather than [
...
This fixes a small issue in src/widgets.zsh which makes it so if you
alias [ to g[ (as is done in prezto if the gnu-utility module is loaded)
autosuggestions would fail.
The documentation for GNU test mentions that -o and -a should be avoided
if possible because it's not very clear. Also, with zsh and [[ -o
actually tests if an option is set, which makes this option even more
confusing.
2017-11-27 08:31:41 -07:00
Eric Freese
c9a51e0c4c
Handle dashes at the beginning of commands
2017-02-18 16:51:53 -07:00
Eric Freese
48a21bf79e
[cleanup] Remove an extra newline
2017-02-18 11:27:55 -07:00
Eric Freese
4afbbbadda
We only need to run the feature detection if starting async
2017-02-18 11:25:27 -07:00
Eric Freese
a0fcd81ce1
Destroy zpty on load if it already exists
2017-02-17 22:47:28 -07:00
Eric Freese
9feac573c9
Do not show any error output from async zpty server process
2017-02-16 19:27:32 -07:00
Eric Freese
ed8056c5e8
Lots of async changes
2017-02-16 19:19:30 -07:00
Eric Freese
2c465a932a
Rename async pty name config var
2017-01-29 10:39:07 -07:00
Eric Freese
e3eb286ea2
Lots of little async cleanups
2017-01-27 15:18:26 -07:00
Eric Freese
40bb2e7804
little cleanup
2017-01-26 17:00:56 -07:00
Eric Freese
16666da488
Handle versions of zsh where zpty does not set REPLY to fd of opened pty
...
Based on e702ec4697/async.zsh (L400-L406)
2017-01-26 16:50:19 -07:00
Eric Freese
f33b605a63
Move async initialization into `start` function to keep in one place
2017-01-26 16:40:34 -07:00
Eric Freese
6c5cd42331
Go back to tracking last pid because `kill %1` didn't seem to be working
2017-01-25 00:00:53 -07:00
Eric Freese
21d9eda5dd
Wrap suggestion fetch command in parens to actually run in background
2017-01-24 23:59:38 -07:00
Eric Freese
b3208b08af
Pass the chosen strategy into the suggestion server pty
2017-01-24 22:48:30 -07:00
Eric Freese
e5a5b0c1e0
Output only newlines in the pty
2017-01-24 22:27:09 -07:00
Eric Freese
0337005eb0
Disable word splitting while reading to preserve whitespace
2017-01-24 21:59:22 -07:00
Eric Freese
b530b0c996
Use `zpty -r` with pattern matching to fetch suggestion
2017-01-24 20:01:30 -07:00
Eric Freese
5c891afd48
Reset zsh options inside pty (from zsh-async)
2017-01-24 20:01:27 -07:00
Eric Freese
e33eb570c4
Send only the prefix to the suggestion server
2017-01-24 20:01:11 -07:00
Eric Freese
fba20b042e
Use %1 instead of tracking pid
2017-01-24 20:00:50 -07:00
Eric Freese
0308ed797e
Rename worker to server
2017-01-24 20:00:34 -07:00
Eric Freese
e72c2d87e5
add a bunch of comments
2017-01-24 19:53:59 -07:00
Eric Freese
ab8f295225
First pass at async functionality
2017-01-24 19:45:11 -07:00