diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-06-25 21:17:25 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-06-25 21:17:25 +0200 |
commit | 1814183b865059679f6ee526ec23fc575e536e66 (patch) | |
tree | 27687232ab6376a33759072132c4e3bf9c20ba17 /src/ex_getln.c | |
parent | 182a17b1e80b92826204d967808df0d30eb2ef27 (diff) | |
download | vim-1814183b865059679f6ee526ec23fc575e536e66.zip |
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 #1734)
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r-- | src/ex_getln.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 194b3bf3d..ba8fde65e 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -6878,6 +6878,8 @@ open_cmdwin(void) # ifdef FEAT_AUTOCMD /* Do execute autocommands for setting the filetype (load syntax). */ unblock_autocmds(); + /* But don't allow switching to another buffer. */ + ++curbuf_lock; # endif /* Showing the prompt may have set need_wait_return, reset it. */ @@ -6893,6 +6895,9 @@ open_cmdwin(void) } set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL); } +# ifdef FEAT_AUTOCMD + --curbuf_lock; +# endif /* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin * sets 'textwidth' to 78). */ |