getchar: Return \n when return is pressed instead of passing through \r from int 10h

This commit is contained in:
mintsuki 2020-12-15 07:40:19 +01:00
parent b8e580b16c
commit 22ba144d98
5 changed files with 7 additions and 6 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -21,7 +21,12 @@ int getchar_internal(uint32_t eax) {
case 0x53:
return GETCHAR_DELETE;
}
return (char)(eax & 0xff);
char c = eax & 0xff;
switch (c) {
case '\r':
return '\n';
}
return c;
}
int getchar(void) {
@ -106,7 +111,7 @@ void readline(const char *orig_str, char *buf, size_t limit) {
buf[j] = 0;
}
continue;
case '\r':
case '\n':
term_write("\n", 1);
return;
default:

View File

@ -138,7 +138,6 @@ refresh:
int c = getchar();
switch (c) {
case 0:
case GETCHAR_CURSOR_DOWN:
cursor_offset = get_next_line(cursor_offset, buffer);
break;
@ -177,9 +176,6 @@ refresh:
*ret = true;
disable_cursor();
return (char *)orig_entry;
case '\r':
c = '\n';
// FALLTHRU
default:
if (strlen(buffer) < EDITOR_MAX_BUFFER_SIZE - 1) {
for (size_t i = strlen(buffer); ; i--) {