Skip to content

Commit 017a3ef

Browse files
committed
Ensured minimap works with invalid utf8 characters.
1 parent 73b671f commit 017a3ef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugins/minimap.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,13 @@ function MiniMap:draw()
490490
local start = 1
491491
while true do
492492
-- find text followed spaces followed by newline
493-
local s, e, w, eol = string.ufind(text, "[^%s]*()[ \t]*()\n?", start)
493+
local is_utf8 = text:ulen()
494+
local s, e, w, eol
495+
if is_utf8 then
496+
s, e, w, eol = text:ufind("[^%s]*()[ \t]*()\n?", start)
497+
else
498+
s, e, w, eol = text:find("[^%s]*()[ \t]*()\n?", start)
499+
end
494500
if not s then break end
495501
local nchars = w - s
496502
start = e + 1

0 commit comments

Comments
 (0)