File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -1748,7 +1748,7 @@ H.oldfile_ensure_initialized = function()
17481748 local n = # vim .v .oldfiles
17491749 local recency = {}
17501750 for i , path in ipairs (vim .v .oldfiles ) do
1751- if vim . fn . filereadable ( path ) == 1 then recency [path ] = n - i + 1 end
1751+ recency [path ] = n - i + 1
17521752 end
17531753
17541754 H .cache .oldfile = { recency = recency , max_recency = n , is_advancing = false }
Original file line number Diff line number Diff line change @@ -2017,6 +2017,19 @@ T['oldfile()']['is initialized with `v:oldfiles`'] = function()
20172017 child .o .shadafile = ' NONE'
20182018end
20192019
2020+ T [' oldfile()' ][' traverses only readable files' ] = function ()
2021+ child .lua ([[
2022+ vim.fn.filereadable = function(path) return vim.endswith(path, 'file-a') and 0 or 1 end
2023+ ]] )
2024+ setup_oldfile ()
2025+
2026+ child .cmd (' enew' )
2027+
2028+ child .lua (' MiniBracketed.oldfile("forward")' )
2029+ -- Choose next file after the (first) 'file-a' as it is nor readable
2030+ validate_test_file (' file-e' )
2031+ end
2032+
20202033T [' oldfile()' ][' validates `direction`' ] = function ()
20212034 expect .error (function () child .lua (' MiniBracketed.oldfile(1)' ) end , ' oldfile%(%).*direction.*one of' )
20222035 expect .error (function () child .lua ([[ MiniBracketed.oldfile('next')]] ) end , ' oldfile%(%).*direction.*one of' )
You can’t perform that action at this time.
0 commit comments