diff options
author | 2020-03-03 19:39:02 -0500 | |
---|---|---|
committer | 2020-03-03 19:39:02 -0500 | |
commit | fceb1a37df623649d191c3c1a881e5b0538b1391 (patch) | |
tree | 87a34dfc2397dc4afdaa0c8ec189f037300f458e /modules/textadept/bookmarks.lua | |
parent | 1618f5017abb3c9bacc9ba346bf22a936ef5dd06 (diff) | |
download | textadept-fceb1a37df623649d191c3c1a881e5b0538b1391.tar.gz textadept-fceb1a37df623649d191c3c1a881e5b0538b1391.zip |
Added test suite and API type checking for more helpful error messages.
Diffstat (limited to 'modules/textadept/bookmarks.lua')
-rw-r--r-- | modules/textadept/bookmarks.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua index 47cf751f..29a68c1c 100644 --- a/modules/textadept/bookmarks.lua +++ b/modules/textadept/bookmarks.lua @@ -21,6 +21,7 @@ M.MARK_BOOKMARK = _SCINTILLA.next_marker_number() -- @param line Optional line number to add or remove a bookmark on. -- @name toggle function M.toggle(on, line) + assert_type(line, 'number/nil', 2) if not line then line = buffer:line_from_position(buffer.current_pos) end local f = on and buffer.marker_add or buffer.marker_delete if on == nil then -- toggle @@ -50,10 +51,9 @@ function M.goto_mark(next) local utf8_list, buffers = {}, {} -- List the current buffer's marks, and then all other buffers' marks. for _, current_buffer_first in ipairs{true, false} do - for i = 1, #_BUFFERS do - if current_buffer_first and _BUFFERS[i] == buffer or - not current_buffer_first and _BUFFERS[i] ~= buffer then - local buffer = _BUFFERS[i] + for _, buffer in ipairs(_BUFFERS) do + if current_buffer_first and buffer == _G.buffer or + not current_buffer_first and buffer ~= _G.buffer then local basename = (buffer.filename or ''):match('[^/\\]+$') or buffer._type or _L['Untitled'] if buffer.filename then |