restore-chat: reduce lag, 500+ messages!
still starts to freeze at 1500, was 200-500 before to start freezing.
This commit is contained in:
+4
-11
@@ -13315,30 +13315,26 @@ function LeaPlusLC:Player()
|
|||||||
local num = chatFrame:GetNumMessages()
|
local num = chatFrame:GetNumMessages()
|
||||||
if num == 0 then return end
|
if num == 0 then return end
|
||||||
|
|
||||||
local start = 1 -- or picked offset
|
local lines = {}
|
||||||
local count = 0
|
local count = 0
|
||||||
for i = start, num do
|
for i = 1, num do
|
||||||
local msg, _, lineID = chatFrame:GetMessageInfo(i)
|
local msg, _, lineID = chatFrame:GetMessageInfo(i)
|
||||||
if msg then
|
if msg then
|
||||||
-- strip icons/atlases
|
|
||||||
msg = gsub(msg, "|T.-|t", "")
|
msg = gsub(msg, "|T.-|t", "")
|
||||||
msg = gsub(msg, "|A.-|a", "")
|
msg = gsub(msg, "|A.-|a", "")
|
||||||
|
|
||||||
-- pick up the right color
|
|
||||||
local info = ChatTypeInfo[ chatTypeIndexToName[lineID] ]
|
local info = ChatTypeInfo[ chatTypeIndexToName[lineID] ]
|
||||||
local r,g,b = (info and info.r) or 1, (info and info.g) or 1, (info and info.b) or 1
|
local r,g,b = (info and info.r) or 1, (info and info.g) or 1, (info and info.b) or 1
|
||||||
|
|
||||||
-- wrap in hex + reset
|
|
||||||
local hex = format("|cff%02x%02x%02x", r*255, g*255, b*255)
|
local hex = format("|cff%02x%02x%02x", r*255, g*255, b*255)
|
||||||
msg = hex .. msg:gsub("|r","|r"..hex) .. "|r"
|
msg = hex .. msg:gsub("|r","|r"..hex) .. "|r"
|
||||||
|
|
||||||
edit:Insert(msg)
|
table.insert(lines, msg)
|
||||||
edit:Insert("\n")
|
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
title.count:SetText("Messages: "..count)
|
title.count:SetText("Messages: "..count)
|
||||||
|
edit:SetText(table.concat(lines, "\n"))
|
||||||
ResizeEdit(count)
|
ResizeEdit(count)
|
||||||
|
|
||||||
local function ScrollToBottomReliable(scroll, edit, maxAttempts)
|
local function ScrollToBottomReliable(scroll, edit, maxAttempts)
|
||||||
@@ -13361,9 +13357,6 @@ function LeaPlusLC:Player()
|
|||||||
end
|
end
|
||||||
|
|
||||||
ScrollToBottomReliable(scroll, edit)
|
ScrollToBottomReliable(scroll, edit)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
frame:Show()
|
frame:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user