Browse Source

restoring scroll positions when loading a client config

master
Youen Toupin 8 years ago
parent
commit
fae5d84e91
  1. 29
      server/wxLdb/wxLdbController.lua

29
server/wxLdb/wxLdbController.lua

@ -427,7 +427,7 @@ end
function meta.__index:refreshScrollPosition_() function meta.__index:refreshScrollPosition_()
local config = self:getActiveClientConfig_() local config = self:getActiveClientConfig_()
for source, sp in pairs( config.scrollPositions ) do for source, sp in pairs( config.scrollPositions ) do
local page = self.window:getSourcePage( source ) local page = self.window:getSourcePage( source )
if page ~= nil then if page ~= nil then
@ -815,11 +815,26 @@ function meta.__index:loadConfig_( name )
file:close() file:close()
clientConfig.mappings = config.mappings clientConfig.mappings = config.mappings
clientConfig.breakOnConnection = config.breakOnConnection clientConfig.breakOnConnection = config.breakOnConnection
if config.scrollPositions ~= nil then
for source, sp in pairs( config.scrollPositions ) do
clientConfig.scrollPositions[source] = sp
end
end
for _, file in ipairs( config.openFiles ) do for _, file in ipairs( config.openFiles ) do
self.window:getSourcePage( file ) local page = self.window:getSourcePage( file )
if page ~= nil then
local sp = clientConfig.scrollPositions[file]
print("scroll to", sp)
if sp ~= nil then
page:SetScrollPos(sp)
end
end
end end
if config.breakpoints ~= nil then
for source, bp in pairs( config.breakpoints ) do if clientConfig.breakpoints ~= nil then
for source, bp in pairs( clientConfig.breakpoints ) do
if clientConfig.breakpoints[source] == nil then if clientConfig.breakpoints[source] == nil then
clientConfig.breakpoints[source] = {} clientConfig.breakpoints[source] = {}
end end
@ -828,12 +843,6 @@ function meta.__index:loadConfig_( name )
end end
end end
end end
if config.scrollPositions ~= nil then
for source, sp in pairs( config.scrollPositions ) do
clientConfig.scrollPositions[source] = sp
end
end
end end
if clientConfig.breakOnConnection == nil then if clientConfig.breakOnConnection == nil then
clientConfig.breakOnConnection = true clientConfig.breakOnConnection = true

Loading…
Cancel
Save