mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2025-08-18 12:45:36 +00:00
Add clear with "clear", "cls" and Ctrl+L
This commit is contained in:
parent
52bf3cdd21
commit
01e02edf8c
@ -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);
|
||||||
}
|
}
|
||||||
@ -175,7 +178,7 @@ static void ProcessCompositeInput() {
|
|||||||
DebugPrintTID();
|
DebugPrintTID();
|
||||||
while (true) {
|
while (true) {
|
||||||
int In = _getch();
|
int In = _getch();
|
||||||
//info(std::to_string(In));
|
// info(std::to_string(In));
|
||||||
if (CompositeInputExpected) {
|
if (CompositeInputExpected) {
|
||||||
CompositeInput += char(In);
|
CompositeInput += char(In);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user