aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fold.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-05-22 21:37:25 +0800
committerGitHub <noreply@github.com>2022-05-22 21:37:25 +0800
commit566ee48f052194092c750a7c678b25d1714da9cb (patch)
treeba18ce954951917afb70831e6ad0fcde9bdc0bce /src/nvim/fold.c
parent70e3caec4a570e6ab1375aec98ebbfa1dd673961 (diff)
downloadrneovim-566ee48f052194092c750a7c678b25d1714da9cb.tar.gz
rneovim-566ee48f052194092c750a7c678b25d1714da9cb.tar.bz2
rneovim-566ee48f052194092c750a7c678b25d1714da9cb.zip
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) https://github.com/vim/vim/commit/d98e75e23666c159c7e00bcf5b6ad9a933bb0534
Diffstat (limited to 'src/nvim/fold.c')
-rw-r--r--src/nvim/fold.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 8a4a3bbbc0..9c8e92cd00 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -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