diff options
author | 2016-12-08 21:43:45 -0500 | |
---|---|---|
committer | 2016-12-08 21:43:45 -0500 | |
commit | ed192326b8f6c89cfb5fba51fb185cbfc723fa43 (patch) | |
tree | 2bee7367f8041477ca16c6454066f12448ca388c /modules/textadept | |
parent | 41cc293da9dd1135926aa3d4f84235c32a38333d (diff) | |
download | textadept-ed192326b8f6c89cfb5fba51fb185cbfc723fa43.tar.gz textadept-ed192326b8f6c89cfb5fba51fb185cbfc723fa43.zip |
Prevent duplicate recent files on session load; modules/textadept/session.lua
Diffstat (limited to 'modules/textadept')
-rw-r--r-- | modules/textadept/session.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/textadept/session.lua b/modules/textadept/session.lua index 11515de0..89ee042c 100644 --- a/modules/textadept/session.lua +++ b/modules/textadept/session.lua @@ -88,7 +88,12 @@ function M.load(filename) elseif line:find('^current_view:') then current_view = _VIEWS[tonumber(line:match('^current_view: (%d+)')) or 1] elseif line:find('^recent:') then - io.recent_files[#io.recent_files + 1] = line:match('^recent: (.+)$') + -- If a recent file is already open, do not add it to the list again. + local recent_file, exists = line:match('^recent: (.+)$'), false + for i = 1, #io.recent_files do + if io.recent_files[i] == recent_file then exists = true break end + end + if not exists then io.recent_files[#io.recent_files + 1] = recent_file end end end f:close() |