Translate carriage returns to newlines on windows

This commit is contained in:
Shylie 2024-04-14 17:03:50 -04:00
parent a6a2141049
commit 061f318247

View File

@ -87,11 +87,12 @@ void terml_windows::process_events()
KEY_EVENT_RECORD* record = &input_record_buffer[i].Event.KeyEvent; KEY_EVENT_RECORD* record = &input_record_buffer[i].Event.KeyEvent;
if (record->bKeyDown) if (record->bKeyDown)
{ {
for (int repeat = 0; repeat < record->wRepeatCount; repeat++) const char key = record->uChar.AsciiChar == '\r' ? '\n' : record->uChar.AsciiChar;
if (key)
{ {
if (record->uChar.AsciiChar) for (int repeat = 0; repeat < record->wRepeatCount; repeat++)
{ {
key_event(record->uChar.AsciiChar); key_event(key);
} }
} }
} }