diff src/ex_cmds.c @ 11589:39787def24bb v8.0.0677

patch 8.0.0677: setting 'filetype' may switch buffers commit https://github.com/vim/vim/commit/1814183b865059679f6ee526ec23fc575e536e66 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 25 21:17:25 2017 +0200 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)
author Christian Brabandt <cb@256bit.org>
date Sun, 25 Jun 2017 21:30:04 +0200
parents e0eb2de60f09
children 0f7888a5ba68
line wrap: on
line diff
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -6835,7 +6835,11 @@ fix_help_buffer(void)
 #ifdef FEAT_AUTOCMD
     /* Set filetype to "help" if still needed. */
     if (STRCMP(curbuf->b_p_ft, "help") != 0)
+    {
+	++curbuf_lock;
 	set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL);
+	--curbuf_lock;
+    }
 #endif
 
 #ifdef FEAT_SYN_HL