1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-31 00:36:42 +00:00

[Server] Handle backspace in the server window

This commit is contained in:
uramer 2020-03-02 14:19:00 +01:00
parent 4e6bcf02d2
commit 59693abc74

View file

@ -5,10 +5,10 @@ namespace mwmp_input {
string windowInputBuffer;
void handler() {
char c;
#ifndef WIN32 // on WIndows conio.h getch() and kbhit() are deprecated, use _getch() and _kbhit() instead
#ifndef WIN32
while (kbhit()) {
c = getch();
#else
#else // on Windows conio.h getch() and kbhit() are deprecated, use _getch() and _kbhit() instead
while (_kbhit()) {
c = _getch();
#endif
@ -18,6 +18,9 @@ namespace mwmp_input {
Script::Call<Script::CallbackIdentity("OnServerWindowInput")>(windowInputBuffer.c_str());
windowInputBuffer.assign("");
}
else if (c == '\b') {
windowInputBuffer.erase(windowInputBuffer.size() - 1);
}
else windowInputBuffer += c;
}
}