-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #57; slashes not normalized in some cases.
The `clink.filematches` and `clink.dirmatches` functions and the `exec.match` setting didn't normalize the root path. So inputting `../../s` and completing wouldn't convert the early slashes to backslashes.
- Loading branch information
1 parent
de76485
commit 1f44ad7
Showing
4 changed files
with
11 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,19 @@ | ||
-- Copyright (c) 2012 Martin Ridgers | ||
-- License: http://opensource.org/licenses/MIT | ||
|
||
-------------------------------------------------------------------------------- | ||
function clink.dir_matches(match_word, word_index, line_state) | ||
local word = line_state:getword(word_index) | ||
local expanded | ||
word, expanded = rl.expandtilde(word) | ||
|
||
local root = path.getdirectory(word) or "" | ||
if expanded then | ||
root = rl.collapsetilde(root) | ||
end | ||
|
||
local matches = {} | ||
for _, d in ipairs(os.globdirs(word.."*", true)) do | ||
local dir = path.join(root, d.name) | ||
table.insert(matches, { match = dir, type = d.type }) | ||
end | ||
return matches | ||
end | ||
|
||
-------------------------------------------------------------------------------- | ||
clink.argmatcher("cd", "chdir") | ||
:addflags("/d") | ||
:addarg(clink.dir_matches) | ||
:addarg(clink.dirmatches) | ||
:nofiles() | ||
|
||
-------------------------------------------------------------------------------- | ||
clink.argmatcher("pushd", "md", "mkdir") | ||
:addarg(clink.dir_matches) | ||
:addarg(clink.dirmatches) | ||
:nofiles() | ||
|
||
-------------------------------------------------------------------------------- | ||
clink.argmatcher("rd", "rmdir") | ||
:addflags("/s", "/q") | ||
:addarg(clink.dir_matches) | ||
:addarg(clink.dirmatches) | ||
:nofiles() |
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