From 14e524cf217250388d374433cf6f3241f66e4e01 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Sat, 19 Sep 2020 14:53:20 -0400 Subject: Added `events.FILE_{BEFORE,AFTER}_RELOAD` and save/restore bookmarks. Also moved buffer state save/restore into ui module. --- test/modules/textadept/bookmarks/foo | 4 ++++ test/test.lua | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 test/modules/textadept/bookmarks/foo (limited to 'test') diff --git a/test/modules/textadept/bookmarks/foo b/test/modules/textadept/bookmarks/foo new file mode 100644 index 00000000..94ebaf90 --- /dev/null +++ b/test/modules/textadept/bookmarks/foo @@ -0,0 +1,4 @@ +1 +2 +3 +4 diff --git a/test/test.lua b/test/test.lua index 321df0bc..f3715a16 100644 --- a/test/test.lua +++ b/test/test.lua @@ -1153,6 +1153,25 @@ function test_bookmarks_interactive() buffer:close(true) end +function test_bookmarks_reload() + local function has_bookmark(line) + return buffer:marker_get(line) & 1 << textadept.bookmarks.MARK_BOOKMARK - 1 > 0 + end + + io.open_file(_HOME .. '/test/modules/textadept/bookmarks/foo') + buffer:line_down() + textadept.bookmarks.toggle() + buffer:line_down() + buffer:line_down() + textadept.bookmarks.toggle() + assert(has_bookmark(2), 'line not bookmarked') + assert(has_bookmark(4), 'line not bookmarked') + buffer:reload() + assert(has_bookmark(2), 'bookmark not restored') + assert(has_bookmark(4), 'bookmark not restored') + buffer:close(true) +end + function test_command_entry_run() local command_run, tab_pressed = false, false ui.command_entry.run(function(command) command_run = command end, { -- cgit v1.2.3