stand/lua: Round up some more style.lua(9) concerns

This commit is contained in:
Kyle Evans 2018-02-19 17:51:33 +00:00
parent 5c1b516581
commit 1f5696c7fd
5 changed files with 21 additions and 19 deletions

View File

@ -26,10 +26,10 @@
-- $FreeBSD$
--
local color = {};
local core = require("core");
local color = {};
color.BLACK = 0;
color.RED = 1;
color.GREEN = 2;
@ -59,14 +59,14 @@ function color.escapef(c)
if (color.disabled) then
return c;
end
return "\027[3"..c.."m";
return "\027[3" .. c .. "m";
end
function color.escapeb(c)
if (color.disabled) then
return c;
end
return "\027[4"..c.."m";
return "\027[4" .. c .. "m";
end
function color.escape(fg, bg, att)
@ -76,9 +76,9 @@ function color.escape(fg, bg, att)
if (not att) then
att = ""
else
att = att..";";
att = att .. ";";
end
return "\027["..att.."3"..fg..";4"..bg.."m";
return "\027[" .. att .. "3" .. fg .. ";4" .. bg .. "m";
end
function color.default()
@ -92,7 +92,7 @@ function color.highlight(str)
if (color.disabled) then
return str;
end
return "\027[1m"..str.."\027[0m";
return "\027[1m" .. str .. "\027[0m";
end
return color;

View File

@ -196,7 +196,7 @@ function config.loadmod(mod, silent)
if (not silent) then
print("Failed to execute '" ..
v.before ..
"' before loading '".. k ..
"' before loading '" .. k ..
"'");
end
status = false;
@ -227,7 +227,9 @@ function config.loadmod(mod, silent)
end
else
--if not silent then print("Skiping module '".. k .. "'"); end
-- if not silent then
-- print("Skiping module '". . k .. "'");
-- end
end
end
@ -431,4 +433,4 @@ function config.loadelf()
end
return config
return config;

View File

@ -193,7 +193,7 @@ function drawer.drawmenu(m)
else
name = e.name();
end
print(entry_num .. ". "..name);
print(entry_num .. ". " .. name);
-- fill the alias table
alias_table[tostring(entry_num)] = e;

View File

@ -252,7 +252,7 @@ menu.welcome = {
end
kernel_name = kernel_name .. name_color ..
choice .. color.default();
return color.highlight("K").."ernel: " ..
return color.highlight("K") .. "ernel: " ..
kernel_name .. " (" .. idx .. " of " ..
#all_choices .. ")";
end,
@ -315,7 +315,7 @@ function menu.run(m)
-- Special key behaviors
if ((key == core.KEY_BACKSPACE) or (key == core.KEY_DELETE)) and
(m ~= menu.welcome) then
break
break;
elseif (key == core.KEY_ENTER) then
core.boot();
-- Should not return
@ -431,7 +431,7 @@ function menu.autoboot()
end
loader.delay(50000);
until time <= 0
until time <= 0;
core.boot();
end

View File

@ -26,11 +26,11 @@
-- $FreeBSD$
--
local screen = {};
local color = require("color");
local core = require("core");
local screen = {};
-- XXX TODO: This should be fixed in the interpreter to not print decimals
function intstring(num)
local str = tostring(num);
@ -54,21 +54,21 @@ function screen.setcursor(x, y)
return;
end
loader.printc("\027["..intstring(y)..";"..intstring(x).."H");
loader.printc("\027[" .. intstring(y) .. ";" .. intstring(x) .. "H");
end
function screen.setforeground(c)
if (color.disabled) then
return c;
end
loader.printc("\027[3"..c.."m");
loader.printc("\027[3" .. c .. "m");
end
function screen.setbackground(c)
if (color.disabled) then
return c;
end
loader.printc("\027[4"..c.."m");
loader.printc("\027[4" .. c .. "m");
end
function screen.defcolor()