diff options
| author | tao <2471314@gmail.com> | 2025-08-22 10:55:45 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-21 19:55:45 -0700 |
| commit | d73cfefed5e45fec91a422cd87054611ff711b30 (patch) | |
| tree | f5b649285d1cbed05bc99d33fe215750cd487fde /src/nvim/lua | |
| parent | 12b6f65283ce8beeaed9c97dad53a7db362cdbff (diff) | |
| download | rneovim-d73cfefed5e45fec91a422cd87054611ff711b30.tar.gz rneovim-d73cfefed5e45fec91a422cd87054611ff711b30.tar.bz2 rneovim-d73cfefed5e45fec91a422cd87054611ff711b30.zip | |
fix(folds): error when deleting lines at end of buffer #35396
Problem:
with `foldmethod=expr foldexpr=v:lua.vim.treesitter.foldexpr()
foldminlines=0`, deleting lines at the end of the buffer always
reports an invalid top error, because the top value (i.e. the
start line number of the deletion) is always 1 greater than
the total line number of the modified buffer.
Solution:
remove the ml_line_count validation
Diffstat (limited to 'src/nvim/lua')
| -rw-r--r-- | src/nvim/lua/stdlib.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c index 4a3b8596b3..a57ca059b7 100644 --- a/src/nvim/lua/stdlib.c +++ b/src/nvim/lua/stdlib.c @@ -563,7 +563,7 @@ static int nlua_foldupdate(lua_State *lstate) } // input is zero-based end-exclusive range linenr_T top = (linenr_T)luaL_checkinteger(lstate, 2) + 1; - if (top < 1 || top > win->w_buffer->b_ml.ml_line_count) { + if (top < 1) { return luaL_error(lstate, "invalid top"); } linenr_T bot = (linenr_T)luaL_checkinteger(lstate, 3); |