mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
fix(folds): update folds in Insert mode with fdm=indent (#24402)
Previously, when using foldmethod=indent, inserting an unindented line would inadvertently open closed folds below it. As a performance improvement, folds were only updated once, across all lines, after Insert mode was exited. Now, the performance improvement is no longer being used when foldmethod=indent, so folds are updated multiple times during Insert mode, but only across the lines that are changing, which preserves the folds (and their open/close states) instead of recreating them.
This commit is contained in:
@@ -771,7 +771,7 @@ void clearFolding(win_T *win)
|
||||
/// The changes in lines from top to bot (inclusive).
|
||||
void foldUpdate(win_T *wp, linenr_T top, linenr_T bot)
|
||||
{
|
||||
if (disable_fold_update || State & MODE_INSERT) {
|
||||
if (disable_fold_update || (State & MODE_INSERT && !foldmethodIsIndent(wp))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user