aboutsummaryrefslogtreecommitdiff
path: root/lua/colorizer.lua
diff options
context:
space:
mode:
authorAkianonymus <anonymus.aki@gmail.com>2022-09-08 13:37:41 +0530
committerAkianonymus <anonymus.aki@gmail.com>2022-09-08 15:37:05 +0530
commit7d3e62087fbbad2dc10d59359f19a42180a19391 (patch)
tree8c03381d06b75b4692fbe6e2d8c1cebc91196797 /lua/colorizer.lua
parenttailwind: Use true for normal mode (diff)
docs: Use name in Last Updated | Cleanup | Improve insert mode perf
Fix highlight not refreshing for last line when tailwind mode is activated
Diffstat (limited to 'lua/colorizer.lua')
-rw-r--r--lua/colorizer.lua11
1 files changed, 9 insertions, 2 deletions
diff --git a/lua/colorizer.lua b/lua/colorizer.lua
index b1786d8..93d21db 100644
--- a/lua/colorizer.lua
+++ b/lua/colorizer.lua
@@ -250,10 +250,17 @@ local function attach_to_buffer(buf, options, typ)
autocmds[#autocmds + 1] = autocmd({ "TextChanged", "TextChangedI", "TextChangedP" }, {
group = au_group_id,
buffer = buf,
- callback = function()
+ callback = function(args)
-- only reload if it was not disabled using detach_from_buffer
if BUFFER_OPTIONS[buf] then
- rehighlight_buffer(buf, options, BUFFER_LOCAL[buf])
+ if args.event == "TextChanged" then
+ rehighlight_buffer(buf, options, BUFFER_LOCAL[buf])
+ else
+ local pos = vim.fn.getpos "."
+ BUFFER_LOCAL[buf].__startline = pos[2] - 1
+ BUFFER_LOCAL[buf].__endline = pos[2]
+ rehighlight_buffer(buf, options, BUFFER_LOCAL[buf], true)
+ end
end
end,
})