svn commit: r353872 - head/stand/lua

Kyle Evans kevans at FreeBSD.org
Mon Oct 21 20:09:44 UTC 2019


Author: kevans
Date: Mon Oct 21 20:09:43 2019
New Revision: 353872
URL: https://svnweb.freebsd.org/changeset/base/353872

Log:
  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

Modified:
  head/stand/lua/color.lua
  head/stand/lua/screen.lua

Modified: head/stand/lua/color.lua
==============================================================================
--- head/stand/lua/color.lua	Mon Oct 21 18:40:03 2019	(r353871)
+++ head/stand/lua/color.lua	Mon Oct 21 20:09:43 2019	(r353872)
@@ -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

Modified: head/stand/lua/screen.lua
==============================================================================
--- head/stand/lua/screen.lua	Mon Oct 21 18:40:03 2019	(r353871)
+++ head/stand/lua/screen.lua	Mon Oct 21 20:09:43 2019	(r353872)
@@ -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


More information about the svn-src-all mailing list