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