fix(console coloring): fixed enter for windows get character function

This commit is contained in:
Mineplay 2025-10-18 09:46:24 -05:00
parent 7499404f63
commit 17d4c0e0f9

View file

@ -128,6 +128,12 @@ IonyError iony_console_get_character(char *character) {
if (!ReadFile(iony_standard_console_in, character, 1, &characters_read, 0)) {
return IONY_ERROR_SYSTEM_CALL_FAILED;
}
if (character == '\r') {
if (!ReadFile(iony_standard_console_in, character, 1, &characters_read, 0)) {
return IONY_ERROR_SYSTEM_CALL_FAILED;
}
}
#elif defined(__GNUC__)
if (iony_system_call(IONY_SYS_READ, 0, (long)character, 1, 0, 0, 0) < 0) {
return IONY_ERROR_SYSTEM_CALL_FAILED;
@ -174,7 +180,6 @@ IonyError iony_console_set_color(IonyConsoleColor color) {
}
}
DWORD characters_written;
if (SetConsoleTextAttribute(iony_standard_console_out, color) == 0) {
return IONY_ERROR_SYSTEM_CALL_FAILED;
}