summaryrefslogtreecommitdiff
path: root/Shell/main.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-04-12 22:40:23 +0430
committerAndreas Kling <kling@serenityos.org>2020-04-13 00:49:24 +0200
commitc112f533578cda48396308ee34314917d97a5614 (patch)
treed6dbb0900627e6704f51c93ec6a67d2390bf4793 /Shell/main.cpp
parent364dbe28d680f351e34aea5c87acab73a9f1a0e0 (diff)
downloadserenity-c112f533578cda48396308ee34314917d97a5614.zip
Shell: Complete .hidden files if token starts with a dot
Diffstat (limited to 'Shell/main.cpp')
-rw-r--r--Shell/main.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/Shell/main.cpp b/Shell/main.cpp
index 79628e0227..9cc44eb448 100644
--- a/Shell/main.cpp
+++ b/Shell/main.cpp
@@ -1100,9 +1100,15 @@ int main(int argc, char** argv)
// `/foo/', but rather just `bar...'
editor.suggest(token.length(), 0);
- Core::DirIterator files(path, Core::DirIterator::SkipDots);
+ // only suggest dot-files if path starts with a dot
+ Core::DirIterator files(path,
+ token.starts_with('.') ? Core::DirIterator::NoFlags : Core::DirIterator::SkipDots);
+
while (files.has_next()) {
auto file = files.next_path();
+ // manually skip `.' and `..'
+ if (file == "." || file == "..")
+ continue;
if (file.starts_with(token)) {
suggestions.append(file);
}