:: commit eb1fd4afc6a8319e753974b59af26cb14ff71b9c

mintsuki <mintsuki@protonmail.com> — 2020-12-15 06:45

parents: 44d90c020d

menu: Cleanup way escaping editor is handled and check for \n instead of \r in main menu

diff --git a/limine-pxe.bin b/limine-pxe.bin
index fee690e5..dbf81ea7 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 9ea190ca..a151c99f 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index 34cb57b3..1f487401 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/menu.c b/stage2/menu.c
index d2736f8b..4a2e1a36 100644
--- a/stage2/menu.c
+++ b/stage2/menu.c
@@ -86,7 +86,7 @@ static size_t get_prev_line(size_t index, const char *buffer) {
     return offset;
 }
 
-static char *config_entry_editor(bool *ret, const char *orig_entry) {
+static char *config_entry_editor(const char *orig_entry) {
     size_t cursor_offset = 0;
     size_t entry_size = strlen(orig_entry);
 
@@ -169,13 +169,11 @@ refresh:
             }
             break;
         case GETCHAR_F10:
-            *ret = false;
             disable_cursor();
             return buffer;
         case '\e':
-            *ret = true;
             disable_cursor();
-            return (char *)orig_entry;
+            return NULL;
         default:
             if (strlen(buffer) < EDITOR_MAX_BUFFER_SIZE - 1) {
                 for (size_t i = strlen(buffer); ; i--) {
@@ -387,7 +385,7 @@ timeout_aborted:
                 if (++selected_entry == max_entries)
                     selected_entry = 0;
                 goto refresh;
-            case '\r':
+            case '\n':
             autoboot:
                 if (selected_menu_entry->sub != NULL) {
                     selected_menu_entry->expanded = !selected_menu_entry->expanded;
@@ -408,10 +406,10 @@ timeout_aborted:
                 if (selected_menu_entry->sub != NULL)
                     goto refresh;
                 enable_cursor();
-                bool ret;
-                selected_menu_entry->body = config_entry_editor(&ret, selected_menu_entry->body);
-                if (ret)
+                char *new_body = config_entry_editor(selected_menu_entry->body);
+                if (new_body == NULL)
                     goto refresh;
+                selected_menu_entry->body = new_body;
                 goto autoboot;
             }
         }
tab: 248 wrap: offon