Skip to content

Commit d6c83ed

Browse files
committed
Fix bug in backspace handling
1 parent 0e2ec33 commit d6c83ed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

third_party/lbforth/lbforth.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,16 @@ int getkey()
247247
while ((c = llkey()) != EOF)
248248
{
249249
if (charsInLineBuffer == sizeof(lineBuffer)) break;
250+
// Handle End of file
251+
if (c == 0x1a || c == 0x00) {
252+
c = ' ';
253+
lineBuffer[charsInLineBuffer++] = c;
254+
}
250255
// Handle backspace
251256
if (c == 0x7f) {
252257
lineBuffer[charsInLineBuffer]=0;
253258
if(charsInLineBuffer > 0) charsInLineBuffer--;
254259
}
255-
if (c == 0x1a || c == 0x00) {
256-
c = ' ';
257-
lineBuffer[charsInLineBuffer++] = c;
258-
}
259-
260260
else lineBuffer[charsInLineBuffer++] = c;
261261
if (c == '\n' || c == '\r') break;
262262
}

0 commit comments

Comments
 (0)