diff --git a/features/eid_api.lua b/features/eid_api.lua index c9322249..84670e08 100644 --- a/features/eid_api.lua +++ b/features/eid_api.lua @@ -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 diff --git a/main.lua b/main.lua index 97caca07..cb36699a 100644 --- a/main.lua +++ b/main.lua @@ -753,14 +753,17 @@ function EID:printBulletPoints(description, renderPos) if i == 1 then local bpIcon, rejectedIcon = EID:handleBulletpointIcon(lineToPrint) 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) 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) end EID.LastRenderCallColor = EID:copyKColor(textColor) -- Save line start Color for eventual Color Reset call end + -- Remove leading spaces + lineToPrint = lineToPrint:match('^%s*(.*)') + -- render text textColor = EID:renderString(lineToPrint, renderPos + Vector(12 * EID.Scale, 0), textScale, textColor) renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale end