diff options
author | 2015-03-17 10:51:47 -0400 | |
---|---|---|
committer | 2015-03-17 10:51:47 -0400 | |
commit | e340f75841ee0a3328d395e67f5e01c0c1bd4831 (patch) | |
tree | 1e70415ce799f2743a6be387261e18eed7be1446 /modules/textadept | |
parent | 39b5f8728fdd215217d2749c20a2668ecbb5f080 (diff) | |
download | textadept-e340f75841ee0a3328d395e67f5e01c0c1bd4831.tar.gz textadept-e340f75841ee0a3328d395e67f5e01c0c1bd4831.zip |
Allow bookmarks to be toggled on specific lines; modules/textadept/bookmarks.lua
Thanks to Lance Larsen.
Diffstat (limited to 'modules/textadept')
-rw-r--r-- | modules/textadept/bookmarks.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua index 7ced37c7..e37d31fa 100644 --- a/modules/textadept/bookmarks.lua +++ b/modules/textadept/bookmarks.lua @@ -12,13 +12,16 @@ module('textadept.bookmarks')]] M.MARK_BOOKMARK = _SCINTILLA.next_marker_number() --- --- Toggles the bookmark on the current line unless *on* is given. +-- Toggles the bookmark on line number *line* or the current line, unless *on* +-- is given. -- If *on* is `true` or `false`, adds or removes the bookmark, respectively. --- @param on Optional flag indicating whether to add or remove a bookmark on the --- current line. The default value is `nil`, toggling a bookmark. +-- @param on Optional flag indicating whether to add or remove a bookmark on +-- line *line* or the current line. The default value is `nil`, toggling a +-- bookmark. +-- @param line Optional line number to add or remove a bookmark on. -- @name toggle -function M.toggle(on) - local line = buffer:line_from_position(buffer.current_pos) +function M.toggle(on, line) + line = line or buffer:line_from_position(buffer.current_pos) local f = on and buffer.marker_add or buffer.marker_delete if on == nil then -- toggle local bit, marker_mask = 2^M.MARK_BOOKMARK, buffer:marker_get(line) |