:: commit 8c29063bfcbda0e8a57631385798797e29e09e7d

Carver <ch@dorper.me> — 2021-07-06 23:56

parents: 6e82bd0e2f

Centering

diff --git a/stage23/menu.c b/stage23/menu.c
index 94c7c688..ddf43664 100644
--- a/stage23/menu.c
+++ b/stage23/menu.c
@@ -121,12 +121,11 @@ static int validate_line(const char *buffer) {
 fail:
     if (i < 64) keybuf[i] = 0;
     if (keybuf[0] == '\n' || (!keybuf[0] && buffer[0] != '=')) return TOK_KEY; // blank line is valid
-    invalid_syntax = 1;
+    invalid_syntax = true;
     return TOK_BADKEY;
 found_equals:
     if (i < 64) keybuf[i] = 0;
     for (i = 0; VALID_KEYS[i]; i++) {
-        //print("'%s'", keybuf);
         if (!strcmp(keybuf, VALID_KEYS[i])) {
             return TOK_KEY;
         }
@@ -168,7 +167,7 @@ static char *config_entry_editor(const char *title, const char *orig_entry) {
     buffer[entry_size] = 0;
 
 refresh:
-    invalid_syntax = 0;
+    invalid_syntax = false;
     
     clear(true);
     disable_cursor();
@@ -187,13 +186,15 @@ refresh:
                     break;
                 }
                 // FALLTHRU
-            default:
-                if (i > term_cols / 2 - (int)strlen(title) && i < term_cols / 2) {
-                    print(title);
-                    i += strlen(title) - 1;
+            default: {
+                int title_length = strlen(title);
+                if (i == (term_cols / 2) - (title_length / 2) - 1) {
+                    print("%s", title);
+                    i += title_length - 1;
                 } else {
                     print("\xc4");
                 }
+            }
         }
     }
     print("\xbf\xb3");
diff --git a/test/limine.cfg b/test/limine.cfg
index 3f42f8b1..1a6c487a 100644
--- a/test/limine.cfg
+++ b/test/limine.cfg
@@ -1,6 +1,6 @@
 DEFAULT_ENTRY=1
 TIMEOUT=3
-GRAPHICS=yes
+GRAPHICS=no
 MENU_FONT=boot:///boot/font.bin
 VERBOSE=yes
 
tab: 248 wrap: offon