summaryrefslogtreecommitdiff
path: root/predict_files.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 /predict_files.go
parent659bd9e3d5a0113fb862bcbd06a983b0e74e8df7 (diff)
Fix './' prefix for file completion
Diffstat (limited to 'predict_files.go')
-rw-r--r--predict_files.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/predict_files.go b/predict_files.go
index 0ba2d79..4b8c84a 100644
--- a/predict_files.go
+++ b/predict_files.go
@@ -42,7 +42,7 @@ func files(pattern string, allowFiles bool) PredictFunc {
// if the result is only one item, we might want to recursively check
// for more accurate results.
- if prediction[0] == a.Last { // avoid loop forever
+ if prediction[0] == a.Last {
return
}
@@ -73,13 +73,9 @@ func predictFiles(a Args, pattern string, allowFiles bool) []string {
// PredictFilesSet predict according to file rules to a given set of file names
func PredictFilesSet(files []string) PredictFunc {
return func(a Args) (prediction []string) {
- rel := !filepath.IsAbs(a.Directory())
// add all matching files to prediction
for _, f := range files {
- // change file name to relative if necessary
- if rel {
- f = relativePath(f)
- }
+ f = fixPathForm(a.Last, f)
// test matching of file to the argument
if match.File(f, a.Last) {