To: vim_dev@googlegroups.com Subject: Patch 8.2.5009 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5009 Problem: Fold may not be closeable after appending. Solution: Set the fd_small flag to MAYBE. (Brandon Simmons, closes #10471) Files: src/fold.c, src/testdir/test_fold.vim *** ../vim-8.2.5008/src/fold.c 2022-05-20 18:25:15.809240687 +0100 --- src/fold.c 2022-05-23 15:26:29.769323799 +0100 *************** *** 2574,2579 **** --- 2574,2580 ---- (long)(fp->fd_top - firstlnum)); fp->fd_len += fp->fd_top - firstlnum; fp->fd_top = firstlnum; + fp->fd_small = MAYBE; fold_changed = TRUE; } else if ((flp->start != 0 && lvl == level) *** ../vim-8.2.5008/src/testdir/test_fold.vim 2022-05-21 16:34:34.826069406 +0100 --- src/testdir/test_fold.vim 2022-05-23 15:32:42.689107342 +0100 *************** *** 1528,1531 **** --- 1528,1550 ---- bw! endfunc + " Make sure that when appending [an indented line then a blank line] right + " before a single indented line, the resulting extended fold can be closed + func Test_indent_append_blank_small_fold_close() + new + setlocal sw=2 foldmethod=indent + " at first, the fold at the second line can't be closed since it's smaller + " than foldminlines + let lines =<< trim END + line 1 + line 4 + END + call setline(1, lines) + call append(1, [' line 2', '']) + " close all folds + normal zM + call assert_notequal(-1, foldclosed(2)) " the fold should be closed now + bw! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.5008/src/version.c 2022-05-23 13:10:39.726713326 +0100 --- src/version.c 2022-05-23 15:28:20.057261522 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5009, /**/ -- MAN: You don't frighten us, English pig-dog! Go and boil your bottoms, son of a silly person. I blow my nose on you, so-called Arthur-king, you and your silly English K...kaniggets. He puts hands to his ears and blows a raspberry. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///