From f673f3c3347e0ecc96bc4fd99a782500c03ae0c2 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 15 Jan 2012 02:01:58 +0000 Subject: [PATCH] Completion: handle hidden files in complete_filenam --- src/completion.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/completion.cc b/src/completion.cc index 01ab56c7..c602cdcb 100644 --- a/src/completion.cc +++ b/src/completion.cc @@ -30,12 +30,16 @@ CandidateList complete_filename(const std::string& prefix, while (dirent* entry = readdir(dir)) { std::string filename = entry->d_name; + if (filename.empty()) + continue; + if (filename.substr(0, fileprefix.length()) == fileprefix) { std::string name = dirprefix + filename; if (entry->d_type == DT_DIR) name += '/'; - result.push_back(name); + if (fileprefix.length() or filename[0] != '.') + result.push_back(name); } } return result;