aboutsummaryrefslogtreecommitdiff
path: root/stand/lua
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2018-03-03 17:38:25 +0000
committerKyle Evans <kevans@FreeBSD.org>2018-03-03 17:38:25 +0000
commitb435332653b5991db5f8ce6eed99b30d8acc71ae (patch)
treeb8916c193667d3d219b21613e31952ce661c49eb /stand/lua
parent953d8937d55926624d2a08a889a360ffc61024f8 (diff)
downloadsrc-b435332653b5991db5f8ce6eed99b30d8acc71ae.tar.gz
src-b435332653b5991db5f8ce6eed99b30d8acc71ae.zip
lualoader: Respect loader_menu_title_align
It may be set to "left" or "right" -- any other value will cause the title to be centered. I've chosen to position these things just inside the vertical borders, rather than overlapping the corners. This is an arbitrary choice and easily amendable if this looks terrible.
Notes
Notes: svn path=/head/; revision=330342
Diffstat (limited to 'stand/lua')
-rw-r--r--stand/lua/drawer.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua
index 91e518959c0e..a79c201da576 100644
--- a/stand/lua/drawer.lua
+++ b/stand/lua/drawer.lua
@@ -382,9 +382,22 @@ function drawer.drawbox()
local menu_header = loader.getenv("loader_menu_title") or
"Welcome to FreeBSD"
+ local menu_header_align = loader.getenv("loader_menu_title_align")
local menu_header_x
- menu_header_x = x + (w / 2) - (#menu_header / 2)
+ if menu_header_align ~= nil then
+ menu_header_align = menu_header_align:lower()
+ if menu_header_align == "left" then
+ -- Just inside the left border on top
+ menu_header_x = x + 1
+ elseif menu_header_align == "right" then
+ -- Just inside the right border on top
+ menu_header_x = x + w - #menu_header
+ end
+ end
+ if menu_header_x == nil then
+ menu_header_x = x + (w / 2) - (#menu_header / 2)
+ end
screen.setcursor(menu_header_x, y)
printc(menu_header)
end