Fixed inline Icons counting towards Line length
This commit is contained in:
1 parent
daadfa38f1
commit
8afdae66ab
1 file changed
+6
-4
@@ -177,16 +177,18 @@ end
|
|||||||
function printBulletPoints(description, padding)
|
function printBulletPoints(description, padding)
|
||||||
local textboxWidth = tonumber(EIDConfig["TextboxWidth"]) * 4
|
local textboxWidth = tonumber(EIDConfig["TextboxWidth"]) * 4
|
||||||
description = EID:replaceShortMarkupStrings(description)
|
description = EID:replaceShortMarkupStrings(description)
|
||||||
|
|
||||||
for line in string.gmatch(description, "([^#]+)") do
|
for line in string.gmatch(description, "([^#]+)") do
|
||||||
|
line = string.gsub(line, "([^%s])({{)", function(a,b) return a.." "..b end) -- add space between icons, if not already existing
|
||||||
local formatedLines = {}
|
local formatedLines = {}
|
||||||
local text = ""
|
local text = ""
|
||||||
local curLength = 0
|
local curLength = 0
|
||||||
for word in string.gmatch(line, "([^ ]+)") do
|
for word in string.gmatch(line, "([^%s]+)") do
|
||||||
local wordLength = EID:getStrWidth(word)
|
local wordLength = EID:getStrWidth(word)
|
||||||
if EID:getIcon(word) ~= nil then
|
if EID:getIcon(word) ~= EID.InlineIcons["ERROR"] then
|
||||||
wordLength = EID:getIcon(word)[3]
|
wordLength = EID:getIcon(word)[3]
|
||||||
end
|
end
|
||||||
if curLength + wordLength <= textboxWidth or curLength < 25 then
|
if curLength + wordLength <= textboxWidth or curLength < 12 then
|
||||||
text = text .. word .. " "
|
text = text .. word .. " "
|
||||||
curLength = curLength + wordLength
|
curLength = curLength + wordLength
|
||||||
else
|
else
|
||||||
@@ -202,7 +204,7 @@ function printBulletPoints(description, padding)
|
|||||||
local posX = EIDConfig["XPosition"]
|
local posX = EIDConfig["XPosition"]
|
||||||
if i == 1 then
|
if i == 1 then
|
||||||
local bpIcon = EID:handleBulletpointIcon(lineToPrint)
|
local bpIcon = EID:handleBulletpointIcon(lineToPrint)
|
||||||
if EID:getIcon(bpIcon) ~= nil then
|
if EID:getIcon(bpIcon) ~= EID.InlineIcons["ERROR"] then
|
||||||
lineToPrint = string.gsub(lineToPrint, bpIcon .. " ", "")
|
lineToPrint = string.gsub(lineToPrint, bpIcon .. " ", "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user