-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: escape spaces in paths for grug-far integration (#267)
This change allows the grug-far integration to work with paths that contain spaces. It escapes spaces in the path before passing it to grug-far. This was suggested by @MagicDuck in be2ac43 👍🏻👍🏻
- Loading branch information
1 parent
a5f607e
commit f265e95
Showing
2 changed files
with
28 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
---@module "plenary.path" | ||
|
||
local assert = require('luassert') | ||
local mock = require('luassert.mock') | ||
local config = require('yazi.config') | ||
local plenary_path = require('plenary.path') | ||
|
||
describe('the grug-far integration (search and replace)', function() | ||
local mock_grug_far = { grug_far = function() end } | ||
|
||
before_each(function() | ||
mock.revert(mock_grug_far) | ||
package.loaded['grug-far'] = mock(mock_grug_far) | ||
end) | ||
|
||
it('opens yazi with the current file selected', function() | ||
local tmp_path = plenary_path:new('/tmp/folder with spaces/') | ||
|
||
config.default().integrations.replace_in_directory(tmp_path) | ||
|
||
assert.spy(mock_grug_far.grug_far).was_called_with({ | ||
prefills = { | ||
paths = '/tmp/folder\\ with\\ spaces', | ||
}, | ||
}) | ||
end) | ||
end) |