mirror of
https://github.com/folke/snacks.nvim
synced 2025-07-07 21:25:11 +00:00
fix(indent): zero indent for blank lines. Closes #1477
This commit is contained in:
parent
bc2ed15c41
commit
cddf714dd6
1 changed files with 5 additions and 1 deletions
|
@ -204,6 +204,10 @@ local function get_state(win, buf, top, bottom)
|
|||
return state
|
||||
end
|
||||
|
||||
function M.debug_win()
|
||||
Snacks.debug.inspect(states[vim.api.nvim_get_current_win()])
|
||||
end
|
||||
|
||||
--- Called during every redraw cycle, so it should be fast.
|
||||
--- Everything that can be cached should be cached.
|
||||
---@param win number
|
||||
|
@ -252,7 +256,7 @@ function M.on_win(win, buf, top, bottom)
|
|||
indents[prev] = indents[prev] or vim.fn.indent(prev)
|
||||
indents[next] = indents[next] or vim.fn.indent(next)
|
||||
indent = math.min(indents[prev], indents[next])
|
||||
if indents[prev] ~= indents[next] then
|
||||
if indents[prev] ~= indents[next] and indent > 0 then
|
||||
indent = indent + state.shiftwidth
|
||||
end
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue