diff options
author | 2020-10-20 15:29:03 -0400 | |
---|---|---|
committer | 2020-10-20 15:29:03 -0400 | |
commit | 03c4016d07477781aa3adcc9edf340c0bec9c6c8 (patch) | |
tree | d3be089e9020807326a4e56562876ecb7bcf7892 /modules/textadept/bookmarks.lua | |
parent | b682fbd4a6e53185e2556686079532ad0e42be94 (diff) | |
download | textadept-03c4016d07477781aa3adcc9edf340c0bec9c6c8.tar.gz textadept-03c4016d07477781aa3adcc9edf340c0bec9c6c8.zip |
Code cleanup.
Of note:
* io.save_all_files() does not visit each buffer to save anymore. An unintended
side-effect was checking for outside modification (but only if the file itself
was modified), so outside changes will always be saved over now.
* The menu clicked handler uses assert_type(), so the 'Unknown command'
localization is no longer needed.
* When printing to a new buffer type would split the view, use an existing split
view when possible.
* Prefer 'goto continue' construct in loops over nested 'if's.
* Fixed clearing of ui.find.replace_entry_text on reset in the GUI version.
* Fixed lack of statusbar updating when setting options like buffer EOL mode,
indentation, and encoding.
* Renamed internal new_snippet() to new() and put it in the snippet metatable.
Diffstat (limited to 'modules/textadept/bookmarks.lua')
-rw-r--r-- | modules/textadept/bookmarks.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua index c21f5dc4..de6f7470 100644 --- a/modules/textadept/bookmarks.lua +++ b/modules/textadept/bookmarks.lua @@ -28,10 +28,10 @@ function M.clear() buffer:marker_delete_all(M.MARK_BOOKMARK) end -- Returns an iterator for all bookmarks in the given buffer. local function bookmarks(buffer) - return function(_, line) + return function(buffer, line) line = buffer:marker_next(line + 1, 1 << M.MARK_BOOKMARK - 1) return line >= 1 and line or nil - end, nil, 0 + end, buffer, 0 end --- @@ -46,17 +46,17 @@ end function M.goto_mark(next) if next ~= nil then local f = next and buffer.marker_next or buffer.marker_previous - local current_line = buffer:line_from_position(buffer.current_pos) + local line = buffer:line_from_position(buffer.current_pos) local BOOKMARK_BIT = 1 << M.MARK_BOOKMARK - 1 - local line = f(buffer, current_line + (next and 1 or -1), BOOKMARK_BIT) + line = f(buffer, line + (next and 1 or -1), BOOKMARK_BIT) if line == -1 then line = f(buffer, (next and 1 or buffer.line_count), BOOKMARK_BIT) end if line >= 1 then textadept.editing.goto_line(line) end return end - local scan_this_buffer, utf8_list, buffers = true, {}, {} -- List the current buffer's marks, and then all other buffers' marks. + local scan_this_buffer, utf8_list, buffers = true, {}, {} ::rescan:: for _, buffer in ipairs(_BUFFERS) do if not (scan_this_buffer == (buffer == _G.buffer)) then goto continue end |