mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
fix(folds): handle visual blockwise indent insertion correctly (#22898)
Previously, the fold information was incorrect because it wasn't being updated during the blockwise insertion. (Solution by zeertzjq)
This commit is contained in:
@@ -623,9 +623,9 @@ static void block_insert(oparg_T *oap, char *s, int b_insert, struct block_def *
|
|||||||
}
|
}
|
||||||
} // for all lnum
|
} // for all lnum
|
||||||
|
|
||||||
changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L, true);
|
|
||||||
|
|
||||||
State = oldstate;
|
State = oldstate;
|
||||||
|
|
||||||
|
changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handle reindenting a block of lines.
|
/// Handle reindenting a block of lines.
|
||||||
|
@@ -359,4 +359,14 @@ a]], '13m7')
|
|||||||
eq(10, funcs.foldclosedend(7))
|
eq(10, funcs.foldclosedend(7))
|
||||||
eq(14, funcs.foldclosedend(11))
|
eq(14, funcs.foldclosedend(11))
|
||||||
end)
|
end)
|
||||||
|
it('updates correctly with indent method and visual blockwise insertion', function()
|
||||||
|
insert([[
|
||||||
|
a
|
||||||
|
b
|
||||||
|
]])
|
||||||
|
feed_command('set foldmethod=indent', 'set shiftwidth=2')
|
||||||
|
feed('gg0<C-v>jI <Esc>') -- indent both lines using visual blockwise mode
|
||||||
|
eq(1, funcs.foldlevel(1))
|
||||||
|
eq(1, funcs.foldlevel(2))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user