Skip to content
Snippets Groups Projects
Commit f1fc9665 authored by dg's avatar dg
Browse files

Chat filter options are now correctly saved when changed

Chat log dialog will not scroll on new messages if not at the bottom


git-svn-id: http://svn.net-core.org/repos/t-engine4@4407 51575b47-30f0-44d4-a5cc-537603b46e54
parent b2906fb8
No related branches found
No related tags found
No related merge requests found
......@@ -52,8 +52,10 @@ end
function _M:unload()
local l = {}
for k, _ in pairs(config.settings.chat.filter) do
l[#l+1] = "chat.filter."..k.."=true"
for k, v in pairs(config.settings.chat.filter) do
if v then l[#l+1] = "chat.filter."..k.."=true" end
end
table.print(config.settings.chat.filter)
print("===", table.concat(l, "\n"))
game:saveSettings("chat.filter", table.concat(l, "\n"))
end
......@@ -127,7 +127,7 @@ function _M:mouseEvent(button, x, y, xrel, yrel, bx, by, event)
end
end
function _M:loadLog(log)
function _M:loadLog(log, oldscroll)
self.lines = {}
for i = #log, 1, -1 do
if type(log[i]) == "string" then
......@@ -143,7 +143,7 @@ function _M:loadLog(log)
self.scrollbar.max = self.max - self.max_display + 1
self.scroll = nil
self:setScroll(self.max - self.max_display + 1)
self:setScroll(oldscroll or (self.max - self.max_display + 1))
end
function _M:switchTo(ui)
......@@ -155,7 +155,11 @@ function _M:switchTo(ui)
if ui.tab_channel == "__log" then
self:loadLog(self.log:getLog())
else
self:loadLog(self.chat:getLog(ui.tab_channel, true))
local s = nil
if _M.last_tab == ui.tab_channel and self.scroll < self.max - self.max_display + 1 then
s = self.scroll
end
self:loadLog(self.chat:getLog(ui.tab_channel, true), s)
end
-- Set it on the class to persist between invocations
_M.last_tab = ui.tab_channel
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment