Add clear with "clear", "cls" and Ctrl+L

This commit is contained in:
Lion Kortlepel 2020-11-09 00:01:04 +01:00
parent 52bf3cdd21
commit 01e02edf8c

View File

@ -27,6 +27,9 @@ void HandleInput(const std::string& cmd) {
std::cout << std::endl;
if (cmd == "exit") {
_Exit(0);
} else if (cmd == "clear" || cmd == "cls") {
// 2J is clearscreen, H is reset position to top-left
ConsoleOut("\x1b[2J\x1b[H");
} else {
LuaConsole->Execute(cmd);
}
@ -201,6 +204,10 @@ static void ProcessCompositeInput() {
CInputBuff = "exit";
HandleInput(CInputBuff);
CInputBuff.clear();
} else if (In == 12) {
CInputBuff = "clear";
HandleInput(CInputBuff);
CInputBuff.clear();
#ifdef WIN32
} else if (In == 224) {
#else // unix