From 061f318247fded910ee10bab99fc1b5fee874b9f Mon Sep 17 00:00:00 2001 From: Shylie Date: Sun, 14 Apr 2024 17:03:50 -0400 Subject: [PATCH] Translate carriage returns to newlines on windows --- source/terml_windows.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/terml_windows.cpp b/source/terml_windows.cpp index 51c49e0..629fde8 100644 --- a/source/terml_windows.cpp +++ b/source/terml_windows.cpp @@ -87,11 +87,12 @@ void terml_windows::process_events() KEY_EVENT_RECORD* record = &input_record_buffer[i].Event.KeyEvent; 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); } } }