Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2019 20:09:43 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353872 - head/stand/lua
Message-ID:  <201910212009.x9LK9hDd038985@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910212009.x9LK9hDd038985>