aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
Commit message (Collapse)AuthorAge
* 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.
* Remove redundant castsAnton Ovchinnikov2015-03-09
|
* Macro cleanup: USE_ON_FLY_SCROLLMichael Reed2015-03-05
|
* Fix warnings: window.c: close_last_window_tabpage(): Use after free: RI.Eliseo Martínez2015-02-21
| | | | | | | | | | | | | Problem : Use after free @ 1795. Diagnostic : Real issue. Rationale : prev_curtab can in fact be freed as a result of call `win_close_othertab(win, free_buf, prev_curtab);`, but it's later used at `sprintf(..., tabpage_index(prev_curtab));`. This was introduced at 3ffc5d81c34cfdd535573a50790690c88e4324bb. Resolution : Move prev_idx calculation before the call freeing prev_curtab.
* refactor: Remove term modules and termcap optionsThiago de Arruda2015-02-21
| | | | | | | | | | | | | | | - 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
* Add TabClosed eventFelipe Morales2015-02-16
| | | | TabClosed is triggered when a tab page closes.
* vim-patch:7.4.446Pavel Platto2015-01-20
| | | | | | | | | Problem: In some situations, when setting up an environment to trigger an autocommand, the environment is not properly restored. Solution: Check the return value of switch_win() and call restore_win() always. (Daniel Hahler) https://code.google.com/p/vim/source/detail?r=v7-4-446
* Macro cleanup: PROTOMichael Reed2015-01-14
| | | | | | Regarding dict_lookup() in eval.c: both definitions are the same, the only difference being the spacing between the indirection operator and the indentation level.
* Merge pull request #1782 from fwalch/small-patchesJustin M. Keyes2015-01-13
|\ | | | | vim-patch: Multiple small patches
| * vim-patch:7.4.466Florian Walch2015-01-08
| | | | | | | | | | | | | | Problem: CTRL-W } does not open preview window. (Erik Falor) Solution: Don't set g_do_tagpreview for CTRL-W }. https://code.google.com/p/vim/source/detail?r=v7-4-466
* | Cleanup: Rename getdigits() family functions.Eliseo Martínez2015-01-11
| |
* | Cleanup: Refactor getdigits().Eliseo Martínez2015-01-11
|/ | | | | | | | | | | | | | | | Problem : getdigits() currently returns a long, but at most places, return value is casted (unsafely) into an int. Making casts safe would introduce a lot of fuss in the form of assertions checking for limits. Note : We cannot just change return type to int, because, at some places, legitimate long values are used. For example, in diff.c, for line numbers. Solution : Introduce new functions: - get_digits() : Gets an intmax_t from a string. - get_int_digits() : Wrapper for ints. - get_long_digits() : Wrapper for longs. And replace getdigits() invocations by the appropiate wrapper invocations.
* vim-patch:7.4.487Justin M. Keyes2014-12-29
| | | | | | | | Problem: ":sign jump" may use another window even though the file is already edited in the current window. Solution: First check if the file is in the current window. (James McCoy) https://code.google.com/p/vim/source/detail?r=v7-4-487
* vim-patch:7.4.518Florian Walch2014-12-24
| | | | | | | Problem: Using status line height in width computations. Solution: Use one instead. (Hirohito Higashi) https://code.google.com/p/vim/source/detail?r=v7-4-518
* Fix warnings: window.c: win_close_othertab(): Np dereference: FP.Eliseo Martínez2014-12-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem : Dereference of null pointer @ 1980. Diagnostic : False positive. Rationale : I haven't been able to find the real reason why this is signaled. Nonetheless, I've been able to track down the introduction of this warning to commit 77135447e09903b45d1482da45869946212f7904. The change there affecting this function is just a transformation maintaining semantics. So, this must be a FP, though I can't explain why. Analyzer thinks `win->w_buffer` can be null in line 1980, following an error path assuming win->w_buffer null at line 1819. Given that `win_close` function was not modified by mentioned commit, I don't understand why this path is analyzed after the changes, but not before them. Or if it's analyzed, why it's discarded before changes but not after them. I don't see anything in changes to `close_last_window_tabpage` that should affect to being able to deduce `win->w_buffer` is not null. Resolution : Assert buffer not null in `win_close_othertab`. Function comments state that passed window should have a buffer that can be hidden, which implies there should be a buffer. Reverting changes to `close_last_window_tabpage` in mentioned commit would be another way to fix this (tried and worked). But assert is preferred in this case because flat style reads better and we have some other way to fix it.
* Reduce indentation level by early returning or continuing loopFelipe Oliveira Carvalho2014-12-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace code like this ```c func() { if (cond) { ... ... ... } return ret; } ``` ```c for (...) { if (cond) { ... ... ... } } ``` with ```c func() { if (!cond) { return ret; } ... ... ... } ``` ```c for (...) { if (!cond) { continue; } ... ... ... } ```
* term: Move more mouse functions to mouse.cThiago de Arruda2014-12-02
|
* Fix warnings: window.c: tabline_height(): Np dereference: FP.Eliseo Martínez2014-11-18
| | | | | | | | Problem : Dereference of null pointer @ 4978. Diagnostic : False positive. Rationale : tabline_height() shouldn't be called when a tab doesn't exist yet (this is, before initialization). Resolution : Assert function precondition.
* Fix warnings: window.c: win_drag_vsep_line(): Np dereference: FP.Eliseo Martínez2014-11-18
| | | | | | | | | | | | Problem : Dereference of null pointer @ 4512. Diagnostic : False positive. Rationale : Suggested error path implies `fr == NULL` after 4504. That's not possible, because: - curfr and curfr->next must be both nonnull, as we are dragging the divider between the two. - after conditional, fr is one of those two (the one that grows). Resolution : Assert fr.
* Fix warnings: window.c: winframe_remove(): Np dereference: FP.Eliseo Martínez2014-11-18
| | | | | | | | | | | | | Problem : Dereference of null pointer @ 2196. Diagnostic : False positive. Rationale : Suggested error path implies `frp->child == NULL` while being under condition `frp2->fr_layout == frp->fr_layout`, which is impossible: - If frp2 is frp's parent, then frp2's layout is FR_COL or FR_ROW; - if frp->child is NULL, the frp's layout is FR_LEAF. - Therefore, they can't be equal. Resolution : Assert frp->child not null.
* Fix warnings: window.c: win_rotate(): Np dereference: FP.Eliseo Martínez2014-11-18
| | | | | | | | | | | | | | | Problem : Dereference of null pointer @ 1268. Diagnostic : False positive. Rationale : Suggested error path implies current window's frame to be the only child of its parent, which is ruled out by `if (firstwin == lastwin) {` check at the beginning. Resolution : Assert another child remains after removing current frame. Strictly, assert is only needed in false branch of conditional, but we add it the same in the true branch to reduce reader surprise. Several forms of a single assert after `if (firstwin == lastwin) {` were tried, but analyzer cannot follow implications that way.
* Convert some values from buffer_defs.h to boolsWayne Rowcliffe2014-11-12
|
* Merge pull request #1208 from war1025/dev/remove_for_all_windowsJustin M. Keyes2014-10-03
|\ | | | | Remove FOR_ALL_WINDOWS and replace with FOR_ALL_WINDOWS_IN_TAB(curtab)
| * Replace FOR_ALL_WINDOWS with FOR_ALL_WINDOWS_IN_TAB(curtab)Wayne Rowcliffe2014-09-24
| |
* | Merge pull request #1225 from mhinz/p7.4.454Justin M. Keyes2014-09-26
|\ \ | | | | | | vim-patch:7.4.454
| * | vim-patch:7.4.454Marco Hinz2014-09-23
| |/ | | | | | | | | | | | | | | | | | | Problem: When using a Visual selection of multiple words and doing CTRL-W_] it jumps to the tag matching the word under the cursor, not the selected text. (Patrick hemmer) Solution: Do not reset Visual mode. (idea by Christian Brabandt) https://code.google.com/p/vim/source/detail?r=0cdff7c268559f8f34eae073a013ece71b62b9e3
* | Merge pull request #1209 from atwupack/vp-7.4.320Justin M. Keyes2014-09-26
|\ \ | | | | | | vim-patch:7.4.320
| * | vim-patch:7.4.320André Twupack2014-09-21
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Possible crash when an BufLeave autocommand deletes the buffer. Solution: Check for the window pointer being valid. Postpone freeing the window until autocommands are done. (Yasuhiro Matsumoto) https://code.google.com/p/vim/source/detail?r=v7-4-320
* | | vim-patch:7.4.386André Twupack2014-09-22
| |/ |/| | | | | | | | | | | Problem: When splitting a window the changelist position is wrong. Solution: Copy the changelist position. (Jacob Niehus) https://code.google.com/p/vim/source/detail?r=v7-4-386
* | FOR_ALL_WINDOWS_IN_TAB and local variables in FOR_ALL_TAB_WINDOWSWayne Rowcliffe2014-09-22
| |
* | FOR_ALL_TABS helperWayne Rowcliffe2014-09-22
|/
* vim-patch:7.4.377André Twupack2014-09-18
| | | | | | | | Problem: When 'equalalways' is set a split may report "no room" even though there is plenty of room. Solution: Compute the available room properly. (Yukihiro Nakadaira) https://code.google.com/p/vim/source/detail?r=v7-4-377
* vim-patch:7.4.373André Twupack2014-09-18
| | | | | | | Problem: Compiler warning for unused argument and unused variable. Solution: Add UNUSED. Move variable inside #ifdef. https://code.google.com/p/vim/source/detail?r=v7-4-373
* vim-patch:7.4.372André Twupack2014-09-18
| | | | | | | | Problem: When 'winminheight' is zero there might not be one line for the current window. Solution: Change the size computations. (Yukihiro Nakadaira) https://code.google.com/p/vim/source/detail?r=v7-4-372
* vim-patch:7.4.365André Twupack2014-09-18
| | | | | | | Problem: Crash when using ":botright split" when there isn't much space. Solution: Add a check for the minimum width/height. (Yukihiro Nakadaira) https://code.google.com/p/vim/source/detail?r=v7-4-365
* vim-patch:7.4.369Shougo Matsushita2014-09-17
| | | | | | | Problem: Using freed memory when exiting while compiled with EXITFREE. Solution: Set curwin to NULL and check for that. (Dominique Pelle) https://code.google.com/p/vim/source/detail?r=v7-4-369
* vim-patch:7.4.368Shougo Matsushita2014-09-16
| | | | | | | | Problem: Restoring the window sizes after closing the command line window doesn't work properly if there are nested splits. Solution: Restore the sizes twice. (Hirohito Higashi) https://code.google.com/p/vim/source/detail?r=v7-4-368
* vim-patch:7.4.349André Twupack2014-09-11
| | | | | | | | | Problem: When there are matches to highlight the whole window is redrawn, which is slow. Solution: Only redraw everything when lines were inserted or deleted. Reset b_mod_xlines when needed. (Alexey Radkov) https://code.google.com/p/vim/source/detail?r=v7-4-349
* Additional FOR_ALL_WINDOWS usageWayne Rowcliffe2014-09-08
|
* Convert FOR_ALL_WINDOWS to use a locally declared pointerWayne Rowcliffe2014-09-08
|
* vim-patch: 7.4.344Felipe Morales2014-09-04
| | | | | | | | Problem: Unnecessary initializations and other things related to matchaddpos(). Solution: Code cleanup. (Alexey Radkov) https://code.google.com/p/vim/source/detail?r=ce284c205558d103326a4c3f22f181774690b3eb
* vim-patch: 7.4.343Felipe Morales2014-09-04
| | | | | | | Problem: matchdelete() does not always update the right lines. Solution: Fix off-by-one error. (Ozaki Kiichi) https://code.google.com/p/vim/source/detail?r=539ce56d8f35fe2deb5c4f57335e1adf97ae4e74
* vim-patch: 7.4.334Felipe Morales2014-09-04
| | | | | | | Problem: Unitialized variables, causing some problems. Solution: Initialize the variables. (Dominique Pelle) https://code.google.com/p/vim/source/detail?r=03d260a8ea0c0c67f424c387dbe2af5754e5e589
* vim-patch: 7.4.330Felipe Morales2014-09-04
| | | | | | | | | | Problem: Using a regexp pattern to highlight a specific position can be slow. Solution: Add matchaddpos() to highlight specific positions efficiently. (Alexey Radkov.) https://code.google.com/p/vim/source/detail?r=f9fa2e506b9f07549cd91074835c5c553db7b3a7
* vim-patch:7.4.317 #1076Justin M. Keyes2014-08-20
| | | | | | | Problem: Crash when starting gvim. Issue 230. Solution: Check for a pointer to be NULL. (Christian Brabandt) https://code.google.com/p/vim/source/detail?r=8ffcb546d782
* Merge pull request #1024 from war1025/dev/for_all_buffersJustin M. Keyes2014-08-19
|\ | | | | Add FOR_ALL_BUFFERS helper
| * FOR_ALL_BUFFERS use locally declared buffer pointerWayne Rowcliffe2014-08-17
| |
| * Add FOR_ALL_BUFFERS helperWayne Rowcliffe2014-08-02
| |
* | vim-patch:7.4.329 #1079Justin M. Keyes2014-08-19
| | | | | | | | | | | | | | | | | | Problem: When moving the cursor and then switching to another window the previous window isn't scrolled. (Yukihiro Nakadaira) Solution: Call update_topline() before leaving the window. (Christian Brabandt) https://code.google.com/p/vim/source/detail?r=018df65085f8
* | vim-patch:7.4.325 #1078Justin M. Keyes2014-08-19
| | | | | | | | | | | | | | | | | | Problem: When starting the gui and changing the window size the status line may not be drawn correctly. Solution: Catch new_win_height() being called recursively. (Christian Brabandt) https://code.google.com/p/vim/source/detail?r=1f288d247548