:: commit e7ee417da64a960cbc7187ea2494d667d8925bd7

mintsuki <mintsuki@protonmail.com> — 2020-12-19 17:28

parents: 1fa24b49c5

menu: Report to the user when text buffer is saturated

diff --git a/limine-pxe.bin b/limine-pxe.bin
index 07f13648..de04f533 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index 080f2ec7..2eb31927 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index f437b261..0429fd95 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/menu.c b/stage2/menu.c
index b3aabb8e..f024088e 100644
--- a/stage2/menu.c
+++ b/stage2/menu.c
@@ -76,6 +76,8 @@ static char *config_entry_editor(const char *orig_entry) {
     size_t window_offset  = 0;
     size_t line_size      = term_cols - 2;
 
+    bool display_overflow_error = false;
+
     // Skip leading newlines
     while (*orig_entry == '\n') {
         orig_entry++;
@@ -203,6 +205,11 @@ refresh:
     }
     print("\xd9");
 
+    if (display_overflow_error) {
+        print(" ERR: Text buffer not big enough, delete something instead.");
+        display_overflow_error = false;
+    }
+
     // Hack to redraw the cursor
     set_cursor_pos(cursor_x, cursor_y);
     enable_cursor();
@@ -252,6 +259,8 @@ refresh:
                         break;
                 }
                 buffer[cursor_offset++] = c;
+            } else {
+                display_overflow_error = true;
             }
             break;
     }
tab: 248 wrap: offon