From a6cf4be0421c1df870218105ce590203c285b5a2 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Mon, 21 Oct 2019 20:09:43 +0000 Subject: [PATCH] lualoader: don't botch disabling of color When colors are disabled, color.escape{fg,bg} would return the passed in color rather than the proper ANSI sequence for the color. color.escape{fg,bg} would be wrong. Instead return '', as the associated reset* functions will also return ''. This should get rid of the funky '2' and '4' in the kernel selector if you're booting serial. Reported by: npn --- stand/lua/color.lua | 4 ++-- stand/lua/screen.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stand/lua/color.lua b/stand/lua/color.lua index c5a3e1215c7e..870e921e2f77 100644 --- a/stand/lua/color.lua +++ b/stand/lua/color.lua @@ -58,7 +58,7 @@ color.disabled = not color.isEnabled() function color.escapefg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "3" .. color_value .. "m" end @@ -72,7 +72,7 @@ end function color.escapebg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "4" .. color_value .. "m" end diff --git a/stand/lua/screen.lua b/stand/lua/screen.lua index dfb53a452a35..baa58fb23dca 100644 --- a/stand/lua/screen.lua +++ b/stand/lua/screen.lua @@ -47,14 +47,14 @@ end function screen.setforeground(color_value) if color.disabled then - return color_value + return end printc(color.escapefg(color_value)) end function screen.setbackground(color_value) if color.disabled then - return color_value + return end printc(color.escapebg(color_value)) end