aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/terminal.c
Commit message (Collapse)AuthorAge
* terminal: Refactor to use `state_enter`Thiago de Arruda2015-10-26
| | | | | | - Create `TerminalState` structure containing data used in terminal mode - Extract `terminal_execute` from `terminal_enter` and use it with `state_enter`.
* terminal: Don't store a buf_T reference in the terminal structThiago de Arruda2015-09-18
| | | | | | | Since vimscript can close buffers at any time, it is possible that a refresh_timer_cb will be called with an invalid buffer, but there's no way to detect this if only a reference is stored because the memory can be reused by the allocator. Use buf_T->handle which is guaranteed to be unique.
* terminal: Run screen refresh timer in a deferred queueThiago de Arruda2015-09-18
| | | | Close #3332
* term: Do not highlight bold text by default. #3333Enrico Ghirardi2015-09-12
| | | | | It makes more sense to let the user application terminal emulator decide how to render bold text.
* terminal: Fix use after freeThiago de Arruda2015-08-22
| | | | | Since close_cb may free the terminal structure, save the "wipe" flag before calling it.
* terminal: Only wipe buffer terminal_close wasn't calledThiago de Arruda2015-08-21
| | | | | | | After @250aca4f8938 it is possible that terminal_close will be called without invoking the close_cb(which normally destroys the terminal structure). If this happens, the terminal buffer will already be deleted so there's no need to call `bwipeout!`.
* terminal.c: Events in terminal_enter() should not free the terminaloni-link2015-08-21
| | | | | | | | | | | It is possible for a processed event in the input loop of terminal_enter() to destroy the terminal. But this is undetected by the function and it still tries to use the freed terminal. Use a reference count to delay the freeing of the terminal until terminal_enter() returns. Fixes #3112
* event: Refactor async event processingThiago de Arruda2015-08-13
| | | | | | | | | | - Improve the implementation of deferred/immediate events. - Use the new queue module to change how/when events are queued/processed by giving a private queue to each emitter. - Immediate events(which only exist to break uv_run recursion) are now represented in the `loop->fast_events` queue. - Events pushed to child queues are propagated to the event loop main queue and processed as K_EVENT keys.
* terminal: Ensure terminal buffers are flushed on exitThiago de Arruda2015-08-13
| | | | | When a terminal closed, make sure it is refreshed before the Terminal structure is freed. Also extract `refresh_terminal` from `on_refresh`.
* loop: Simplify loop.c and move some code to input.cThiago de Arruda2015-08-13
| | | | | | - Declare poll timer in Loop structure instead of a loop_poll_events local variable. - Move deferred event management to input.c
* event loop: New abstraction layer with refactored time/signal APIThiago de Arruda2015-07-17
| | | | | | | | | | - Add event loop abstraction module under src/nvim/event. The src/nvim/event/loop module replaces src/nvim/os/event - Remove direct dependency on libuv signal/timer API and use the new abstraction instead. - Replace all references to uv_default_loop() by &loop.uv, a new global variable that wraps libuv main event loop but allows the event loop functions to be reused in other contexts.
* terminal.c: Fix memory leak #2982oni-link2015-07-14
| | | | | dict_set_value() returns the replaced Object in a dictionary. Here the Object is unused and needs to be freed.
* doc: Fix some typos and trailing whitespace. #2875Lucas Hoffmann2015-06-21
|
* terminal : don't set vterm size to 0 (workaround #2732)Frederik Van Slycken2015-05-31
|
* Remove char_u: ex_docmd:do_cmdline_cmd()Michael Reed2015-05-13
|
* memory: Add `free` wrapper and refactor project to use itThiago de Arruda2015-04-13
| | | | | | We already use wrappers for allocation, the new `xfree` function is the equivalent for deallocation and provides a way to fully replace the malloc implementation used by Neovim.
* Merge pull request #2404 from Pyrohh/coverity-108870Michael Reed2015-04-11
|\ | | | | [RFC] coverity/108870: Missing break in switch
| * coverity/108870: Missing break in switchMichael Reed2015-04-10
| |
* | Remove all references to JobActivityMarco Hinz2015-04-11
|/ | | | | | | | | The JobActivity event got replaced by callback functions provided to jobstart() or termopen(). It got removed here: https://github.com/neovim/neovim/commit/6e7757ad51dfe3b2de857ff8a8688718ff6115ac
* coverity/{108271,108272,108273}: add fallthrough annotation #2362Alexey Shmalko2015-04-10
| | | | Signed-off-by: Michael Reed <m.reed@mykolab.com>
* Add new highlight groups TermCursor/TermCursorNCMarco Hinz2015-04-09
| | | | | | | These highlight groups replace the old mechanism of setting: - {g,b}:terminal_focused_cursor_highlight - {g,b}:terminal_unfocused_cursor_highlight
* Merge pull request #2346 from splinterofchaos/fix-terminalScott Prager2015-04-08
|\ | | | | [RFC] terminal: Handle loss of focus in event loop.
| * term: ensure term->buf is validScott Prager2015-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fallowing test (reduced), submitted by @mhinz may free term->buf, leaving the pointer dangling. ```vim let s:buf = -1 function! s:exit_handler() execute 'bdelete!' s:buf endfunction vnew let s:buf = bufnr('%') let id = termopen('sleep 1', { 'on_exit': function('s:exit_handler') }) call s:test() ``` When the buffer is known to be closing, set term->buf to NULL, and check buf_valid() in on_refresh(). Helped-by: Marco Hinz (@mhinz)
| * term: use window col offset to calculate widthScott Prager2015-04-05
| | | | | | | | fixes #2317
| * term: after <C-\>, resume normal input loopScott Prager2015-04-05
| | | | | | | | | | | | | | | | Pressing <C-\> and then a mouse click will insert the click into the terminal as if a keyboard button had been pressed. Keep track of whether the last input was <C-\> and only call terminal_send_key() if the next input is a key press.
| * terminal: Handle loss of focus in event loop.Scott Prager2015-04-05
| | | | | | | | | | | | | | | | | | | | | | | | While in a terminal and insert mode, if an event caused loss of focus, nvim would stay in the terminal event loop causing an inconsistent view of internal state and/or segfault. Remove the "term" argument from terminal_enter() as it only makes sense to call it with curbuf->terminal. Terminate the loop when switched to a different buffer. fixes #2301
* | Fix warnings: terminal.c: get_config_int(): Dead init: RI.Eliseo Martínez2015-04-07
| | | | | | | | | | | | | | | | | | | | Problem : Dead initialization @ 1119. Diagnostic : Real issue. Rationale : `obj` is immediately assigned another value through GET_CONFIG_VALUE macro. Resolution : Don't initialize. Helped-by: oni-link <knil.ino@gmail.com>
* | Fix warnings: terminal.c: get_config_string(): Dead init: RI.Eliseo Martínez2015-04-07
| | | | | | | | | | | | | | | | | | | | Problem : Dead initialization @ 1109. Diagnostic : Real issue. Rationale : `obj` is immediately assigned another value through GET_CONFIG_VALUE macro. Resolution : Don't initialize. Helped-by: oni-link <knil.ino@gmail.com>
* | Fix warnings: terminal.c: redraw(): Np dereference: RI.Eliseo Martínez2015-04-07
|/ | | | | | | | Problem : Dereference of null pointer @ 1053. Diagnostic : Real issue. Rationale : Branch "Exiting focused terminal" can actually be executed when term is NULL. Resolution : Guard branch with term check.
* Modeline cleanupMichael Reed2015-03-31
| | | | | If users want folds to be automatically collapsed, then they should just set foldmethod=marker in their vimrc.
* terminal: New module that implements a terminal emulatorThiago de Arruda2015-03-25
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.