From b00211a5513a546271c4b40853df50af7cceba70 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 25 Jun 2018 11:31:50 -0400 Subject: [PATCH 1/3] 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)) { From fee4e39ca3fd8e3f5292f05f33cb9a213f318176 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 25 Jun 2018 11:34:21 -0400 Subject: [PATCH 2/3] vim-patch:8.0.0706: crash when cancelling the cmdline window in Ex mode Problem: Crash when cancelling the cmdline window in Ex mode. (James McCoy) Solution: Do not set cmdbuff to NULL, make it empty. https://github.com/vim/vim/commit/5a15b6aa0aa5c1559c6f1a9f06c595a8c564637d --- src/nvim/ex_getln.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 3372edb8fd..d152dfa271 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -6183,9 +6183,13 @@ static int open_cmdwin(void) ccline.cmdbuff = NULL; } else ccline.cmdbuff = vim_strsave(get_cursor_line_ptr()); - if (ccline.cmdbuff == NULL) + if (ccline.cmdbuff == NULL) { + ccline.cmdbuff = vim_strsave((char_u *)""); + ccline.cmdlen = 0; + ccline.cmdbufflen = 1; + ccline.cmdpos = 0; cmdwin_result = Ctrl_C; - else { + } else { ccline.cmdlen = (int)STRLEN(ccline.cmdbuff); ccline.cmdbufflen = ccline.cmdlen + 1; ccline.cmdpos = curwin->w_cursor.col; From b79523681d2b7cf7e1c1f0b9174aa3804e1d5811 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 25 Jun 2018 11:40:04 -0400 Subject: [PATCH 3/3] vim-patch:8.0.0707: freeing wrong memory with certain autocommands Problem: Freeing wrong memory when manipulating buffers in autocommands. (James McCoy) Solution: Also set the w_s pointer if w_buffer was NULL. https://github.com/vim/vim/commit/f1d13478e3a7e1a86d52552c8c5571f00dc28ad1 --- src/nvim/ex_cmds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index dbf11514cf..15b49b69ce 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -2352,8 +2352,8 @@ int do_ecmd( } else { // We could instead free the synblock // and re-attach to buffer, perhaps. - if (curwin->w_buffer != NULL - && curwin->w_s == &(curwin->w_buffer->b_s)) { + if (curwin->w_buffer == NULL + || curwin->w_s == &(curwin->w_buffer->b_s)) { curwin->w_s = &(buf->b_s); }