1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-22 11:01:48 +03:00

support absolute filenames in insert mode filename completion

This commit is contained in:
Maxime Coste 2013-08-29 13:50:55 +01:00
parent 2125d95076
commit 70cd671ef6

View File

@ -677,6 +677,10 @@ public:
String prefix{begin, pos}; String prefix{begin, pos};
StringList res; StringList res;
if (prefix.front() == '/')
res = Kakoune::complete_filename(prefix, Regex{});
else
{
for (auto dir : options()["path"].get<StringList>()) for (auto dir : options()["path"].get<StringList>())
{ {
if (not dir.empty() and dir.back() != '/') if (not dir.empty() and dir.back() != '/')
@ -684,6 +688,7 @@ public:
for (auto& filename : Kakoune::complete_filename(dir + prefix, Regex{})) for (auto& filename : Kakoune::complete_filename(dir + prefix, Regex{}))
res.push_back(filename.substr(dir.length())); res.push_back(filename.substr(dir.length()));
} }
}
if (res.empty()) if (res.empty())
return {}; return {};
return { begin.coord(), pos.coord(), std::move(res), buffer.timestamp() }; return { begin.coord(), pos.coord(), std::move(res), buffer.timestamp() };