diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-20 09:25:58 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-10-21 11:05:49 -0300 |
commit | 264e0d872c598062be2b2a118d38c89a6ed5a023 (patch) | |
tree | cd4867f0e7b4448c33ed9f0141f00a3cb6512569 /runtime/syntax/gitcommit.vim | |
parent | 77cc078c41c4348a3649cc366a262e6fab43980b (diff) | |
download | rneovim-264e0d872c598062be2b2a118d38c89a6ed5a023.tar.gz rneovim-264e0d872c598062be2b2a118d38c89a6ed5a023.tar.bz2 rneovim-264e0d872c598062be2b2a118d38c89a6ed5a023.zip |
event: Remove automatic event deferall
This is how asynchronous events are currently handled by Nvim:
- Libuv event loop is entered when Nvim blocks for user input(os_inchar is
called)
- Any event delivered by libuv that is not user input is queued for processing
- The `K_EVENT` special key code is returned by os_inchar
- `K_EVENT` is returned to a loop that is reading keys for the current Nvim
mode, which will be handled by calling event_process()
This approach has the advantage of integrating nicely with the current
codebase, eg: vimscript code can be executed asynchronously with little
surprises(Its the same as if the user typed a key).
The problem with using keys to represent any event is that it also interferes with
operators, and not every event needs or should do that. For example, consider
this scenario:
- A msgpack-rpc client calls vim_feedkeys("d")
- Nvim processes K_EVENT, pushing "d" to the input queue
- Nvim processes "d", entering operator-pending mode to wait for a motion
- The client calls vim_feedkeys("w"), expecting Nvim to delete a word
- Nvim processes K_EVENT, breaking out of operator-pending and pushing "w"
- Nvim processes "w", moving a word
This commit fixes the above problem by removing all automatic calls to
`event_push`(which is what generates K_EVENT input). Right now this also breaks
redrawing initiated by asynchronous events(and possibly other stuff too, Nvim is
a complex state machine and we can't simply run vimscript code anywhere).
In future commits the calls to `event_push` will be inserted only where it's
absolutely necessary to run code in "key reading loops", such as when executing
vimscript code or mutating editor data structures in ways that currently can
only be done by the user.
Diffstat (limited to 'runtime/syntax/gitcommit.vim')
0 files changed, 0 insertions, 0 deletions