aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-06-25 19:32:35 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-06-26 10:21:39 -0400
commitbfe029a11deaa923980400bcfc3e043136474759 (patch)
treec848d8ce4064d999938f66bc4ead34e91adf1d66 /src/nvim/ex_getln.c
parentda6874a7b26976c43115a66180c47d8230dea435 (diff)
downloadrneovim-bfe029a11deaa923980400bcfc3e043136474759.tar.gz
rneovim-bfe029a11deaa923980400bcfc3e043136474759.tar.bz2
rneovim-bfe029a11deaa923980400bcfc3e043136474759.zip
vim-patch:8.0.0677: setting 'filetype' may switch buffers
Problem: Setting 'filetype' internally may cause the current buffer and window to change unexpectedly. Solution: Set curbuf_lock. (closes vim/vim#1734) https://github.com/vim/vim/commit/1814183b865059679f6ee526ec23fc575e536e66
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index d152dfa271..4b9ef5d819 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -6057,8 +6057,10 @@ static int open_cmdwin(void)
curbuf->b_p_ma = true;
curwin->w_p_fen = false;
- /* Do execute autocommands for setting the filetype (load syntax). */
+ // Do execute autocommands for setting the filetype (load syntax).
unblock_autocmds();
+ // But don't allow switching to another buffer.
+ curbuf_lock++;
/* Showing the prompt may have set need_wait_return, reset it. */
need_wait_return = FALSE;
@@ -6071,6 +6073,7 @@ static int open_cmdwin(void)
}
set_option_value("ft", 0L, "vim", OPT_LOCAL);
}
+ curbuf_lock--;
/* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin
* sets 'textwidth' to 78). */