diff options
| author | Eyal Posener <[email protected]> | 2017-05-18 23:34:43 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-05-18 23:34:43 +0300 |
| commit | dce08717c1081a4d35028ff7c2bc04d0b6b49d60 (patch) | |
| tree | 17357f14eadb4654287eb664dfbe02914167f4db /match/file.go | |
| parent | 659bd9e3d5a0113fb862bcbd06a983b0e74e8df7 (diff) | |
| parent | 61d9904ba1f47bf5bbd3497ac0c9f5787adb8633 (diff) | |
Merge pull request #27 from posener/prefixes
Fix './' prefix for file completion
Diffstat (limited to 'match/file.go')
| -rw-r--r-- | match/file.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/match/file.go b/match/file.go index eee5bec..051171e 100644 --- a/match/file.go +++ b/match/file.go @@ -4,13 +4,16 @@ import "strings" // File returns true if prefix can match the file func File(file, prefix string) bool { - // special case for current directory completion if file == "./" && (prefix == "." || prefix == "") { return true } + if prefix == "." && strings.HasPrefix(file, ".") { + return true + } file = strings.TrimPrefix(file, "./") prefix = strings.TrimPrefix(prefix, "./") + return strings.HasPrefix(file, prefix) } |
