From 5c06f350cee4d52554194a90e1d070f4f53979d3 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Tue, 22 Nov 2016 07:31:40 +0900 Subject: vim-patch:7.4.1691 Problem: When switching to a new buffer and an autocommand applies syntax highlighting an ml_get error may occur. Solution: Check "syn_buf" against the buffer in the window. (Alexander von Buddenbrock, closes vim/vim#676) https://github.com/vim/vim/commit/b681be175b6991cdc2b8ddd49b0e97e3fe2b201e --- src/nvim/syntax.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/nvim/syntax.c') diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index e57965ac2c..cd37bde3cb 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -392,7 +392,9 @@ void syntax_start(win_T *wp, linenr_T lnum) * Also do this when a change was made, the current state may be invalid * then. */ - if (syn_block != wp->w_s || changedtick != syn_buf->b_changedtick) { + if (syn_block != wp->w_s + || syn_buf != wp->w_buffer + || changedtick != syn_buf->b_changedtick) { invalidate_current_state(); syn_buf = wp->w_buffer; syn_block = wp->w_s; -- cgit