From 2a6580a8e250ab175415d58749bbe2398648501e Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 1 Feb 2021 21:14:41 -0500 Subject: vim-patch:8.2.2446: setting 'term' empty has different error if compiled with GUI Problem: Setting 'term' empty has different error if compiled with GUI. Solution: Insert "else". (closes vim/vim#7766) https://github.com/vim/vim/commit/5daa91162699e4f8b54f9d1caaaab2715038941c N/A patches for version.c: vim-patch:8.2.2437: deprecation warnings with default configuration Problem: Deprecation warnings with default configuration. Solution: Add -Wno-deprecated-declarations. https://github.com/vim/vim/commit/4d8479b335e92a95b09fdee09309ea0df934cb9e vim-patch:8.2.2439: not easy to figure out what packages to get Problem: Not easy to figure out what packages to get when installing Vim on a new Ubuntu system. Solution: Mention explicit commands that are easy to follow. https://github.com/vim/vim/commit/3d2bb8b6f152c0c5056f49bccb350683a9ba2e13 vim-patch:8.2.2442: automatic GUI selection does not check for GTK 3 Problem: Automatic GUI selection does not check for GTK 3. Solution: Make SKIP_GTK3 empty for automatic GUI support. Set SKIP_GTK3 to YES when checking for GTK2. https://github.com/vim/vim/commit/f272ae12ac064856b710046393d5bf9b1670076d vim-patch:8.2.2448: compilation error with Ruby 3.0 Problem: Compilation error with Ruby 3.0. Solution: Adjust #ifdefs and declaration. (Ken Takata, closes vim/vim#7761) https://github.com/vim/vim/commit/9d20daffc296b9eb901fb14bdd83620ea55d440a --- src/nvim/testdir/test_options.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 84d99ebb74..5a10c9baa6 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -330,12 +330,10 @@ func Test_set_ttytype() set ttytype=xterm call assert_equal('xterm', &ttytype) call assert_equal(&ttytype, &term) - " "set ttytype=" gives E522 instead of E529 - " in travis on some builds. Why? Catch both for now try set ttytype= call assert_report('set ttytype= did not fail') - catch /E529\|E522/ + catch /E529/ endtry " Some systems accept any terminal name and return dumb settings, -- cgit From 65e51fca0e48a6ffe62902a56b417f120b0f11f7 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 1 Feb 2021 21:34:36 -0500 Subject: vim-patch:8.2.2447: 'foldlevel' not applied to folds restored from session Problem: 'foldlevel' not applied to folds restored from session. Solution: Set 'foldlevel' after creaiting the folds. (closes vim/vim#7767) https://github.com/vim/vim/commit/f9547eb6ef02e305203b859d2dcfdae930b9d544 --- src/nvim/fold.c | 7 ++++--- src/nvim/testdir/test_mksession.vim | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/fold.c b/src/nvim/fold.c index 0593c16999..5032646d7e 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -2999,7 +2999,6 @@ static void foldlevelDiff(fline_T *flp) static void foldlevelExpr(fline_T *flp) { win_T *win; - int n; int c; linenr_T lnum = flp->lnum + flp->off; @@ -3017,7 +3016,7 @@ static void foldlevelExpr(fline_T *flp) /* KeyTyped may be reset to 0 when calling a function which invokes * do_cmdline(). To make 'foldopen' work correctly restore KeyTyped. */ const bool save_keytyped = KeyTyped; - n = (int)eval_foldexpr(flp->wp->w_p_fde, &c); + const int n = eval_foldexpr(flp->wp->w_p_fde, &c); KeyTyped = save_keytyped; switch (c) { @@ -3202,8 +3201,10 @@ int put_folds(FILE *fd, win_T *wp) { if (foldmethodIsManual(wp)) { if (put_line(fd, "silent! normal! zE") == FAIL - || put_folds_recurse(fd, &wp->w_folds, (linenr_T)0) == FAIL) + || put_folds_recurse(fd, &wp->w_folds, (linenr_T)0) == FAIL + || put_line(fd, "let &fdl = &fdl") == FAIL) { return FAIL; + } } /* If some folds are manually opened/closed, need to restore that. */ diff --git a/src/nvim/testdir/test_mksession.vim b/src/nvim/testdir/test_mksession.vim index f71da92bf8..88320e0c22 100644 --- a/src/nvim/testdir/test_mksession.vim +++ b/src/nvim/testdir/test_mksession.vim @@ -291,6 +291,32 @@ endfunc endif +func Test_mkview_open_folds() + enew! + + call append(0, ['a', 'b', 'c']) + 1,3fold + " zR affects 'foldlevel', make sure the option is applied after the folds + " have been recreated. + normal zR + write! Xtestfile + + call assert_equal(-1, foldclosed(1)) + call assert_equal(-1, foldclosed(2)) + call assert_equal(-1, foldclosed(3)) + + mkview! Xtestview + source Xtestview + + call assert_equal(-1, foldclosed(1)) + call assert_equal(-1, foldclosed(2)) + call assert_equal(-1, foldclosed(3)) + + call delete('Xtestview') + call delete('Xtestfile') + %bwipe +endfunc + " Test :mkview with a file argument. func Test_mkview_file() " Create a view with line number and a fold. -- cgit From 8d3baf07910b15a57119fe063bee67ec07d57efa Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 3 Feb 2021 18:28:03 -0500 Subject: vim-patch:8.2.2458: Coverity warns for :retab using freed memory Problem: Coverity warns for :retab using freed memory. Solution: Use the updated line pointer when moving text properties. https://github.com/vim/vim/commit/0dcd39bad5e5aa70ba8f60cb3fbf0658585f0151 N/A patches for version.c: vim-patch:8.2.2457: Coverity warns for memory leak Problem: Coverity warns for memory leak. Solution: Free memory when out of memory. https://github.com/vim/vim/commit/4dba04256b8a49b201d685217d3d7abc4988f090 --- src/nvim/ex_cmds.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 2da8c205c1..6b96c4deca 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -790,7 +790,10 @@ void ex_retab(exarg_T *eap) for (col = 0; col < len; col++) { ptr[col] = (col < num_tabs) ? '\t' : ' '; } - ml_replace(lnum, new_line, false); + if (ml_replace(lnum, new_line, false) == OK) { + // "new_line" may have been copied + new_line = curbuf->b_ml.ml_line_ptr; + } if (first_line == 0) { first_line = lnum; } -- cgit From 02cda35cf7258e1d33c86f792aec30bd506221dc Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 3 Feb 2021 18:36:27 -0500 Subject: vim-patch:8.2.2462: Coverity warns for not checking for fseek() error Problem: Coverity warns for not checking for fseek() error. Solution: Give an error message if fseek() fails. https://github.com/vim/vim/commit/2c363a2e95ee0b366e72063d093d20e025ef4a66 --- src/nvim/spellfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index 90af010164..3c125959a9 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -5387,7 +5387,8 @@ spell_add_word ( len, word, NameBuff); } } - if (fseek(fd, fpos_next, SEEK_SET) <= 0) { + if (fseek(fd, fpos_next, SEEK_SET) != 0) { + PERROR(_("Seek error in spellfile")); break; } } -- cgit From da3f9778aff8cfa134adec3fca93c00d82bcf4af Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Wed, 3 Feb 2021 18:38:46 -0500 Subject: vim-patch:8.2.2464: using freed memory if window closed in autocommand Problem: Using freed memory if window closed in autocommand. (houyunsong) Solution: Check the window still exists. https://github.com/vim/vim/commit/8ab375706e6712308f8cf7529bcae56684a6f385 --- src/nvim/ex_cmds.c | 5 ++++- src/nvim/testdir/test_autocmd.vim | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 6b96c4deca..9239eb5ca6 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -2416,7 +2416,10 @@ int do_ecmd( (flags & ECMD_HIDE) || curbuf->terminal ? 0 : DOBUF_UNLOAD, false); - the_curwin->w_closing = false; + // Autocommands may have closed the window. + if (win_valid(the_curwin)) { + the_curwin->w_closing = false; + } buf->b_locked--; // autocmds may abort script processing diff --git a/src/nvim/testdir/test_autocmd.vim b/src/nvim/testdir/test_autocmd.vim index 374ad65aa9..1f3a45a9ab 100644 --- a/src/nvim/testdir/test_autocmd.vim +++ b/src/nvim/testdir/test_autocmd.vim @@ -1939,4 +1939,15 @@ func Test_autocmd_window() %bw! endfunc +func Test_autocmd_closes_window() + au BufNew,BufWinLeave * e %e + file yyy + au BufNew,BufWinLeave * ball + call assert_fails('n xxx', 'E143:') + + bwipe % + au! BufNew + au! BufWinLeave +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit