Added a "GetRepeatCommand" to the command object. The Interpreter uses this
instead of the last history item to provide a command for the "empty" command.
Use this in the source-file command to make <RETURN> continue the listing rather
than relist the first listing...
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@107736 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/CommandInterpreter.cpp b/source/Interpreter/CommandInterpreter.cpp
index 6516cf7..ea7fde2 100644
--- a/source/Interpreter/CommandInterpreter.cpp
+++ b/source/Interpreter/CommandInterpreter.cpp
@@ -627,7 +627,13 @@
}
else
{
- command_line = m_command_history.back().c_str();
+ command_line = m_repeat_command.c_str();
+ if (m_repeat_command.empty())
+ {
+ result.AppendError("");
+ result.SetStatus (eReturnStatusFailed);
+ return false;
+ }
}
add_to_history = false;
}
@@ -653,6 +659,18 @@
return false;
}
+ if (add_to_history)
+ {
+ const char *repeat_command = command_obj->GetRepeatCommand(command_line);
+ if (repeat_command)
+ m_repeat_command.assign(repeat_command);
+ else
+ m_repeat_command.clear();
+
+ m_command_history.push_back (command_line);
+ }
+
+
if (command_obj->WantsRawCommandString())
{
const char *stripped_command = ::strstr (command_line, command_cstr);
@@ -666,9 +684,6 @@
}
else
{
- if (add_to_history)
- m_command_history.push_back (command_line);
-
// Remove the command from the args.
command_args.Shift();
command_obj->ExecuteWithOptions (*this, command_args, result);