summaryrefslogtreecommitdiff
path: root/match/file.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-15 23:52:04 +0300
committerEyal Posener <[email protected]>2017-05-18 23:29:55 +0300
commit61d9904ba1f47bf5bbd3497ac0c9f5787adb8633 (patch)
tree17357f14eadb4654287eb664dfbe02914167f4db /match/file.go
parent659bd9e3d5a0113fb862bcbd06a983b0e74e8df7 (diff)
Fix './' prefix for file completion
Diffstat (limited to 'match/file.go')
-rw-r--r--match/file.go5
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)
}