aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2015-10-19 09:27:36 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2015-10-19 09:27:36 -0400
commit4971a66d6a675edef2a9ec53cee29e46d75ea0f9 (patch)
treeab6c86117424b081bce4d8436229d16151383a6c /modules/textadept
parent9e946e02a87b5880e4977f7804f5498e46fe92f4 (diff)
downloadtextadept-4971a66d6a675edef2a9ec53cee29e46d75ea0f9.tar.gz
textadept-4971a66d6a675edef2a9ec53cee29e46d75ea0f9.zip
Save bookmarks in sessions; modules/textadept/session.lua
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/session.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua
index 1986e9d3..dcdee22d 100644
--- a/modules/textadept/session.lua
+++ b/modules/textadept/session.lua
@@ -91,6 +91,12 @@ function M.load(filename)
if file == recent[i] then exists = true break end
end
if not exists then recent[#recent + 1] = file end
+ elseif line:find('^bookmarks:') then
+ local i, lines = line:match('^bookmarks: (%d+) (.*)$')
+ local buffer = _BUFFERS[tonumber(i)]
+ for line in lines:gmatch('%d+') do
+ buffer:marker_add(tonumber(line), textadept.bookmarks.MARK_BOOKMARK)
+ end
end
end
f:close()
@@ -175,6 +181,16 @@ function M.save(filename)
if i > M.MAX_RECENT_FILES then break end
session[#session + 1] = ("recent: %s"):format(io.recent_files[i])
end
+ for i, buffer in ipairs(_BUFFERS) do
+ local lines = {}
+ local line = buffer:marker_next(0, 2^textadept.bookmarks.MARK_BOOKMARK)
+ while line >= 0 do
+ lines[#lines + 1] = line
+ line = buffer:marker_next(line + 1, 2^textadept.bookmarks.MARK_BOOKMARK)
+ end
+ lines = table.concat(lines, ' ')
+ session[#session + 1] = ("bookmarks: %d %s"):format(i, lines)
+ end
-- Write the session.
local f = io.open(filename, 'wb')
if f then