From 4be899557a0700c7d4de6ff45632d943fb6cedd2 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 7 Jul 2009 18:04:32 -0400 Subject: Save PM cursor over sessions; core/file_io.lua --- core/file_io.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'core') 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 -- cgit v1.2.3