`drawwhitespace`: Invalidate cache on indent size change

This commit is contained in:
Guldoman 2022-07-15 06:52:50 +02:00
parent 86d45458f8
commit d7f9b30d05
No known key found for this signature in database
GPG Key ID: EA928C8BDA1A8825
1 changed files with 3 additions and 1 deletions

View File

@ -196,16 +196,18 @@ function DocView:draw_line_text(idx, x, y)
local font = (self:get_font() or style.syntax_fonts["whitespace"] or style.syntax_fonts["comment"])
local font_size = font:get_size()
local _, indent_size = self.doc:get_indent_info()
reset_cache_if_needed()
if
not ws_cache[self.doc.highlighter]
or ws_cache[self.doc.highlighter].font ~= font
or ws_cache[self.doc.highlighter].font_size ~= font_size
or ws_cache[self.doc.highlighter].indent_size ~= indent_size
then
ws_cache[self.doc.highlighter] =
setmetatable(
{ font = font, font_size = font_size },
{ font = font, font_size = font_size, indent_size = indent_size },
{ __mode = "k" }
)
end