aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
Commit message (Collapse)AuthorAge
...
* | Linting: Fix strcpy warning.Florian Walch2014-12-24
| |
* | Linting: Fix header guards, add whitespace.Florian Walch2014-12-24
|/
* coverity/74718: invalid FUNC_ATTR_NONNULL_ARGJustin M. Keyes2014-12-20
| | | | | | | - avoid null passed to ELOG format string - receive (char *) internally - modify identifier names for consistency - edit comments for concision and consistency
* input: Recognize mouse events for abstract_uiThiago de Arruda2014-12-10
|
* ui: Add abstract_ui termcap and split UI layerThiago de Arruda2014-12-08
| | | | | | | | | | | | | | | | | | This is how Nvim behaves when the "abstract_ui" termcap is activated: - No data is written/read to stdout/stdin by default. - Instead of sending data to stdout, ui_write will parse the termcap codes and invoke dispatch functions in the ui.c module. - The dispatch functions will forward the calls to all attached UI instances(each UI instance is an implementation of the UI layer and is registered with ui_attach). - Like with the "builtin_gui" termcap, "abstract_ui" does not contain any key sequences. Instead, vim key strings(<cr>, <esc>, etc) are parsed directly by input_enqueue and the translated strings are pushed to the input buffer. With this new input model, its not possible to send mouse events yet. Thats because mouse sequence parsing happens in term.c/check_termcodes which must return early when "abstract_ui" is activated.
* shell: Fix shell command outputThiago de Arruda2014-12-06
| | | | | | | | | Shell command output was broken in @8a5a8db, which refactored nvim to no longer switch to cooked mode(linefeeds are processed differently). Fix the problem by refactoring write_output to accept to extra arguments that control the flushing behavior and where data will be written to: buffer or directly to the screen.
* shell: Remove kShellOptCooked from ShellOptsThiago de Arruda2014-12-03
|
* time: Inline microdelay into os_microdelayThiago de Arruda2014-12-03
|
* term: Remove most calls to settmodeThiago de Arruda2014-12-02
| | | | | | Nvim now relies much less on setting terminal mode to cooked mode, remove most calls to settmode, except for those that happen on startup or when suspending. Eventually even those will be handled by the UI layer.
* Merge pull request #1497 from splinterofchaos/const-attrJustin M. Keyes2014-11-29
|\ | | | | constify and func-attribute memory.c and strings.c
| * strings: Enable -Wconvert.Scott Prager2014-11-27
| |
* | ui: Remove redundant ui.h includesThiago de Arruda2014-11-27
| | | | | | | | Also move read_error_exit to os/input.c
* | ui: Remove ui_inchar/ui_char_availThiago de Arruda2014-11-27
|/ | | | | | | | | Also: - Remove NO_CONSOLE_INPUT/NO_CONSULE preprocessor conditionals - Remove ctrl_c_interrupts variable, check for mapped_ctrl_c directly in process_interrupts() - Move ui_inchar profiling to input_poll which is where Nvim blocks for input.
* event: No longer process K_EVENT automaticallyThiago de Arruda2014-11-21
| | | | | | | Two new functions, `event_enable_deferred()`/`event_disable_deferred()` have to be called by code that is capable of handling asynchronicity. User-dialog states like "press ENTER to continue" or the swap file confirmation no longer will generate K_EVENT.
* input: Refactor to ensure user input has higher priorityThiago de Arruda2014-11-21
|
* Remove os/provider.{c,h} and all of its referencesThiago de Arruda2014-11-18
|
* shell: Use job_write_cb for closing stdinThiago de Arruda2014-11-10
| | | | | | | | | | Commit @45525853d352 removed usage of the `job_write_cb` for closing stdin due to a memory error, but that doesn't work anymore because `job_close_in` closes stdin immediately, possibly trimming input data before it is fully written. Since most memory issues with jobs have been fixed, re-add the `job_write_cb` call to ensure stdin is only closed when it should. Also add tests for scenarios where using the callback makes a difference.
* Try to fix problem found in the Travis Ci build.oni-link2014-11-09
| | | | | | | An uv_pipe_t handle for a WStream could be left open for a particular code path. Patch by tarruda.
* Mark some function arguments as [consumed] in the docs.oni-link2014-11-09
| | | | | The argument argv of job_start() and channel_from_job() will be freed. Mark them as such in the comments of this functions.
* job: Fix memory leak in job_start().oni-link2014-11-09
| | | | | If a new job cannot be started because no slots are free, we return early without freeing the argv argument.
* rstream: Expose rstream_read_ptr and _available.Scott Prager2014-11-07
| | | | | Needed for accessing this information without direct access to the rstream_buffer.
* job: Only force-close stdout/stderr when the job exitsThiago de Arruda2014-11-07
| | | | | stdout/stderr should only be closed after the job truly exits, or else we can lose data sent by it.
* event: Assert that all libuv handles are closed on exit.Thiago de Arruda2014-11-03
| | | | | Travis build will now fail when core files are dumped, so call `abort()` when the event loop is not fully released before exiting.
* event: Do an early return from event_teardown when not initializedThiago de Arruda2014-11-03
|
* event: Ensure the event loop has been cleaned up in event_teardownThiago de Arruda2014-11-02
| | | | | | | | | | - Add input_teardown/signal_teardown to take care of closing signal/stdin handles. - Call those functions in event_teardown, and ensure there are no active handles by entering an infinite loop when there are unclosed handles(think of this as an assertion that can't go unoticed on travis). - Move event_teardown call to the end of mch_exit. That is required because event_poll may still be called in that function.
* event: Reintroduce the immediate event queueThiago de Arruda2014-11-02
| | | | | | | | | | | | | 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.
* event: Rename pending_events to deferred_eventsThiago de Arruda2014-11-02
|
* wstream: Memory allocation improvementsThiago de Arruda2014-11-02
| | | | | | - Rename WriteData to WRequest - Inline uv_write_t into WRequest, avoiding an extra allocation - Manage WBuffer/WRequest instances using klib memory pools
* job: Simplify job_teardown functionThiago de Arruda2014-11-02
| | | | | Remove the current teardown logic and reuse the job top timers with event_poll_until all jobs exit or are killed.
* job: Fix job_wait to properly cleanup the job when it exits.Thiago de Arruda2014-10-31
|
* job: Refactor how job kill timeouts are handledThiago de Arruda2014-10-31
| | | | | | | Use a timer to periodically compare the current HR time against the HR time of when `job_stop` was called. After 1 second, send SIGTERM, after 2 seconds, send SIGKILL. The timer is only active when there's at least one `job_stop` call pending.
* job/shell: Refactor os_call_shell/os_system to share codeThiago de Arruda2014-10-31
|
* rstream: Add rstream_buffer method to get a reference to RBufferThiago de Arruda2014-10-31
|
* shell: Rename dyn_buffer_t to DynamicBufferThiago de Arruda2014-10-31
| | | | To follow our coding conventions
* job: Let job_start callers to selectively ignore stdioThiago de Arruda2014-10-31
| | | | | | | | 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.
* job: Close libuv handles when uv_spawn failsThiago de Arruda2014-10-31
| | | | | | | Commit @709685b4612f4 removed the close_job_* calls when uv_spawn fails because of memory errors when trying to cleanup unitialized {R,W}Stream instances, but the uv_pipe_t instances must be closed because they are added to the event loop queue by previous `uv_pipe_init()` calls
* fs.c: add FUNC_ATTR_NONNULL_ALL to all functionsJustin M. Keyes2014-10-30
|
* api: Add vim_input function and mark vim_feedkeys as deferredThiago de Arruda2014-10-29
| | | | | | | | The `vim_feedkeys` must be deferred because it can potentially free the buffer passed to `os_inchar`(which in turns calls `vim_feedkeys` indirectly). The new `vim_input` function can be used to emulate user input(Since it does not mess with the typeahead, it is safe to execute without deferring).
* input: Fix sizes of input/read buffersThiago de Arruda2014-10-29
| | | | | Input buffer must be bigger than read buffer to ensure it always has space for converted data.
* input/job: process ctrl+c and do conversion in the read callbackThiago de Arruda2014-10-29
| | | | | | | | | - Extract `process_interrupts` out of `convert_input` - Instead of waiting for os_breakcheck/os_inchar calls, call `convert_input` and `process_interrupts` directly from the read callback in input.c. - Remove the `settmode` calls from `job_wait`. Now that interrupts are processed in the event loop, there's no need to set the terminal to cooked which introduces other problems(ref 7.4.427)
* job_start: Do not close in/out/err on error.Scott Prager2014-10-28
| | | | | | The streams job_close_*() reference have not been initialized by the time we call uv_spawn() and libuv closes these pipes for us when spawn() fails.
* input: Fix conversion error in `convert_input()`Thiago de Arruda2014-10-28
| | | | | | | The `rbuffer_consumed` was being passed a consumed count from another buffer, causing integer overflow in `rbuffer_relocate`. Fixes #1343
* job: Only decrease refcount after `settmode` in `job_wait`Thiago de Arruda2014-10-23
| | | | This is required to prevent the scenario explained by @akkartik in #1324
* job: Refactor to ensure that all callbacks will be invokedThiago de Arruda2014-10-23
| | | | | | | | | | | | | | It's possible that a child process won't close it's standard streams, even after it exits. This can be evidenced with the "xclip" program: :call system('xclip -i -selection clipboard', 'DATA') Before this commit, the above command wouldn't return, even though the xclip program had exited. That is because `xclip` wasn't closing it's stdout/stderr streams, which would block pending_refs from ever reaching 0. Now the job.c module was refactored to ensure all streams are closed when the uv_process_t handle is closed.
* debug: Fix broken DLOG macro callsThiago de Arruda2014-10-22
|
* input: Fix ctrl+c handling in convert_inputThiago de Arruda2014-10-22
|
* input: Don't remove Ctrl+C from the input_bufferThiago de Arruda2014-10-21
|
* event: Remove direct calls to `uv_run` from job.c/shell.cThiago de Arruda2014-10-21
|
* compilation: Add -Wconversion to more files and validate CONV_SOURCESThiago de Arruda2014-10-21
| | | | | | 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)
* event: Extract event_poll loops to `event_poll_until` macroThiago de Arruda2014-10-21
| | | | | | | 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.