mirror of
https://github.com/Lacustat/Freewood-OctoWoW-Core.git
synced 2026-11-05 02:17:08 +00:00
0.1.234: Kanaele: LFT-Log zeigt nur die letzten ca. 4000 Zeichen, aktualisiert hoechstens alle 1,5 s und bleibt stehen, wenn man hochscrollt oder markiert [ungeprueft]
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016onJCSHLwhs9udhC9ZLzk9
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
c3f7db4d45
commit
c6ce03ba60
@@ -3,7 +3,7 @@
|
||||
## Notes: Base addon of the Freewood family: data storage, UI kit, export/import and the main window.
|
||||
## Notes-deDE: Basis-Addon der Freewood-Familie: Datenspeicher, UI-Bausteine, Export/Import und Hauptfenster.
|
||||
## Author: Lacustat
|
||||
## Version: 0.1.233
|
||||
## Version: 0.1.234
|
||||
## SavedVariables: FreewoodDB
|
||||
## SavedVariablesPerCharacter: FreewoodCharDB
|
||||
|
||||
|
||||
+32
-19
@@ -10,7 +10,7 @@ local CL = FW.ChatLog
|
||||
local WIDE_W, NARROW_W, RIGHT_W = 270, 56, 220
|
||||
local ROW = 24
|
||||
local MAX_BUBBLES = 60
|
||||
local LOG_LINES = 200
|
||||
local LOG_CHARS = 4000
|
||||
local LOGO = "Interface\\AddOns\\Freewood-OctoWoW-Core\\Media\\FreeWood_Logo.tga"
|
||||
local QMARK = "Interface\\Icons\\INV_Misc_QuestionMark"
|
||||
|
||||
@@ -959,30 +959,43 @@ local function Build(content)
|
||||
return n
|
||||
end
|
||||
|
||||
local logT = 0
|
||||
local function DrawLog(key)
|
||||
local lines = CL.Lines(key) or {}
|
||||
local n = table.getn(lines)
|
||||
local first = math.max(1, n - LOG_LINES + 1)
|
||||
-- nur die letzten ca. LOG_CHARS Zeichen zeigen, damit das Fenster ruhig bleibt
|
||||
local parts = {}
|
||||
local i = first
|
||||
while i <= n do
|
||||
local total = 0
|
||||
local i = n
|
||||
while i >= 1 do
|
||||
local ln = lines[i]
|
||||
parts[table.getn(parts) + 1] = "[" .. Stamp(ln.t, L) .. "] " .. (ln.s or "?") .. ": " .. Plain(ln.m or "")
|
||||
i = i + 1
|
||||
local row = "[" .. Stamp(ln.t, L) .. "] " .. (ln.s or "?") .. ": " .. Plain(ln.m or "")
|
||||
total = total + string.len(row) + 1
|
||||
if total > LOG_CHARS and table.getn(parts) > 0 then break end
|
||||
parts[table.getn(parts) + 1] = row
|
||||
i = i - 1
|
||||
end
|
||||
if not logArea.edit:HasFocus() then
|
||||
local text = table.concat(parts, "\n")
|
||||
if logArea.lastText ~= text then
|
||||
logArea.lastText = text
|
||||
logArea:SetText(text)
|
||||
if C_Timer and C_Timer.After then
|
||||
C_Timer.After(0.15, function()
|
||||
local h = logArea.child:GetHeight() or 0
|
||||
local v = logArea.scroll:GetHeight() or 0
|
||||
logArea.scroll:SetVerticalScroll(math.max(0, h - v))
|
||||
logArea.UpdateScroll()
|
||||
end)
|
||||
end
|
||||
-- Reihenfolge umdrehen (aelteste oben)
|
||||
local ordered, k = {}, table.getn(parts)
|
||||
while k >= 1 do ordered[table.getn(ordered) + 1] = parts[k]; k = k - 1 end
|
||||
local text = table.concat(ordered, "\n")
|
||||
local now = (GetTime and GetTime()) or 0
|
||||
local h = logArea.child:GetHeight() or 0
|
||||
local v = logArea.scroll:GetHeight() or 0
|
||||
local atBottom = (logArea.scroll:GetVerticalScroll() >= h - v - 24)
|
||||
-- beim Lesen (oben/markiert) nichts verschieben; sonst hoechstens alle 1,5 s aktualisieren
|
||||
local calm = logArea.edit:HasFocus() or (not atBottom and logArea.lastText ~= nil)
|
||||
if not calm and logArea.lastText ~= text and (now - logT >= 1.5 or logArea.lastText == nil) then
|
||||
logT = now
|
||||
logArea.lastText = text
|
||||
logArea:SetText(text)
|
||||
if C_Timer and C_Timer.After then
|
||||
C_Timer.After(0.15, function()
|
||||
local h2 = logArea.child:GetHeight() or 0
|
||||
local v2 = logArea.scroll:GetHeight() or 0
|
||||
logArea.scroll:SetVerticalScroll(math.max(0, h2 - v2))
|
||||
logArea.UpdateScroll()
|
||||
end)
|
||||
end
|
||||
end
|
||||
return n
|
||||
|
||||
Reference in New Issue
Block a user