mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2025-08-18 12:45:36 +00:00
enable console history again on win32
This commit is contained in:
parent
7ab37b7fe9
commit
d226b36f44
@ -120,7 +120,6 @@ void SetupConsole() {
|
|||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
static std::vector<std::string> ConsoleHistory {};
|
static std::vector<std::string> ConsoleHistory {};
|
||||||
static size_t ConsoleHistoryReadIndex { 0 };
|
static size_t ConsoleHistoryReadIndex { 0 };
|
||||||
|
|
||||||
@ -164,14 +163,12 @@ static void ProcessCompositeInput() {
|
|||||||
ConsoleHistoryReadIndex = ConsoleHistory.size();
|
ConsoleHistoryReadIndex = ConsoleHistory.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // WIN32
|
|
||||||
|
|
||||||
[[noreturn]] void ReadCin() {
|
[[noreturn]] void ReadCin() {
|
||||||
DebugPrintTID();
|
DebugPrintTID();
|
||||||
while (true) {
|
while (true) {
|
||||||
int In = _getch();
|
int In = _getch();
|
||||||
//info(std::to_string(In));
|
//info(std::to_string(In));
|
||||||
#ifndef WIN32
|
|
||||||
if (CompositeInputExpected) {
|
if (CompositeInputExpected) {
|
||||||
CompositeInput += In;
|
CompositeInput += In;
|
||||||
if (CompositeInput.size() == 2) {
|
if (CompositeInput.size() == 2) {
|
||||||
@ -180,13 +177,10 @@ static void ProcessCompositeInput() {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif // WIN32
|
|
||||||
if (In == 13 || In == '\n') {
|
if (In == 13 || In == '\n') {
|
||||||
if (!CInputBuff.empty()) {
|
if (!CInputBuff.empty()) {
|
||||||
HandleInput(CInputBuff);
|
HandleInput(CInputBuff);
|
||||||
#ifndef WIN32
|
|
||||||
ConsoleHistoryAdd(CInputBuff);
|
ConsoleHistoryAdd(CInputBuff);
|
||||||
#endif // WIN32
|
|
||||||
CInputBuff.clear();
|
CInputBuff.clear();
|
||||||
}
|
}
|
||||||
} else if (In == 8 || In == 127) {
|
} else if (In == 8 || In == 127) {
|
||||||
@ -196,12 +190,10 @@ static void ProcessCompositeInput() {
|
|||||||
CInputBuff = "exit";
|
CInputBuff = "exit";
|
||||||
HandleInput(CInputBuff);
|
HandleInput(CInputBuff);
|
||||||
CInputBuff.clear();
|
CInputBuff.clear();
|
||||||
#ifndef WIN32
|
|
||||||
} else if (In == 27) {
|
} else if (In == 27) {
|
||||||
// escape char, assume stuff follows
|
// escape char, assume stuff follows
|
||||||
CompositeInputExpected = true;
|
CompositeInputExpected = true;
|
||||||
CompositeInput.clear();
|
CompositeInput.clear();
|
||||||
#endif // WIN32
|
|
||||||
} else if (!isprint(In)) {
|
} else if (!isprint(In)) {
|
||||||
// ignore
|
// ignore
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user