| Commit message (Collapse) | Author | Age |
... | |
| |
|
|
|
|
| |
Also disable deferral of attach_ui
|
|
|
|
|
| |
It is necessary to notify the UI when the default background/foreground colors
change in order to render correctly.
|
| |
|
|
|
|
|
| |
This is required to send redraw notifications while a msgpack-rpc call is being
performed by another channel.
|
|
|
|
|
|
| |
- Remove suspend method from the UI protocol
- Handle `:suspend` by disconnecting the last channel that sent a request to
nvim.
|
| |
|
|
|
|
| |
When set to false, nvim will send cterm color numbers with `highlight_set`.
|
| |
|
| |
|
|
|
|
| |
Also don't defer attach_ui handling
|
|
|
|
|
| |
It is necessary to notify the UI when the default background/foreground colors
change in order to render correctly.
|
|
|
|
|
| |
The remote_ui module is an implementation of the UI layer, and it attaches UI
instances that redirect redraw notifications to connected clients.
|
| |
|
|
|
|
|
|
|
|
|
| |
ASAN detected this heap-use-after-free.
A job started by channel_from_job() could terminate and result in a call
to free_channel(), while channel_send_call() was still active/pending
and accessing Channel elements.
Original patch by @tarruda.
|
|
|
|
|
| |
LSAN/ASAN detected, on an error code path, that not all elements of a
struct ChannelCallFrame were freed.
|
| |
|
|
|
|
|
| |
When a job fails to start, it will already call the exit_cb which takes care of
freeing the channel.
|
|
|
|
|
| |
The argument argv of job_start() and channel_from_job() will be
freed. Mark them as such in the comments of this functions.
|
|
|
|
|
|
| |
- When an invalid msgpack RPC msg is received from a channel
we now close that channel all calls on that channel fail with
an error message.
|
| |
|
| |
|
|
|
|
|
| |
- When validating a msgpack msg we need to return on the first error
otherwise we can SEGFAULT with invalid checks
|
|
|
|
|
|
|
|
|
|
| |
It is currently possible for a client to send a response that doesn't match the
current server->client request(at the top of the stack). This commit fixes that
by delaying notifications to until the first `channel_send_call` invocation
returns.
Also remove the "call stack" size check, vim will already break if the call
stack goes too deep.
|
|
|
|
|
| |
Since `mch_exit` will re-enter event_poll, it is necessary to call it outside
libuv event loop.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit @264e0d872c("Remove automatic event deferral") removed the immediate
event queue because event deferral now had to be explicit. The problem is that
while some events don't need to be deferred, they still can result in recursive
`event_poll` calls, and recursion is not supported by libuv. Examples of those
are msgpack-rpc requests while a server->client request is pending, or signals
which can call `mch_exit`(and that will result in `uv_run` calls).
To fix the problem, this reintroduces the immediate event queue for events that
can potentially result in event loop recursion. The non-deferred events are
still processed in `event_poll`, but only after `uv_run` returns.
|
|
|
|
|
|
|
|
| |
If the server fails to start(due to used address for example), the
`server_start` function was freeing the handle memory before it was properly
removed from libuv event loop queue. Fix that by replacing the `free(server)`
call by `uv_close` call, which will take care of freeing the server on the next
event loop iteration. Also replace `EMSG` calls by `ELOG`/`WLOG`.
|
| |
|
|
|
|
|
|
|
|
| |
Passing NULL as the callback for stdout/stderr will result in job_start ignoring
stdout/stderr, respectively. A 'writable' boolean argument was also added, and
when false `job_start` will ignore stdin.
Also, refactor os_system to allow passing NULL as the `output` argument.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Expose more logging control from the log.c module(get log stream and omit
newlines)
- Remove logging from the generated functions in msgpack-gen.lua
- Refactor channel.c/helpers.c to log every msgpack-rpc payload using
msgpack_object_print(a helper function from msgpack.h)
- Remove the api_stringify function, it was only useful for logging msgpack-rpc
which is now handled by msgpack_object_print.
|
|
|
|
|
| |
Free the arguments array after sending the response and also avoid
double-sending responses in cases of errors.
|
|
|
|
|
|
| |
When stdio was closed, parse_msgpack was called with eof == true, with caused a
free_channel call. To ensure the correct behavior for all types of channels, the
close_channel must be called before free_channel.
|
|
|
|
|
|
| |
- Add the api_stringify function to display API objects
- Use api_stringify to display request arguments and return values in DLOG
statements.
|
|
|
|
|
|
| |
All files under the os, api and msgpack_rpc directories have -Wconversion
automatically applied. CONV_SOURCES is also checked for missing files(when
renaming, for example)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since all API functions now run immediately after a msgpack-rpc request is
parsed by libuv callbacks, a mechanism was added to override this behavior and
allow certain functions to run in Nvim main loop.
The mechanism is simple: Any API function tagged with the FUNC_ATTR_DEFERRED (a
"dummy" attribute only used by msgpack-gen.lua) will be called when Nvim main
loop receives a K_EVENT key.
To implement this mechanism it was necessary some restructuration on the
msgpack-rpc modules, especially in the msgpack-gen.lua script.
|
|
|
|
|
|
|
| |
A pattern that is becoming common across the project is to poll for events until
a certain condition is true, optionally passing a timeout. To address this
scenario, the event_poll_until macro was created and the job/channel/input
modules were refactored to use it on their blocking functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
- Remove unused rpc_call_level field
- Add `returned` field to ChannelCallFrame. This is set when the call returns
and is the only condition checked by `channel_send_call`.
- Add job_exit callback for properly closing channels created from job(the
job_exit callback is only called after all read callbacks, so it's the only
safe place to free the channel).
|
|
Create the msgpack_rpc subdirectory and move all modules that deal with
msgpack-rpc to it. Also merge msgpack_rpc.c into msgpack_rpc/helpers.c
|