From 70cd671ef63c28678f73721c82ffb33cd3b662ad Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 29 Aug 2013 13:50:55 +0100 Subject: [PATCH] support absolute filenames in insert mode filename completion --- src/input_handler.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index c0d7b5ed..72b68aa0 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -677,12 +677,17 @@ public: String prefix{begin, pos}; StringList res; - for (auto dir : options()["path"].get()) + if (prefix.front() == '/') + res = Kakoune::complete_filename(prefix, Regex{}); + else { - if (not dir.empty() and dir.back() != '/') - dir += '/'; - for (auto& filename : Kakoune::complete_filename(dir + prefix, Regex{})) - res.push_back(filename.substr(dir.length())); + for (auto dir : options()["path"].get()) + { + if (not dir.empty() and dir.back() != '/') + dir += '/'; + for (auto& filename : Kakoune::complete_filename(dir + prefix, Regex{})) + res.push_back(filename.substr(dir.length())); + } } if (res.empty()) return {};