a1ive/grub

menuentry --help-msg buggy

steve6375 opened this issue · 10 comments

image
Same menu entry if move cursor up...
image

image
Sometimes parts missing
Sometimes no message.
Depends on up/down cursor selection - you get different results!

#a1ive grub file manager must be first menu entry (either keep as entry 0 or remove this entry)
if [ -d "(${bootdev},msdos1)/_ISO/MAINMENU" ] ; then 
	menuentry "a1ive grub2 File Manager (/_ISO/MAINMENUX)" --help-msg="qwertyasdfghjkl"  --class=dir {
		delvars
		grubfm "(${bootdev},msdos1)/_ISO/MAINMENU/"
	}
else
	menuentry "a1ive grub2 File Manager" --class=dir {
		delvars
		grubfm
	}
fi

if [ -f "${grubfm0}" ] ; then 
	menuentry "${grubfm0_title}" --class=exe --help-msg="0aaaaa bbbbb ccccc ddddd eeeee fffff" {
		set grubfm_file="${grubfm0}"
		if [ "${grubfm0_type}" = "wininst" ] ; then delvars; configfile (${user})/boot/grubfm/rules/iso/win.sh ; fi
		if [ "${grubfm0_type}" = "e2biso" ]  ; then delvars; configfile (${user})/boot/grubfm/rules/iso/e2b.sh ; fi
		delvars; grubfm_open "${grubfm_file}"
	}
fi

if [ -f "${grubfm1}" ] ; then 
	menuentry "${grubfm1_title}" --help-msg="bbbbbbbbbbb" --class=exe --help-msg="1aaaaa bbbbb ccccc ddddd eeeee fffff" {
		set grubfm_file="${grubfm1}"
		if [ "${grubfm1_type}" = "wininst" ] ; then delvars; configfile (${user})/boot/grubfm/rules/iso/win.sh ; fi
		if [ "${grubfm1_type}" = "e2biso" ]  ; then delvars; configfile (${user})/boot/grubfm/rules/iso/e2b.sh ; fi
		delvars; grubfm_open "${grubfm_file}"
	}
fi

if [ -f "${grubfm2}" ] ; then 
	menuentry "${grubfm2_title}" --help-msg="cccccccccc" --class=exe --help-msg="2aaaaa bbbbb ccccc ddddd eeeee fffff" {
		set grubfm_file="${grubfm2}"
		if [ "${grubfm2_type}" = "wininst" ] ; then delvars; configfile (${user})/boot/grubfm/rules/iso/win.sh ; fi
		if [ "${grubfm2_type}" = "e2biso" ]  ; then delvars; configfile (${user})/boot/grubfm/rules/iso/e2b.sh ; fi
		grubfm_open "${grubfm_file}"
	}
fi

if [ -f "${grubfm3}" ] ; then 
	menuentry "${grubfm3_title}" --class=exe --help-msg="3aaaaa bbbbb ccccc ddddd eeeee fffff" {
		set grubfm_file="${grubfm3}"
		if [ "${grubfm3_type}" = "wininst" ] ; then delvars; configfile (${user})/boot/grubfm/rules/iso/win.sh ; fi
		if [ "${grubfm3_type}" = "e2biso" ]  ; then delvars; configfile (${user})/boot/grubfm/rules/iso/e2b.sh ; fi
		delvars; grubfm_open "${grubfm_file}"
	}
fi

a1ive commented

I have rewritten this part of the code and now you can test it.
Text mode is not supported for now.
Note that since the length of the help text is not fixed, I hard-coded the length of the label to 65535. if the label is inside the hbox, there is no way to display any of the components after it.
theme.txt:

...
+ hbox {
  left = 0%
  top = 0%
  width = 100%
  + label {text = "HELP:" color = "#ffffff"}
  + label {id = "__help__" color = "#ffffff"}
}
...

menu:

menuentry "aaa" --help-msg="menu aaa" {
  echo aaa
}

menuentry "bbb" --help-msg="test 22222" {
  echo aaa
}

menuentry "ccc" --help-msg="qwerty" {
  echo aaa
}

menuentry "ddd" --help-msg="microsoft windows" {
  echo aaa
}

menuentry "eee" {
  echo aaa
}

menuentry "fff" --help-msg=" KVMKVM " {
  echo aaa
}

menuentry "grubfm" --help-msg="grub2-filemanager" {
  grubfm
}
a1ive commented

now also available in text mode.
深度截图_选择区域_20201222130618

Graphics mode seems to work OK now :-)
Small issues with text mode
The grub2 menu help text is not cleared
image
also cursor is left on screen
image

config file

	#Remove standard agFM theme
	unset theme_std; unset theme_fm; unset theme_open; unset theme_info; unset theme_help;
	unset theme
	terminal_output console
	#Menu colours - format: text/background
	#Choice for text: black,blue,brown,cyan,dark-gray,green,light-cyan,light-blue,light-green,light-gray,light-magenta,light-red,magenta,red,white,yellow
	#in console mode background colours are restricted to black,blue,brown,cyan,light-gray,green,magenta,red
	set menu_color_highlight=red/black
	set menu_color_normal=cyan/black
	set color_normal=light-gray/black

P.S. How to specify colour for help text in console mode?

a1ive commented

The grub2 menu help text is not cleared
also cursor is left on screen

now should be fixed.

How to specify colour for help text in console mode?

color_normal

深度截图_选择区域_20201222220835

OK - so must be same colour as heading.

a1ive commented

'--help-msg' still doesn't work.
I have temporarily withdrawn these patches.

this works.

+ vbox {
  left = 0%
  top = 0%
  + label {
    id = "__help__"
    color = "#ffffff"
  }
}

this doesn't work.

+ vbox {
  left = 35%
  top = 20%
  + label {
    id = "__help__"
    color = "#ffffff"
  }
}
a1ive commented

bug fixed.
1

A1ive kralsın süper ***** 🏔️

I congratulate you, master. If you accept, I have a suggestion. I think it would be more pleasant if it was done as in the picture.
Grubfm