1
0
Fork 0

Fix a bug with backspace handling in modem

Fixes a bug where entering backspace while command buffer was already
empty added backspace char to the buffer thus screwing it up.
This commit is contained in:
NicknineTheEagle 2020-03-19 20:12:28 +03:00 committed by Patryk Obara
parent 99a47bc590
commit 9cb13f6158

View file

@ -718,11 +718,17 @@ void CSerialModem::Timer2(void) {
rqueue->addb(txval);
//LOG_MSG("Echo back to queue: %x",txval);
}
if (txval == 0xa) continue; //Real modem doesn't seem to skip this?
else if (txval == 0x8 && (cmdpos > 0)) --cmdpos; // backspace
else if (txval == 0xd) DoCommand(); // return
else if (txval != '+') {
if(cmdpos<99) {
if (txval == '\n')
continue; // Real modem doesn't seem to skip this?
if (txval == '\b') {
if (cmdpos > 0)
cmdpos--;
} else if (txval == '\r') {
DoCommand();
} else if (txval != '+') {
if (cmdpos < 99) {
cmdbuf[cmdpos] = txval;
cmdpos++;
}