| Commit message (Collapse) | Author | Age |
... | |
|
|
|
|
|
| |
- Properly save job event deferring state for recursive calls
- Disable breakcheck while running. Breakcheck can invoke job callbacks
in unexpected places.
|
|
|
|
|
|
|
|
|
| |
Reported by @fourjay, a codepath that causes event_poll() to run before
event_init() will trigger a segfault as the events list will not have
been initialized. Exiting immediately from event_init() causes nvim to
hang, so just exit before running the events.
fixes #2339
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
event_poll() always leaves the libuv I/O loop after one iteration. The
duration for how long the loop polls for I/O is given by the shortest
timeout of all active timers. Is no timer active, I/O is/could be polled
indefinitely.
To make sure our timer is still active when I/O polling begins,
a prepare handle is used to start the timer right before the polling.
But by only using a timer that restarts after its timeout was reached,
we also can assure that polling is done with (nearly) the same finite
timeout.
For a short explanation how the I/O loop is working, see
http://docs.libuv.org/en/latest/design.html#the-i-o-loop.
|
|
|
|
|
|
|
| |
channel_write() uses a ref-counted buffer for writing. This buffer
should be released if it was used in "refcount" channel_write() calls.
But calling channel_write() on a closed channel would return early and
not decrease the refcount of the used buffer.
|
|
|
|
|
|
| |
This also removes the `#elseif defined(MSWIN)` clause. Due to the
enclosing `if` block, we will never get to this point when src starts with
a '%', making the whole #elseif block dead code.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
- Remove JobActivity autocmd and v:job_data variable
- Simplify `jobstart` to receive:
- An argument vector
- An optional dictionary which may contain any of the current `jobstart`
options plus `on_stdout`, `on_stderr` and `on_exit` callbacks.
- Refactor and add more job tests
- Update documentation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of selecting stderr on startup if stdin is not a tty, first try reading
from it and only switch to stderr when reading fails. With this behavior we
support commands like:
```
echo q | nvim -es
```
and
```
ls *.md | xargs nvim
```
Fixed small bugs in rstream.c to make this happen.
|
|
|
|
|
|
| |
Since all reads are queued by the event loop, we must also queue the exit event,
or else the process_close function can close the job streams before received
data is processed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit integrates libvterm with Neovim and implements a terminal emulator
with nvim buffers as the display mechanism. Terminal buffers can be created
using any of the following methods:
- Opening a file with name following the "term://[${cwd}//[${pid}:]]${cmd}"
URI pattern where:
- cwd is the working directory of the process
- pid is the process id. This is just for use in session files where a pid
would have been assigned to the saved buffer title.
- cmd is the command to run
- Invoking the `:terminal` ex command
- Invoking the `termopen` function which returns a job id for automating the
terminal window.
Some extra changes were also implemented to adapt with terminal buffers. Here's
an overview:
- The `main` function now sets a BufReadCmd autocmd to intercept the term:// URI
and spawn the terminal buffer instead of reading the file.
- terminal buffers behave as if the following local buffer options were set:
- `nomodifiable`
- `swapfile`
- `undolevels=-1`
- `bufhidden=hide`
- All commands that delete buffers(`:bun`, `:bd` and `:bw`) behave the same for
terminal buffers, but only work when bang is passed(eg: `:bwipeout!`)
- A new "terminal" mode was added. A consequence is that a new set of mapping
commands were implemented with the "t" prefix(tmap, tunmap, tnoremap...)
- The `edit` function(which enters insert mode) will actually enter terminal
mode if the current buffer is a terminal
- The `put` operator was adapted to send data to the terminal instead of
modifying the buffer directly.
- A window being resized will also trigger a terminal resize if the window
displays the terminal.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This commit pulls the some environment-variable handling functions out of
misc1.c and in to os/env.c. Previously submited as #1231, this is the start of
a patch series that does that work based on a more up-to-date master branch.
Major tasks accomplished:
- move functions and fix includes
- fix clint/clang analysis warnings
- correct documentation comments
|
|
|
|
|
| |
Fix pointer passed to the handles in the uv_close() calls when process_spawn()
fails.
|
|
|
|
|
| |
Add a SIGCHLD handler for cleaning up pty processes passing the WNOHANG flag. It
may also be used to cleanup processes spawned with uv_spawn.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem : Resource leak @ 94, 98, 102.
Diagnostic : Real issue.
Rationale : Coverity doesn't know that uv_pipe_open will save file
descriptor to close them later. So, it signals file
descriptors being leaked. This would then seem like a false
positive we can fix by teaching coverity about uv_pipe_open
through model file.
But then we realize that the above is only true if
uv_pipe_open succeeds. It it fails, then descriptors are
really being leaked, which is why this is considered a real
issue and not a false positive after all.
Resolution : Add error handling to correctly close descriptors if
uv_pipe_open fails at any point.
Add model for uv_pipe_open so that Coverity knows it will
save descriptors when no error.
Helped-by: oni-link <knil.ino@gmail.com>
|
|
|
|
|
|
|
|
|
| |
Problem : Unchecked return value from library @ 91.
Diagnostic : Real issue.
Rationale : fcntl can fail, which is not being checked.
Resolution : Add corresponding error handling.
Helped-by: oni-link <knil.ino@gmail.com>
|
|\
| |
| | |
Fix a couple warnings in the release build.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A read stream will be started before the first ex command is processed. This
stream will be used to read early user input before handling control over to the
UI module.
Which stdio stream will be used depends on which types of file descriptors are
connected, and whether the "-" argument was passed.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Even though assuming nvim is busy most times is simpler, it has a problem: A lot
of unnecessary busy_start/busy_stop notifications are sent to the UI. That's
because in the majority of scenarios almost no time is spent between
`event_poll` calls.
This restores the normal behavior which is to call busy_start only when nvim is
going to perform some task that can take a significant amount of time. Also
improve the usage of buffering in the TUI when changing the cursor state.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Switching cursor off is only necessary in two occasions:
- When redrawing to avoid terminal flickering
- When the editor is busy
The first can now be handled by the TUI, so most calls to ui_cursor_off can be
removed from the core.
So, before this commit it was only necessary to switch the cursor off to notify
the user that nvim was running some long operation. Now the cursor_{on,off}
functions have been replaced by busy_{stop,start} which can be handled in a
UI-specific way(turning the cursor off or showing a busy indicator, for
example).
To make things even more simpler, nvim is always busy except when waiting for
user input or other asynchronous events: It automatically switches to a non-busy
state when the event loop is about to be entered for more than 100 milliseconds.
`ui_busy_start` can be called when its not desired to change the busy state in
the event loop (As its now done by functions that perform blocking shell
invocations).
|
|\
| |
| | |
Fixes for two compiler warnings
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Compiler warns about buf always being nonnull.
buf is per function attribute always nonnull, so buf can be removed from
the assert(). But a buffer length of zero is also no problem, because it
makes uv_cwd() return a failure without writing into buf. So the
remaining length check can also be removed.
|
|/
|
|
|
|
| |
these path names are ridiculous...
Based on #889, but also remove some unused #defines
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
- process spawning was decoupled from the rest of the job control logic. The
goal is reusing it for spawning processes connected to pseudo terminal file
descriptors.
- job_start now receives a JobOptions structure containing all the startup
options.
|
|
|
|
|
| |
Send sigterm immediately since it can be caught by processes. If they don't
respond and are still alive after a while, SIGKILL will be sent.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Removed term.c, term.h and term_defs.h
- Tests for T_* values were removed. screen.c was simplified as a
consequence(the best strategy for drawing is implemented in the UI layer)
- Redraw functions now call ui.c functions directly. Updates are flushed with
`ui_flush()`
- Removed all termcap options(they now return empty strings for compatibility)
- &term/&ttybuiltin options return a constant value(nvim)
- &t_Co is still available, but it mirrors t_colors directly
- Remove cursor tracking from screen.c and the `screen_start` function. Now the
UI is expected to maintain cursor state across any call, and reset it when
resized.
- Remove unused code
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Remove abstract_ui global, now it is always active
- Remove some terminal handling code
- Remove unused functions
- Remove HAVE_TGETENT/TERMINFO/TERMIOS/IOCTL #ifdefs
- Remove tgetent/terminfo from version.c
- Remove curses/terminfo dependencies
- Only start/stop termcap when starting/exiting the program
- msg_use_printf will return true if there are no attached UIs(
messages will be written to stdout)
- Remove `ex_winpos`(implement `:winpos` with `ex_ni`)
|
|
|
|
|
|
|
| |
The input buffer is only used for data that really came from another process and
is only visible to os/input.c. Remove the input_buffer_{save,restore} functions,
they are not necessary(Also can result in problems if data comes while the
typeahead is saved).
|
|
|
|
| |
Ignore all keys that aren't prefixed with KS_EXTRA.
|
|
|
|
| |
This is required to correctly handle certain keys such as <delete>
|
|
|
|
|
|
|
|
|
| |
Problem : Read from pointer after free @ {242, 391}.
Diagnostic : Real issues.
Rationale : Channel gets indeed freed on error case, producing
incorrect accesses to freed pointer later on.
Resolution : Implement reference counting mechanism to know when to free
channel.
|
| |
|
|\
| |
| | |
job.c: Prevent early return from job_wait().
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A blocking call job_wait(job, -1) can only return after job is finished
and all handles of job are closed. But hitting CTRL-C makes job_wait()
return early while handles can still be open. This can lead to problems
with the job/handle callbacks if the caller (of job_wait()) already
freed the memory that is used in the job callbacks.
To fix this, only return after all handles of the job are closed.
|
| |
| |
| |
| | |
Must check for EOF which will result in row/col being uninitialized.
|
| | |
|
| |
| |
| |
| |
| | |
By calling ui_write directly, the internal screen isn't updated and invalid
bytes aren't handled, which breaks the abstract UI model.
|
| |
| |
| |
| |
| | |
Ignoring invalid key sequences simplifies input handling in UIs. The only
downside is having to use "<lt>" everytime a "<" is needed on functional tests.
|
|/ |
|
| |
|
|\
| |
| | |
[RFC] coverity/74717: FP: NULL Pointer Dereference
|
| |
| |
| |
| |
| | |
dynamic_buffer_ensure() allocates buf->data; add an assert to make this
clear to coverity.
|
| | |
|