To: vim_dev@googlegroups.com Subject: Patch 8.2.4935 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4935 Problem: With 'foldmethod' "indent" some lines are not included in the fold. (Oleg Koshovetc) Solution: Fix it. (Brandon Simmons, closes #10399, closes #3214) Files: src/fold.c, src/testdir/test_fold.vim *** ../vim-8.2.4934/src/fold.c 2022-05-07 20:01:10.054731696 +0100 --- src/fold.c 2022-05-10 19:12:35.178942918 +0100 *************** *** 2246,2252 **** --- 2246,2259 ---- getlevel = foldlevelDiff; #endif else + { getlevel = foldlevelIndent; + // Start one line back, because if the line above "top" has an + // undefined fold level, folding it relies on the line under it, + // which is "top". + if (top > 1) + --fline.lnum; + } // Backup to a line for which the fold level is defined. Since it's // always defined for line one, we will stop there. *** ../vim-8.2.4934/src/testdir/test_fold.vim 2022-04-23 13:50:11.155455199 +0100 --- src/testdir/test_fold.vim 2022-05-10 19:09:16.635017206 +0100 *************** *** 1459,1462 **** --- 1459,1482 ---- bw! endfunc + " Make sure that when you append under a blank line that is under a fold with + " the same indent level as your appended line, the fold expands across the + " blank line + func Test_indent_append_under_blank_line() + new + let lines =<< trim END + line 1 + line 2 + line 3 + END + call setline(1, lines) + setlocal sw=2 + setlocal foldmethod=indent foldenable + call assert_equal([0, 1, 1], range(1, 3)->map('foldlevel(v:val)')) + call append(3, '') + call append(4, ' line 5') + call assert_equal([0, 1, 1, 1, 1], range(1, 5)->map('foldlevel(v:val)')) + bw! + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.4934/src/version.c 2022-05-10 18:11:39.627454291 +0100 --- src/version.c 2022-05-10 19:08:44.607029692 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 4935, /**/ -- "Hit any key to continue" is a lie. /// 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 ///