vim-patch:8.2.4935: with 'foldmethod' "indent" some lines not included in fold (#18694)

Problem:    With 'foldmethod' "indent" some lines are not included in the
            fold. (Oleg Koshovetc)
Solution:   Fix it. (Brandon Simmons, closes vim/vim#10399, closes vim/vim#3214)
d98e75e236
This commit is contained in:
zeertzjq
2022-05-22 21:37:25 +08:00
committed by GitHub
parent 70e3caec4a
commit 566ee48f05
2 changed files with 27 additions and 1 deletions

View File

@@ -2003,7 +2003,7 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
// start one line back, because a "<1" may indicate the end of a
// fold in the topline
if (top > 1) {
--fline.lnum;
fline.lnum--;
}
} else if (foldmethodIsSyntax(wp)) {
getlevel = foldlevelSyntax;
@@ -2011,6 +2011,12 @@ static void foldUpdateIEMS(win_T *const wp, linenr_T top, linenr_T bot)
getlevel = foldlevelDiff;
} 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