From e340f75841ee0a3328d395e67f5e01c0c1bd4831 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 17 Mar 2015 10:51:47 -0400 Subject: Allow bookmarks to be toggled on specific lines; modules/textadept/bookmarks.lua Thanks to Lance Larsen. --- modules/textadept/bookmarks.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'modules') 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) -- cgit v1.2.3