lualoader: only clear the screen before first password prompt

This was previously an unconditional screen clear, regardless of whether or
not we would be prompting for any passwords. This is pointless, given that
the screen clear is only there to put our screen into a consistent state
before we draw the prompts and do cursor manipulation.

This is also the only screen clear besides that to draw the menu.  One can
now see early pre-loader and loader output with the menu disabled, which may
be useful for diagnostics.

Reported by:	ian
MFC after:	3 days
This commit is contained in:
kevans 2019-02-18 02:59:47 +00:00
parent 873314cd7b
commit acc6aa1475

View File

@ -38,6 +38,7 @@ local INCORRECT_PASSWORD = "loader: incorrect password"
-- Asterisks as a password mask
local show_password_mask = false
local twiddle_chars = {"/", "-", "\\", "|"}
local screen_setup = false
-- Module exports
function password.read(prompt_length)
@ -80,8 +81,6 @@ function password.read(prompt_length)
end
function password.check()
screen.clear()
screen.defcursor()
-- pwd is optionally supplied if we want to check it
local function doPrompt(prompt, pwd)
local attempts = 1
@ -90,6 +89,12 @@ function password.check()
printc("\r" .. string.rep(" ", #INCORRECT_PASSWORD))
end
if not screen_setup then
screen.clear()
screen.defcursor()
screen_setup = true
end
while true do
if attempts > 1 then
clear_incorrect_text_prompt()