diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2009-07-07 18:04:32 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2009-07-07 18:04:32 -0400 |
commit | 4be899557a0700c7d4de6ff45632d943fb6cedd2 (patch) | |
tree | b42b315eaf01bd7128bd31d8d7462b0c953955cc /core/file_io.lua | |
parent | e3465214ff873069305386ca3584002f89107976 (diff) |
Save PM cursor over sessions; core/file_io.lua
Diffstat (limited to 'core/file_io.lua')
-rw-r--r-- | core/file_io.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/file_io.lua b/core/file_io.lua index 45f38629..68cb777a 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -367,10 +367,11 @@ function load_session(filename, only_pm) local width, height = line:match('^size: (%d+) (%d+)$') if width and height then textadept.size = { width, height } end elseif line:find('^pm:') then - local width, text = line:match('^pm: (%d+) (.+)$') + local width, cursor, text = line:match('^pm: (%d+) ([%d:]+) (.+)$') textadept.pm.width = width or 0 textadept.pm.entry_text = text or '' textadept.pm.activate() + if cursor then textadept.pm.cursor = cursor end end end f:close() @@ -441,7 +442,8 @@ function save_session(filename) local size = textadept.size session[#session + 1] = ("size: %d %d"):format(size[1], size[2]) local pm = textadept.pm - session[#session + 1] = ("pm: %d %s"):format(pm.width, pm.entry_text) + session[#session + 1] = + ("pm: %d %s %s"):format(pm.width, pm.cursor or '0', pm.entry_text) -- Write the session. local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE') if not user_dir then return end |