Added {{Indent}} and {{IND}} to allow for bulletpoint indentations

closes #910
This commit is contained in:
Wofsauge committed 2025-09-27 22:39:07 +02:00
1 parent 9b00e86ff4
commit 86ebf590a6
3 files changed
+20 -4

No files matched your search

+11 -4
View File
@@ -767,30 +767,37 @@ end
function EID:printBulletPoints(description, renderPos, ignoreBPConfig)
local textboxWidth = tonumber(EID.Config["TextboxWidth"])
local textScale = Vector(EID.Scale, EID.Scale)
local textOffset = Vector(12 * EID.Scale, 0) -- offset of the text to the bullet point
local bulletpointOffset = Vector(-3 * EID.Scale, 0) -- offset of bulletpoint icons relative to the default bulletpoint
description = EID:replaceNameMarkupStrings(description)
description = EID:replaceShortMarkupStrings(description)
description = EID:replaceMarkupSize(description)
for line in string.gmatch(description, "([^#]+)") do
local numIndentations = 0
line, numIndentations = EID:handleTextIndentation(line)
local formatedLines = EID:fitTextToWidth(line, textboxWidth, EID.BreakUtf8CharsLanguage[EID:getLanguage()])
local textColor = EID:getTextColor()
local indentOffset = numIndentations * textOffset
for i, lineToPrint in ipairs(formatedLines) do
-- render bulletpoint
if i == 1 then
local bpIcon, rejectedIcon = EID:handleBulletpointIcon(lineToPrint, ignoreBPConfig)
if EID:getIcon(bpIcon) ~= EID.InlineIcons["ERROR"] then
lineToPrint = string.gsub(lineToPrint, bpIcon, "", 1)
textColor = EID:renderString(bpIcon, renderPos + Vector(-3 * EID.Scale, 0), textScale , textColor, true)
textColor = EID:renderString(bpIcon, renderPos + bulletpointOffset + indentOffset, textScale , textColor, true)
else
if rejectedIcon then lineToPrint = string.gsub(lineToPrint, rejectedIcon, "", 1) end
textColor = EID:renderString(bpIcon, renderPos, textScale , textColor)
textColor = EID:renderString(bpIcon, renderPos + indentOffset, 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
textColor = EID:renderString(lineToPrint, renderPos + textOffset + indentOffset, textScale, textColor)
renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale
end
end
return renderPos