summaryrefslogtreecommitdiff
path: root/Userland/Shell/AST.cpp
diff options
context:
space:
mode:
authorDamien Firmenich <fir.damien@gmail.com>2022-04-13 15:25:55 +0200
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-04-15 13:08:41 +0430
commit31ca48ebb29e3cfe6937e575cadfba96b9c3fd09 (patch)
treef0cd823073bc8f32fadd704231e798b3db234d31 /Userland/Shell/AST.cpp
parent9dbcda7eef56165b54e07a3718bbb8a6c89326bb (diff)
downloadserenity-31ca48ebb29e3cfe6937e575cadfba96b9c3fd09.zip
Shell: Complete for current path when the text is empty
For example, when typing `cd <tab>`, the shell will show a list of files in the current directory. This behavior is similar to typing `cd ./<tab>`. It makes it easier to `cd` into directories without having to list them first.
Diffstat (limited to 'Userland/Shell/AST.cpp')
-rw-r--r--Userland/Shell/AST.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Shell/AST.cpp b/Userland/Shell/AST.cpp
index 224b7a0973..205a79f1c3 100644
--- a/Userland/Shell/AST.cpp
+++ b/Userland/Shell/AST.cpp
@@ -392,7 +392,7 @@ Vector<Line::CompletionSuggestion> Node::complete_for_editor(Shell& shell, size_
}
auto result = hit_test_position(offset);
if (!result.matching_node)
- return {};
+ return shell.complete_path("", "", 0, Shell::ExecutableOnly::No, result.closest_command_node.ptr(), nullptr, Shell::EscapeMode::Bareword);
auto node = result.matching_node;
if (node->is_bareword() || node != result.closest_node_with_semantic_meaning)
node = result.closest_node_with_semantic_meaning;