Skip to content

Commit

Permalink
Merge pull request #4 from grimmier378/dev
Browse files Browse the repository at this point in the history
Fix: buffer
  • Loading branch information
grimmier378 committed Mar 16, 2024
2 parents cfa2c11 + ac5ced7 commit 8a8dc94
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions init.lua
Expand Up @@ -116,22 +116,35 @@ function ChatWin.EventChat(channelID, eventName, line)
local i = getNextID(txtBuffer)
-- Convert RGB vector to ImGui color code
local colorCode = IM_COL32(colorVec[1] * 255, colorVec[2] * 255, colorVec[3] * 255, 255)
-- write channel console
if ChatWin.Consoles[channelID].console then
ChatWin.Consoles[channelID].console:AppendText(colorCode, line)
end
-- write main console
console:AppendText(colorCode,line)
-- ZOOM Console hack
if txtBuffer[i-1].text == '' then i = i-1 end
-- Add the new line to the buffer
txtBuffer[i] = {
color = colorVec,
text = line
}
console:AppendText(colorCode, line)
-- cleanup zoom buffer
-- Check if the buffer exceeds 1000 lines
local bufferLength = #txtBuffer
if bufferLength > 1000 then
-- Remove excess lines
for j = 1, bufferLength - 1000 do
table.remove(txtBuffer, 1)
end
end
else
print("Error: txtBuffer is nil for channelID " .. channelID)
end
else
print("Error: ChatWin.Consoles[channelID] is nil for channelID " .. channelID)
end

end
end
-- Variable to track last scroll position
function ChatWin.GUI()

Expand Down

0 comments on commit 8a8dc94

Please sign in to comment.