From 6321bc4d638c2d2584b539e5755da9edebe10eec Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 16 Jul 2013 16:05:48 -0400 Subject: Save window maximized state in sessions. Also ensure backward-compatibility with existing session files. --- modules/textadept/session.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua index a7cd6dae..d9783512 100644 --- a/modules/textadept/session.lua +++ b/modules/textadept/session.lua @@ -89,8 +89,9 @@ function M.load(filename) elseif line:find('^current_view:') then current_view = tonumber(line:match('^current_view: (%d+)')) or 1 elseif line:find('^size:') then - local width, height = line:match('^size: (%d+) (%d+)$') - if width and height then gui.size = {width, height} end + local maximized, width, height = line:match('^size: (%l*) ?(%d+) (%d+)$') + maximized = maximized == 'true' + if maximized then gui.maximized = true else gui.size = {width, height} end elseif line:find('^recent:') then local filename = line:match('^recent: (.+)$') local recent, exists = io.recent_files, false @@ -179,8 +180,8 @@ function M.save(filename) -- Write out the current focused view. session[#session + 1] = ("current_view: %d"):format(_VIEWS[view]) -- Write out other things. - local size = gui.size - session[#session + 1] = ("size: %d %d"):format(size[1], size[2]) + local maximized, size = tostring(gui.maximized), gui.size + session[#session + 1] = ("size: %s %d %d"):format(maximized, size[1], size[2]) for i = 1, #io.recent_files do if i > M.MAX_RECENT_FILES then break end session[#session + 1] = ("recent: %s"):format(io.recent_files[i]) -- cgit v1.2.3