git: ee233742a569 - main - loader: Rework kernel menu section

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 09 Jan 2025 07:12:05 UTC
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=ee233742a5697f64d0f1d722b5e73ff2c5998c62

commit ee233742a5697f64d0f1d722b5e73ff2c5998c62
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2025-01-07 09:34:35 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2025-01-09 07:13:43 +0000

    loader: Rework kernel menu section
    
    With pkgbase we can have long kernel name, so create a new section
    for the kernel name.
    Do not show the "default" text, we already show the "1 of X" part at
    the end of the line and the default kernel is always number 1 so it's a bit
    redundant.
    
    Differential Revision:  https://reviews.freebsd.org/D48354
    Reviewed by:    imp, tsoome
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
---
 stand/lua/menu.lua | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/stand/lua/menu.lua b/stand/lua/menu.lua
index 2d92be3b7c6e..7c36b6c8d3c8 100644
--- a/stand/lua/menu.lua
+++ b/stand/lua/menu.lua
@@ -255,9 +255,16 @@ menu.welcome = {
 			},
 			{
 				entry_type = core.MENU_SEPARATOR,
-				name = "Options:",
+				name = "Kernel:",
 			},
 			menu_entries.kernel_options,
+			{
+				entry_type = core.MENU_SEPARATOR,
+			},
+			{
+				entry_type = core.MENU_SEPARATOR,
+				name = "Options:",
+			},
 			menu_entries.boot_options,
 			menu_entries.zpool_checkpoints,
 			menu_entries.boot_envs,
@@ -332,22 +339,19 @@ menu.welcome = {
 			items = core.kernelList,
 			name = function(idx, choice, all_choices)
 				if #all_choices == 0 then
-					return "Kernel: "
+					return ""
 				end
 
-				local is_default = (idx == 1)
-				local kernel_name = ""
+				local kernel_name
 				local name_color
-				if is_default then
+				if idx == 1 then
 					name_color = color.escapefg(color.GREEN)
-					kernel_name = "default/"
 				else
 					name_color = color.escapefg(color.CYAN)
 				end
-				kernel_name = kernel_name .. name_color ..
-				    choice .. color.resetfg()
-				return color.highlight("K") .. "ernel: " ..
-				    kernel_name .. " (" .. idx .. " of " ..
+				kernel_name = name_color .. choice ..
+				    color.resetfg()
+				return kernel_name .. " (" .. idx .. " of " ..
 				    #all_choices .. ")"
 			end,
 			func = function(_, choice, _)