[syslinux] Fix: menu indent for menu entry

Dany St-Amant dany.ephemeral.2014 at icloud.com
Fri Apr 26 13:17:31 PDT 2019


Hello,

While experimenting with possible menu layout found this issue; the entry for MENU BEGIN doesn't follow MENU INDENT.

*Sample config*
label -
 menu disable
 menu label Distro
label rhel
 menu indent 2
 menu label RHEL
label cent
 menu indent 2
 menu label Centos
label fed
 menu indent 2
 menu label Fedora
menu begin
menu indent 2
menu label Others
menu end
# 'Others' doesn't have indentation to match first three.

The patch was tested with empty, labels only, sub menues only sub menu. And with mix of tag, title, label.

Regards,
Dany

*Patch*
--- syslinux-6.03/com32/menu/readconfig.c.orig	2019-04-26 13:22:46.817379317 -0500
+++ syslinux-6.03/com32/menu/readconfig.c	2019-04-26 14:12:26.085625360 -0500
@@ -319,6 +319,15 @@ static void record(struct menu *m, struc
     struct menu_entry *me;
     const struct syslinux_ipappend_strings *ipappend;
 
+    /* Handle indentation of item with sub-menu while there's no item yet */
+    if (m->parent_entry && m->nentries == 0 && ld->menuindent) {
+	const char *dn;
+
+	rsprintf(&dn, "%*s%s", ld->menuindent, "", m->parent_entry->displayname);
+	refstr_put(m->parent_entry->displayname);
+	m->parent_entry->displayname = dn;
+    }
+
     if (!ld->label)
 	return;			/* Nothing defined */
 
# end of patch



More information about the Syslinux mailing list