From 2f5f74e5e67f657e9fdac54891a76721bcd3ead3 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 5 Jan 2020 19:59:59 -0500 Subject: [PATCH] Validate last buffer line of g:plug_window (#927) Close #926 This fix shouldn't be necessary because vim-plug's buffer should always have 4 lines but a buffer can be modified in some cases before nvim 0.4.0 and vim v8.1.1360. --- plug.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plug.vim b/plug.vim index 91b4072..78fdc03 100644 --- a/plug.vim +++ b/plug.vim @@ -1338,9 +1338,10 @@ function! s:bar() endfunction function! s:logpos(name) - for i in range(4, line('$')) + let max = line('$') + for i in range(4, max > 4 ? max : 4) if getline(i) =~# '^[-+x*] '.a:name.':' - for j in range(i + 1, line('$')) + for j in range(i + 1, max > 5 ? max : 5) if getline(j) !~ '^ ' return [i, j - 1] endif