aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkianonymus <anonymus.aki@gmail.com>2022-09-09 13:58:47 +0530
committerAkianonymus <anonymus.aki@gmail.com>2022-09-09 14:00:33 +0530
commitb23c0f2014a78d7854b8005e3d036e990bd2ba43 (patch)
tree76732c46a011b5f9785ca7c6f763b0e579c4c140
parentMake sure to use existing options when attaching buffer (diff)
tailwind: Fix detach when attach is executed multiple times
-rw-r--r--lua/colorizer.lua4
-rw-r--r--lua/colorizer/buffer_utils.lua2
2 files changed, 3 insertions, 3 deletions
diff --git a/lua/colorizer.lua b/lua/colorizer.lua
index 7f89685..4af765c 100644
--- a/lua/colorizer.lua
+++ b/lua/colorizer.lua
@@ -254,8 +254,8 @@ local function attach_to_buffer(buf, options, typ)
BUFFER_LOCAL[buf] = BUFFER_LOCAL[buf] or {}
local tailwind_ns, tailwind_detach = rehighlight_buffer(buf, options)
- BUFFER_LOCAL[buf].__tailwind_ns = tailwind_ns
- BUFFER_LOCAL[buf].__tailwind_detach = tailwind_detach
+ BUFFER_LOCAL[buf].__tailwind_ns = BUFFER_LOCAL[buf].__tailwind_ns or tailwind_ns
+ BUFFER_LOCAL[buf].__tailwind_detach = BUFFER_LOCAL[buf].__tailwind_detach or tailwind_detach
BUFFER_LOCAL[buf].__init = true
diff --git a/lua/colorizer/buffer_utils.lua b/lua/colorizer/buffer_utils.lua
index a3b3da7..4ee3cfe 100644
--- a/lua/colorizer/buffer_utils.lua
+++ b/lua/colorizer/buffer_utils.lua
@@ -140,7 +140,7 @@ local function highlight_buffer_tailwind(buf, ns, mode, options)
table.insert(d, { name = name, range = { first_col, end_col } })
datas[cur_line] = d
end
- add_highlight(options, buf, ns, datas, line_start, line_end + 2)
+ add_highlight(options, buf, ns, datas, line_start or 0, line_end and (line_end + 2) or -1)
end
end)
end, 10)