From 1469d20e6334003f8ef4584ffcc16f89add566c0 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Sun, 17 May 2020 15:04:22 +0430 Subject: [PATCH] Shell: Treat builtin names as programs and suggest them --- Shell/Shell.cpp | 4 ++++ Shell/Shell.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Shell/Shell.cpp b/Shell/Shell.cpp index 005ed195d0..17672d25fc 100644 --- a/Shell/Shell.cpp +++ b/Shell/Shell.cpp @@ -1373,6 +1373,10 @@ void Shell::cache_path() } } + // add shell builtins to the cache + for (const auto& builtin_name : builtin_names) + cached_path.append(escape_token(builtin_name)); + quick_sort(cached_path); } diff --git a/Shell/Shell.h b/Shell/Shell.h index ea9ff440cf..1f481b7e22 100644 --- a/Shell/Shell.h +++ b/Shell/Shell.h @@ -174,6 +174,14 @@ private: #undef __ENUMERATE_SHELL_BUILTIN + constexpr static const char* builtin_names[] = { +#define __ENUMERATE_SHELL_BUILTIN(builtin) #builtin, + + ENUMERATE_SHELL_BUILTINS() + +#undef __ENUMERATE_SHELL_BUILTIN + }; + ExitCodeOrContinuationRequest::ContinuationRequest m_should_continue { ExitCodeOrContinuationRequest::Nothing }; StringBuilder m_complete_line_builder; bool m_should_break_current_command { false };