Author: kevans
Date: Wed Mar 21 15:09:47 2018
New Revision: 331304
URL: https://svnweb.freebsd.org/changeset/base/331304

Log:
  lualoader: Clear up some possible naming confusion
  
  In the original lualoader project, 'escapef' and 'escapeb' were chosen for
  'escape fg' and 'escape bg'. We've carried on this naming convention, and as
  our use of attributes grow the likeliness of 'escapeb'/'resetb' being
  confused upon glance for 'escape bold'/'reset bold' increases.
  
  Fix this by renaming these four functions to {escape,reset}{fg,bg} rather
  than {escape,reset}{f,b} for clarity.
  
  Reported by:  dteske

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

Modified: head/stand/lua/color.lua
==============================================================================
--- head/stand/lua/color.lua    Wed Mar 21 15:09:41 2018        (r331303)
+++ head/stand/lua/color.lua    Wed Mar 21 15:09:47 2018        (r331304)
@@ -58,28 +58,28 @@ end
 
 color.disabled = not color.isEnabled()
 
-function color.escapef(color_value)
+function color.escapefg(color_value)
        if color.disabled then
                return color_value
        end
        return core.KEYSTR_CSI .. "3" .. color_value .. "m"
 end
 
-function color.resetf()
+function color.resetfg()
        if color.disabled then
                return ''
        end
        return core.KEYSTR_CSI .. "39m"
 end
 
-function color.escapeb(color_value)
+function color.escapebg(color_value)
        if color.disabled then
                return color_value
        end
        return core.KEYSTR_CSI .. "4" .. color_value .. "m"
 end
 
-function color.resetb()
+function color.resetbg()
        if color.disabled then
                return ''
        end

Modified: head/stand/lua/menu.lua
==============================================================================
--- head/stand/lua/menu.lua     Wed Mar 21 15:09:41 2018        (r331303)
+++ head/stand/lua/menu.lua     Wed Mar 21 15:09:47 2018        (r331304)
@@ -46,11 +46,11 @@ local return_menu_entry = {
 
 local function OnOff(str, value)
        if value then
-               return str .. color.escapef(color.GREEN) .. "On" ..
-                   color.escapef(color.WHITE)
+               return str .. color.escapefg(color.GREEN) .. "On" ..
+                   color.escapefg(color.WHITE)
        else
-               return str .. color.escapef(color.RED) .. "off" ..
-                   color.escapef(color.WHITE)
+               return str .. color.escapefg(color.RED) .. "off" ..
+                   color.escapefg(color.WHITE)
        end
 end
 
@@ -115,12 +115,12 @@ menu.boot_environments = {
                                local bootenv_name = ""
                                local name_color
                                if is_default then
-                                       name_color = color.escapef(color.GREEN)
+                                       name_color = color.escapefg(color.GREEN)
                                else
-                                       name_color = color.escapef(color.BLUE)
+                                       name_color = color.escapefg(color.BLUE)
                                end
                                bootenv_name = bootenv_name .. name_color ..
-                                   choice .. color.resetf()
+                                   choice .. color.resetfg()
                                return color.highlight("A").."ctive: " ..
                                    bootenv_name .. " (" .. idx .. " of " ..
                                    #all_choices .. ")"
@@ -300,13 +300,13 @@ menu.welcome = {
                                local kernel_name = ""
                                local name_color
                                if is_default then
-                                       name_color = color.escapef(color.GREEN)
+                                       name_color = color.escapefg(color.GREEN)
                                        kernel_name = "default/"
                                else
-                                       name_color = color.escapef(color.BLUE)
+                                       name_color = color.escapefg(color.BLUE)
                                end
                                kernel_name = kernel_name .. name_color ..
-                                   choice .. color.resetf()
+                                   choice .. color.resetfg()
                                return color.highlight("K") .. "ernel: " ..
                                    kernel_name .. " (" .. idx .. " of " ..
                                    #all_choices .. ")"

Modified: head/stand/lua/screen.lua
==============================================================================
--- head/stand/lua/screen.lua   Wed Mar 21 15:09:41 2018        (r331303)
+++ head/stand/lua/screen.lua   Wed Mar 21 15:09:47 2018        (r331304)
@@ -56,14 +56,14 @@ function screen.setforeground(color_value)
        if color.disabled then
                return color_value
        end
-       printc(color.escapef(color_value))
+       printc(color.escapefg(color_value))
 end
 
 function screen.setbackground(color_value)
        if color.disabled then
                return color_value
        end
-       printc(color.escapeb(color_value))
+       printc(color.escapebg(color_value))
 end
 
 function screen.defcolor()
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to