Fixed Stat+color markup bullet point icon handling causing visual glitches

This commit is contained in:
Wofsauge committed 2025-03-25 22:07:51 +01:00
1 parent 21be5a3d2d
commit f87f26758a
2 files changed
+19 -7

No files matched your search

+14 -5
View File
@@ -1321,12 +1321,21 @@ end
---@param text string
---@return string, string?
function EID:handleBulletpointIcon(text)
local firstWord = EID:removeColorMarkup(string.match(text, "([^%s]+)"))
if EID:getIcon(firstWord) ~= EID.InlineIcons["ERROR"] and string.find(firstWord, "{{.-}}")~=nil then
if not EID.Config["StatAndPickupBulletpoints"] and EID.StatPickupBulletpointBlacklist[firstWord] then
return "\007", firstWord
-- Find the position where '}}' is followed by a space or letter
local firstMarkupPos, _ = string.find(text, "{{.-}}")
local startPos, endPos = string.find(text, "}}%s")
-- check if string starts with markup and has
if firstMarkupPos and startPos and firstMarkupPos == 1 then
-- The split should be right after '}}', so adjust the position
local firstWord = string.sub(text, 1, endPos - 1)
firstWord = EID:removeColorMarkup(firstWord)
if EID:getIcon(firstWord) ~= EID.InlineIcons["ERROR"] and string.find(firstWord, "{{.-}}")~=nil then
if not EID.Config["StatAndPickupBulletpoints"] and EID.StatPickupBulletpointBlacklist[firstWord] then
return "\007", firstWord
end
return firstWord
end
return firstWord
end
return "\007"
end