diff options
author | 2021-04-30 18:40:06 -0400 | |
---|---|---|
committer | 2021-04-30 18:40:06 -0400 | |
commit | 715901363a02634f5336c0d3f18cbd9a9c080b4a (patch) | |
tree | 315146ace595595cefe4e6b4eae01c475a21a85b /modules/textadept/bookmarks.lua | |
parent | a775e9fb4188f2638111c15623ea9bd5c804b3e2 (diff) | |
download | textadept-715901363a02634f5336c0d3f18cbd9a9c080b4a.tar.gz textadept-715901363a02634f5336c0d3f18cbd9a9c080b4a.zip |
Replaced `events.FILE_{BEFORE,AFTER}_RELOAD` with `events.BUFFER_{BEFORE,AFTER}_REPLACE_TEXT`.
This allows more features to save/restore state when buffer contents are replaced (e.g. file
reload, filter through, etc.)
Diffstat (limited to 'modules/textadept/bookmarks.lua')
-rw-r--r-- | modules/textadept/bookmarks.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/textadept/bookmarks.lua b/modules/textadept/bookmarks.lua index 532d1427..5f919e3d 100644 --- a/modules/textadept/bookmarks.lua +++ b/modules/textadept/bookmarks.lua @@ -80,10 +80,11 @@ function M.goto_mark(next) end local lines = {} --- Save and restore bookmarks on buffer:reload(). -events.connect(events.FILE_BEFORE_RELOAD, +-- Save and restore bookmarks when replacing buffer text (e.g. buffer:reload(), +-- textadept.editing.filter_through()). +events.connect(events.BUFFER_BEFORE_REPLACE_TEXT, function() for line in bookmarks(buffer) do lines[#lines + 1] = line end end) -events.connect(events.FILE_AFTER_RELOAD, function() +events.connect(events.BUFFER_AFTER_REPLACE_TEXT, function() for _, line in ipairs(lines) do buffer:marker_add(line, M.MARK_BOOKMARK) end lines = {} -- clear end) |