-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: complex character file name resolution for multiple files
This also fixes an issue where the currently open file would not get preselected when yazi was opened when the file had complex characters such as '$' in it.
- Loading branch information
1 parent
bdec3b6
commit 051bfce
Showing
5 changed files
with
18 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
describe('the default configuration', function() | ||
before_each(function() | ||
-- clear all buffers | ||
for _, buf in ipairs(vim.api.nvim_list_bufs()) do | ||
vim.api.nvim_buf_delete(buf, { force = true }) | ||
end | ||
end) | ||
|
||
it('can display multiple files in the quickfix list', function() | ||
local config = require('yazi.config').default() | ||
local chosen_files = { '/abc/test-file.txt', '/abc/test-file2.txt' } | ||
-- include problematic characters in the file names to preserve their behaviour | ||
local chosen_files = { '/abc/[email protected]', '/abc/test-file2.txt' } | ||
|
||
config.hooks.yazi_opened_multiple_files(chosen_files, config) | ||
|
||
local quickfix_list = vim.fn.getqflist() | ||
|
||
assert.equals(2, #quickfix_list) | ||
assert.equals('/abc/test-file.txt', quickfix_list[1].text) | ||
assert.equals('/abc/test-$@file.txt', quickfix_list[1].text) | ||
assert.equals('/abc/test-file2.txt', quickfix_list[2].text) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters