lualoader: Replace instances of \027 with KEYSTR_ESCAPE

With exception to drawing bits, which should probably be kept as-is to not
make a mess out of things.

Reported by:	rpokala (a while ago)
This commit is contained in:
Kyle Evans 2018-02-27 21:52:22 +00:00
parent 8620ae0187
commit d5b2439e5d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330084
2 changed files with 12 additions and 12 deletions

View File

@ -62,14 +62,14 @@ function color.escapef(color_value)
if color.disabled then if color.disabled then
return color_value return color_value
end end
return "\027[3" .. color_value .. "m" return core.KEYSTR_ESCAPE .. "[3" .. color_value .. "m"
end end
function color.escapeb(color_value) function color.escapeb(color_value)
if color.disabled then if color.disabled then
return color_value return color_value
end end
return "\027[4" .. color_value .. "m" return core.KEYSTR_ESCAPE .. "[4" .. color_value .. "m"
end end
function color.escape(fg_color, bg_color, attribute) function color.escape(fg_color, bg_color, attribute)
@ -81,7 +81,7 @@ function color.escape(fg_color, bg_color, attribute)
else else
attribute = attribute .. ";" attribute = attribute .. ";"
end end
return "\027[" .. attribute .. return core.KEYSTR_ESCAPE .. "[" .. attribute ..
"3" .. fg_color .. ";4" .. bg_color .. "m" "3" .. fg_color .. ";4" .. bg_color .. "m"
end end
@ -89,14 +89,14 @@ function color.default()
if color.disabled then if color.disabled then
return "" return ""
end end
return "\027[0;37;40m" return core.KEYSTR_ESCAPE .. "[0;37;40m"
end end
function color.highlight(str) function color.highlight(str)
if color.disabled then if color.disabled then
return str return str
end end
return "\027[1m" .. str .. "\027[0m" return core.KEYSTR_ESCAPE .. "[1m" .. str .. core.KEYSTR_ESCAPE .. "[0m"
end end
return color return color

View File

@ -38,7 +38,7 @@ function screen.clear()
if core.isSerialBoot() then if core.isSerialBoot() then
return return
end end
loader.printc("\027[H\027[J") loader.printc(core.KEYSTR_ESCAPE .. "[H" .. core.KEYSTR_ESCAPE .. "[J")
end end
function screen.setcursor(x, y) function screen.setcursor(x, y)
@ -46,7 +46,7 @@ function screen.setcursor(x, y)
return return
end end
loader.printc("\027[" .. y .. ";" .. x .. "H") loader.printc(core.KEYSTR_ESCAPE .. "[" .. y .. ";" .. x .. "H")
end end
function screen.movecursor(dx, dy) function screen.movecursor(dx, dy)
@ -55,15 +55,15 @@ function screen.movecursor(dx, dy)
end end
if dx < 0 then if dx < 0 then
loader.printc("\027[" .. -dx .. "D") loader.printc(core.KEYSTR_ESCAPE .. "[" .. -dx .. "D")
elseif dx > 0 then elseif dx > 0 then
loader.printc("\027[" .. dx .. "C") loader.printc(core.KEYSTR_ESCAPE .. "[" .. dx .. "C")
end end
if dy < 0 then if dy < 0 then
loader.printc("\027[" .. -dy .. "A") loader.printc(core.KEYSTR_ESCAPE .. "[" .. -dy .. "A")
elseif dy > 0 then elseif dy > 0 then
loader.printc("\027[" .. dy .. "B") loader.printc(core.KEYSTR_ESCAPE .. "[" .. dy .. "B")
end end
end end
@ -89,7 +89,7 @@ function screen.defcursor()
if core.isSerialBoot() then if core.isSerialBoot() then
return return
end end
loader.printc("\027[25;0H") loader.printc(core.KEYSTR_ESCAPE .. "[25;0H")
end end
return screen return screen