From f3bbd61a042ea395d1d4991941a5940361100b31 Mon Sep 17 00:00:00 2001 From: Lukas Reineke Date: Mon, 24 Jun 2024 00:09:23 +0900 Subject: [PATCH] fix: tab indent calc with mixed tabs and spaces fix #898 --- lua/ibl/indent.lua | 1 + specs/features/indent_spec.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/ibl/indent.lua b/lua/ibl/indent.lua index 3f35a168..433c4b08 100644 --- a/lua/ibl/indent.lua +++ b/lua/ibl/indent.lua @@ -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 diff --git a/specs/features/indent_spec.lua b/specs/features/indent_spec.lua index 6c451987..f2405eaa 100644 --- a/specs/features/indent_spec.lua +++ b/specs/features/indent_spec.lua @@ -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()