Fixed Stat+color markup bullet point icon handling causing visual glitches
This commit is contained in:
1 parent
21be5a3d2d
commit
f87f26758a
2 files changed
+19
-7
No files matched your search
+14
-5
@@ -1321,12 +1321,21 @@ end
|
|||||||
---@param text string
|
---@param text string
|
||||||
---@return string, string?
|
---@return string, string?
|
||||||
function EID:handleBulletpointIcon(text)
|
function EID:handleBulletpointIcon(text)
|
||||||
local firstWord = EID:removeColorMarkup(string.match(text, "([^%s]+)"))
|
-- Find the position where '}}' is followed by a space or letter
|
||||||
if EID:getIcon(firstWord) ~= EID.InlineIcons["ERROR"] and string.find(firstWord, "{{.-}}")~=nil then
|
local firstMarkupPos, _ = string.find(text, "{{.-}}")
|
||||||
if not EID.Config["StatAndPickupBulletpoints"] and EID.StatPickupBulletpointBlacklist[firstWord] then
|
local startPos, endPos = string.find(text, "}}%s")
|
||||||
return "\007", firstWord
|
|
||||||
|
-- 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
|
end
|
||||||
return firstWord
|
|
||||||
end
|
end
|
||||||
return "\007"
|
return "\007"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -753,14 +753,17 @@ function EID:printBulletPoints(description, renderPos)
|
|||||||
if i == 1 then
|
if i == 1 then
|
||||||
local bpIcon, rejectedIcon = EID:handleBulletpointIcon(lineToPrint)
|
local bpIcon, rejectedIcon = EID:handleBulletpointIcon(lineToPrint)
|
||||||
if EID:getIcon(bpIcon) ~= EID.InlineIcons["ERROR"] then
|
if EID:getIcon(bpIcon) ~= EID.InlineIcons["ERROR"] then
|
||||||
lineToPrint = string.gsub(lineToPrint, bpIcon .. " ", "", 1)
|
lineToPrint = string.gsub(lineToPrint, bpIcon, "", 1)
|
||||||
textColor = EID:renderString(bpIcon, renderPos + Vector(-3 * EID.Scale, 0), textScale , textColor, true)
|
textColor = EID:renderString(bpIcon, renderPos + Vector(-3 * EID.Scale, 0), textScale , textColor, true)
|
||||||
else
|
else
|
||||||
if rejectedIcon then lineToPrint = string.gsub(lineToPrint, rejectedIcon .. " ", "", 1) end
|
if rejectedIcon then lineToPrint = string.gsub(lineToPrint, rejectedIcon, "", 1) end
|
||||||
textColor = EID:renderString(bpIcon, renderPos, textScale , textColor)
|
textColor = EID:renderString(bpIcon, renderPos, textScale , textColor)
|
||||||
end
|
end
|
||||||
EID.LastRenderCallColor = EID:copyKColor(textColor) -- Save line start Color for eventual Color Reset call
|
EID.LastRenderCallColor = EID:copyKColor(textColor) -- Save line start Color for eventual Color Reset call
|
||||||
end
|
end
|
||||||
|
-- Remove leading spaces
|
||||||
|
lineToPrint = lineToPrint:match('^%s*(.*)')
|
||||||
|
-- render text
|
||||||
textColor = EID:renderString(lineToPrint, renderPos + Vector(12 * EID.Scale, 0), textScale, textColor)
|
textColor = EID:renderString(lineToPrint, renderPos + Vector(12 * EID.Scale, 0), textScale, textColor)
|
||||||
renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale
|
renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user