aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept')
-rw-r--r--modules/textadept/bookmarks.lua15
-rw-r--r--modules/textadept/menu.lua1
2 files changed, 16 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)
diff --git a/modules/textadept/menu.lua b/modules/textadept/menu.lua
index a183996c..e3ef2576 100644
--- a/modules/textadept/menu.lua
+++ b/modules/textadept/menu.lua
@@ -210,6 +210,7 @@ menubar = {
{ L('_Clear All'), { m_bookmarks.clear } },
{ L('_Next'), { m_bookmarks.goto_next } },
{ L('_Previous'), { m_bookmarks.goto_prev } },
+ { L('_Goto Bookmark...'), { m_bookmarks.goto } },
},
{ title = L('Snap_open'),
{ L('_User Home'), { m_snapopen.open, _USERHOME } },