:: commit 85b4d063a8ea706d0391c1774c4279f8fc041ca0

mintsuki <mintsuki@protonmail.com> — 2020-11-16 23:50

parents: dc54ee97eb

menu: Prettify print_tree()

diff --git a/limine-pxe.bin b/limine-pxe.bin
index 396e2d4c..1fbde1fe 100644
Binary files a/limine-pxe.bin and b/limine-pxe.bin differ
diff --git a/limine.bin b/limine.bin
index fc6c3d94..098bef8b 100644
Binary files a/limine.bin and b/limine.bin differ
diff --git a/stage2.map b/stage2.map
index b5f4804a..5882c063 100644
Binary files a/stage2.map and b/stage2.map differ
diff --git a/stage2/menu.c b/stage2/menu.c
index b39520b8..c21a2d81 100644
--- a/stage2/menu.c
+++ b/stage2/menu.c
@@ -23,12 +23,27 @@ static int print_tree(int level, int base_index, int selected_entry,
     for (;;) {
         if (current_entry == NULL)
             break;
-        for (int i = 0; i < level; i++)
-            print("  ");
+        if (level) {
+            for (int i = level - 1; i > 0; i--) {
+                struct menu_entry *actual_parent = current_entry;
+                for (int j = 0; j < i; j++)
+                    actual_parent = actual_parent->parent;
+                if (actual_parent->next != NULL)
+                    print(" | ");
+                else
+                    print("   ");
+            }
+            if (current_entry->next == NULL)
+                print(" `-");
+            else
+                print(" |-");
+        }
         if (current_entry->sub)
-            print(current_entry->expanded ? "[-] " : "[+] ");
+            print(current_entry->expanded ? "[-]" : "[+]");
+        else if (level)
+            print("-> ");
         else
-            print("    ");
+            print("   ");
         if (base_index + max_entries == selected_entry) {
             *selected_menu_entry = current_entry;
             print("\e[47m\e[30m");
tab: 248 wrap: offon