Skip to content

Commit

Permalink
fix: tab indent calc with mixed tabs and spaces
Browse files Browse the repository at this point in the history
fix #898
  • Loading branch information
lukas-reineke committed Jun 23, 2024
1 parent d98f537 commit 4036c8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions lua/ibl/indent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ M.get = function(whitespace, opts, indent_state)
table.insert(whitespace_tbl, M.whitespace.TAB_FILL)
end
end
spaces = 0
else
local mod = (spaces + tabs + extra) % shiftwidth
if utils.tbl_contains(indent_state.stack, spaces + tabs) then
Expand Down
2 changes: 1 addition & 1 deletion specs/features/indent_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("indent", function()
it("mix of tabs and spaces", function()
local whitespace_tbl, _ = indent.get(" ", opts, { cap = false, stack = { 0 } })

assert.are.same(whitespace_tbl, { INDENT, SPACE, TAB_START, TAB_END, SPACE, TAB_START_SINGLE })
assert.are.same(whitespace_tbl, { INDENT, SPACE, TAB_START, TAB_END, SPACE, TAB_START, TAB_FILL, TAB_END })
end)

it("mix of tabs and spaces with vartabstop", function()
Expand Down

0 comments on commit 4036c8a

Please sign in to comment.