Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Mar 2018 20:26:24 +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: r331259 - head/stand/lua
Message-ID:  <201803202026.w2KKQOP2036471@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Tue Mar 20 20:26:24 2018
New Revision: 331259
URL: https://svnweb.freebsd.org/changeset/base/331259

Log:
  lualoader: Use less atomic options for resetting colors/attributes
  
  Noted by dteske:
  
  CSI 1m ... CSI 22m
  CSI 2m ... CSI 22m
  CSI 4m ... CSI 24m
  CSI 5m ... CSI 25m
  CSI 7m ... CSI 27m
  CSI 8m ... CSI 28m
  CSI (30-37)m ... CSI 39m
  CSI (40-47)m ... CSI 49m
  
  - Provide resetf/resetb to match escapef/escapeb
  - Use CSI 22m to undo a bold
  
  This is a more reasonable approach than what was previously taken.
  
  Reported by:	dteske

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

Modified: head/stand/lua/color.lua
==============================================================================
--- head/stand/lua/color.lua	Tue Mar 20 20:20:49 2018	(r331258)
+++ head/stand/lua/color.lua	Tue Mar 20 20:26:24 2018	(r331259)
@@ -65,6 +65,13 @@ function color.escapef(color_value)
 	return core.KEYSTR_CSI .. "3" .. color_value .. "m"
 end
 
+function color.resetf()
+	if color.disabled then
+		return ''
+	end
+	return core.KEYSTR_CSI .. "39m"
+end
+
 function color.escapeb(color_value)
 	if color.disabled then
 		return color_value
@@ -72,6 +79,13 @@ function color.escapeb(color_value)
 	return core.KEYSTR_CSI .. "4" .. color_value .. "m"
 end
 
+function color.resetb()
+	if color.disabled then
+		return ''
+	end
+	return core.KEYSTR_CSI .. "49m"
+end
+
 function color.escape(fg_color, bg_color, attribute)
 	if color.disabled then
 		return ""
@@ -98,7 +112,7 @@ function color.highlight(str)
 	end
 	-- We need to reset attributes as well as color scheme here, just in
 	-- case the terminal defaults don't match what we're expecting.
-	return core.KEYSTR_CSI .. "1m" .. str .. color.default()
+	return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "22m"
 end
 
 return color

Modified: head/stand/lua/menu.lua
==============================================================================
--- head/stand/lua/menu.lua	Tue Mar 20 20:20:49 2018	(r331258)
+++ head/stand/lua/menu.lua	Tue Mar 20 20:26:24 2018	(r331259)
@@ -120,7 +120,7 @@ menu.boot_environments = {
 					name_color = color.escapef(color.BLUE)
 				end
 				bootenv_name = bootenv_name .. name_color ..
-				    choice .. color.default()
+				    choice .. color.resetf()
 				return color.highlight("A").."ctive: " ..
 				    bootenv_name .. " (" .. idx .. " of " ..
 				    #all_choices .. ")"
@@ -306,7 +306,7 @@ menu.welcome = {
 					name_color = color.escapef(color.BLUE)
 				end
 				kernel_name = kernel_name .. name_color ..
-				    choice .. color.default()
+				    choice .. color.resetf()
 				return color.highlight("K") .. "ernel: " ..
 				    kernel_name .. " (" .. idx .. " of " ..
 				    #all_choices .. ")"



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