getchar: Return \n when return is pressed instead of passing through \r from int 10h
diff --git a/limine-pxe.bin b/limine-pxe.bin
index b4f8a4af..fee690e5 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 59cfc1e9..9ea190ca 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index efd745fd..34cb57b3 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/lib/readline.c b/stage2/lib/readline.c
index d4dd69c3..4d9a830a 100644
--- a/stage2/lib/readline.c
+++ b/stage2/lib/readline.c
@@ -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:
diff --git a/stage2/menu.c b/stage2/menu.c
index cb1b22cd..d2736f8b 100644
--- a/stage2/menu.c
+++ b/stage2/menu.c
@@ -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--) {
