summaryrefslogtreecommitdiff
path: root/Userland/Shell/Shell.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-03-06 15:58:26 +0330
committerAndreas Kling <kling@serenityos.org>2021-03-07 10:58:42 +0100
commitc580348ebd1e36056d4340df4ccae37a5256ca56 (patch)
treebaf9714f24580875baac820194a3e40fbaf4b6c3 /Userland/Shell/Shell.cpp
parent4f6bf2931c5df4336b848b4a299ce30bae8dc299 (diff)
downloadserenity-c580348ebd1e36056d4340df4ccae37a5256ca56.zip
Shell: Add functions to the PATH cache when rebuilding the cache
Otherwise functions would be highlighted as missing.
Diffstat (limited to 'Userland/Shell/Shell.cpp')
-rw-r--r--Userland/Shell/Shell.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp
index 6d7c423332..23169a8cf2 100644
--- a/Userland/Shell/Shell.cpp
+++ b/Userland/Shell/Shell.cpp
@@ -1232,6 +1232,14 @@ void Shell::cache_path()
for (const auto& builtin_name : builtin_names)
cached_path.append(escape_token(builtin_name));
+ // Add functions to the cache.
+ for (auto& function : m_functions) {
+ auto name = escape_token(function.key);
+ if (cached_path.contains_slow(name))
+ continue;
+ cached_path.append(name);
+ }
+
// Add aliases to the cache.
for (const auto& alias : m_aliases) {
auto name = escape_token(alias.key);