svn commit: r330010 - head/stand/lua

Kyle Evans kevans at FreeBSD.org
Mon Feb 26 04:12:55 UTC 2018


Author: kevans
Date: Mon Feb 26 04:12:54 2018
New Revision: 330010
URL: https://svnweb.freebsd.org/changeset/base/330010

Log:
  lualoader: screen argument fixes
  
  screen was also guilty of not-so-great argument names, but it was also
  guilty of handling color sequences on its own. Change those bits to using
  the color module instead.
  
  As a side note, between color and screen, I'm not 100% sure that returning
  the color_value is the right thing to do if we won't generate the escape
  sequences. This should be re-evaluated at a later time, and they should
  likely return nil instead.

Modified:
  head/stand/lua/screen.lua

Modified: head/stand/lua/screen.lua
==============================================================================
--- head/stand/lua/screen.lua	Mon Feb 26 04:08:54 2018	(r330009)
+++ head/stand/lua/screen.lua	Mon Feb 26 04:12:54 2018	(r330010)
@@ -49,18 +49,18 @@ function screen.setcursor(x, y)
 	loader.printc("\027[" .. y .. ";" .. x .. "H")
 end
 
-function screen.setforeground(c)
+function screen.setforeground(color_value)
 	if color.disabled then
-		return c
+		return color_value
 	end
-	loader.printc("\027[3" .. c .. "m")
+	loader.printc(color.escapef(color_value))
 end
 
-function screen.setbackground(c)
+function screen.setbackground(color_value)
 	if color.disabled then
-		return c
+		return color_value
 	end
-	loader.printc("\027[4" .. c .. "m")
+	loader.printc(color.escapeb(color_value))
 end
 
 function screen.defcolor()


More information about the svn-src-head mailing list