parent
753f3a50d1
commit
2052b225d9
|
@ -417,11 +417,18 @@ CommandManager::find_command(const Context& context, const String& name) const
|
|||
void CommandManager::execute_single_command(CommandParameters params,
|
||||
Context& context,
|
||||
const ShellContext& shell_context,
|
||||
DisplayCoord pos) const
|
||||
DisplayCoord pos)
|
||||
{
|
||||
if (params.empty())
|
||||
return;
|
||||
|
||||
constexpr int max_command_depth = 100;
|
||||
if (m_command_depth > max_command_depth)
|
||||
throw runtime_error("maximum nested command depth hit");
|
||||
|
||||
++m_command_depth;
|
||||
auto pop_cmd = on_scope_end([this] { --m_command_depth; });
|
||||
|
||||
ParameterList param_view(params.begin()+1, params.end());
|
||||
auto command_it = find_command(context, params[0]);
|
||||
if (command_it == m_commands.end())
|
||||
|
|
|
@ -112,7 +112,7 @@ private:
|
|||
void execute_single_command(CommandParameters params,
|
||||
Context& context,
|
||||
const ShellContext& shell_context,
|
||||
DisplayCoord pos) const;
|
||||
DisplayCoord pos);
|
||||
|
||||
struct CommandDescriptor
|
||||
{
|
||||
|
@ -126,6 +126,7 @@ private:
|
|||
using CommandMap = UnorderedMap<String, CommandDescriptor, MemoryDomain::Commands>;
|
||||
CommandMap m_commands;
|
||||
String m_last_complete_command;
|
||||
int m_command_depth = 0;
|
||||
|
||||
CommandMap::const_iterator find_command(const Context& context,
|
||||
const String& name) const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user