Skip to content

Commit 7cc3fd9

Browse files
committed
fix(esupports.indent): fix setting indentation of line to -1 not being ignored
indent-expression might return -1 as the indentation of a line to indicate that neovim should handle the indentation of the line. When manually setting the indentation of a line with `buffer_set_line_indent` using the indentation returned by indent-expression however, the -1 indentation caused the indentation to be set to 0 instead of kept as is
1 parent 75de647 commit 7cc3fd9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/neorg/modules/core/esupports/indent/module.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ module.public = {
149149
---@param new_indent number
150150
buffer_set_line_indent = function(buffer, start_row, new_indent)
151151
local line = vim.api.nvim_buf_get_lines(buffer, start_row, start_row + 1, true)[1]
152-
if line:match("^%s*$") then
152+
if line:match("^%s*$") or new_indent == -1 then
153153
return
154154
end
155155

0 commit comments

Comments
 (0)