From bfe029a11deaa923980400bcfc3e043136474759 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 25 Jun 2018 19:32:35 -0400 Subject: 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 --- src/nvim/quickfix.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/quickfix.c') diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index aeb27a5cac..47760e1e70 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3008,6 +3008,7 @@ static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last) // Set the 'filetype' to "qf" each time after filling the buffer. This // resembles reading a file into a buffer, it's more logical when using // autocommands. + curbuf_lock++; set_option_value("ft", 0L, "qf", OPT_LOCAL); curbuf->b_p_ma = false; @@ -3017,6 +3018,7 @@ static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last) apply_autocmds(EVENT_BUFWINENTER, (char_u *)"quickfix", NULL, false, curbuf); keep_filetype = false; + curbuf_lock--; // make sure it will be redrawn redraw_curbuf_later(NOT_VALID); -- cgit