diff options
author | 2011-01-19 23:11:40 -0500 | |
---|---|---|
committer | 2011-01-19 23:11:40 -0500 | |
commit | 2247eeb38c71da492cb96711e133b353e7c3129d (patch) | |
tree | 7d87c78cc910b0ef0c9bdcf5863760593a762ccb /modules/textadept/bookmarks.lua | |
parent | bfe8c3cc714fd122b5945ddc83b9d27ca97e26fb (diff) | |
download | textadept-2247eeb38c71da492cb96711e133b353e7c3129d.tar.gz textadept-2247eeb38c71da492cb96711e133b353e7c3129d.zip |
Can navigate between bookmarks with a filteredlist.
Diffstat (limited to 'modules/textadept/bookmarks.lua')
-rw-r--r-- | modules/textadept/bookmarks.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua index d7efb467..072cca67 100644 --- a/modules/textadept/bookmarks.lua +++ b/modules/textadept/bookmarks.lua @@ -73,6 +73,21 @@ function goto_prev() if line >= 0 then _m.textadept.editing.goto_line(line + 1) end end +--- +-- Goes to selected bookmark from a filtered list. +function goto() + local buffer = buffer + local markers, line = {}, buffer:marker_next(0, 2^MARK_BOOKMARK) + if line == -1 then return end + repeat + local text = buffer:get_line(line):sub(1, -2) -- chop \n + markers[#markers + 1] = table.concat({ line + 1, text }, ': ') + line = buffer:marker_next(line + 1, 2^MARK_BOOKMARK) + until line < 0 + local line = gui.filteredlist(L('Select Bookmark'), 'Bookmark', markers) + if line then _m.textadept.editing.goto_line(tonumber(line:match('^%d+'))) end +end + if buffer then buffer:marker_set_back(MARK_BOOKMARK, MARK_BOOKMARK_COLOR) end events.connect('view_new', function() buffer:marker_set_back(MARK_BOOKMARK, MARK_BOOKMARK_COLOR) end) |