From b16c5bf5e6e2b7fd5f592ccec4f17bbf937e6d9b Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Thu, 5 Mar 2015 18:07:15 -0300 Subject: buffer: Move b_p_ma(modifiable) checks into the MODIFIABLE macro --- src/nvim/fold.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/fold.c') diff --git a/src/nvim/fold.c b/src/nvim/fold.c index a1fbdf7791..74444d4ab7 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -1563,7 +1563,7 @@ static void setSmallMaybe(garray_T *gap) */ static void foldCreateMarkers(linenr_T start, linenr_T end) { - if (!curbuf->b_p_ma) { + if (!MODIFIABLE(curbuf)) { EMSG(_(e_modifiable)); return; } -- cgit From cdedd89d228a016a4e433968702e9e3ce5165e7d Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Sun, 8 Mar 2015 08:58:31 -0300 Subject: terminal: New module that implements a terminal emulator 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. --- src/nvim/fold.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/nvim/fold.c') diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 74444d4ab7..267c586543 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -137,7 +137,7 @@ void copyFoldingState(win_T *wp_from, win_T *wp_to) int hasAnyFolding(win_T *win) { /* very simple now, but can become more complex later */ - return win->w_p_fen + return !win->w_buffer->terminal && win->w_p_fen && (!foldmethodIsManual(win) || !GA_EMPTY(&win->w_folds)); } @@ -768,6 +768,9 @@ void clearFolding(win_T *win) void foldUpdate(win_T *wp, linenr_T top, linenr_T bot) { fold_T *fp; + if (wp->w_buffer->terminal) { + return; + } /* Mark all folds from top to bot as maybe-small. */ (void)foldFind(&curwin->w_folds, top, &fp); -- cgit