fix(console coloring): fixed enter for windows get character function
This commit is contained in:
parent
7499404f63
commit
17d4c0e0f9
1 changed files with 6 additions and 1 deletions
|
|
@ -128,6 +128,12 @@ IonyError iony_console_get_character(char *character) {
|
||||||
if (!ReadFile(iony_standard_console_in, character, 1, &characters_read, 0)) {
|
if (!ReadFile(iony_standard_console_in, character, 1, &characters_read, 0)) {
|
||||||
return IONY_ERROR_SYSTEM_CALL_FAILED;
|
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__)
|
#elif defined(__GNUC__)
|
||||||
if (iony_system_call(IONY_SYS_READ, 0, (long)character, 1, 0, 0, 0) < 0) {
|
if (iony_system_call(IONY_SYS_READ, 0, (long)character, 1, 0, 0, 0) < 0) {
|
||||||
return IONY_ERROR_SYSTEM_CALL_FAILED;
|
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) {
|
if (SetConsoleTextAttribute(iony_standard_console_out, color) == 0) {
|
||||||
return IONY_ERROR_SYSTEM_CALL_FAILED;
|
return IONY_ERROR_SYSTEM_CALL_FAILED;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue