InsertCompleter: Respected ignored_filename option in filename completer

This commit is contained in:
Maxime Coste 2017-12-09 22:03:19 +11:00
parent a33d18e125
commit 0033491d69

View File

@ -226,7 +226,8 @@ InsertCompletion complete_filename(const SelectionList& sels,
InsertCompletion::CandidateList candidates; InsertCompletion::CandidateList candidates;
if (prefix.front() == '/' or prefix.front() == '~') if (prefix.front() == '/' or prefix.front() == '~')
{ {
for (auto& filename : Kakoune::complete_filename(prefix, Regex{})) for (auto& filename : Kakoune::complete_filename(prefix,
options["ignored_files"].get<Regex>()))
candidates.push_back({ filename, "", filename }); candidates.push_back({ filename, "", filename });
} }
else else
@ -235,7 +236,8 @@ InsertCompletion complete_filename(const SelectionList& sels,
{ {
if (not dir.empty() and dir.back() != '/') if (not dir.empty() and dir.back() != '/')
dir += '/'; dir += '/';
for (auto& filename : Kakoune::complete_filename(dir + prefix, Regex{})) for (auto& filename : Kakoune::complete_filename(dir + prefix,
options["ignored_files"].get<Regex>()))
{ {
StringView candidate = filename.substr(dir.length()); StringView candidate = filename.substr(dir.length());
candidates.push_back({ candidate.str(), "", candidate.str() }); candidates.push_back({ candidate.str(), "", candidate.str() });