From b00211a5513a546271c4b40853df50af7cceba70 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 25 Jun 2018 11:31:50 -0400 Subject: [PATCH] vim-patch:8.0.0704: problems with autocommands when opening help Problem: Problems with autocommands when opening help. Solution: Avoid using invalid "varp" value. Allow using :wincmd if buffer is locked. (closes vim/vim#1806, closes vim/vim#1804) https://github.com/vim/vim/commit/163095f088a7c29710a16c75bb56229dd3b4116a --- src/nvim/ex_cmds.lua | 2 +- src/nvim/option.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index c87e3d4c66..31776a70e7 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -3076,7 +3076,7 @@ return { }, { command='wincmd', - flags=bit.bor(NEEDARG, WORD1, RANGE, NOTADR), + flags=bit.bor(NEEDARG, WORD1, RANGE, NOTADR, CMDWIN), addr_type=ADDR_WINDOWS, func='ex_wincmd', }, diff --git a/src/nvim/option.c b/src/nvim/option.c index ed845df416..50c172b580 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3243,6 +3243,10 @@ did_set_string_option ( did_filetype = true; apply_autocmds(EVENT_FILETYPE, curbuf->b_p_ft, curbuf->b_fname, true, curbuf); + // Just in case the old "curbuf" is now invalid + if (varp != &(curbuf->b_p_ft)) { + varp = NULL; + } } } if (varp == &(curwin->w_s->b_p_spl)) {