From ed1d0954ca4abf42d76a9da282650fe5bc6956bb Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Wed, 28 Feb 2018 04:31:19 +0000 Subject: [PATCH] lualoader: Further screen cleanup - Add screen.default_x and screen.default_y to determine where screen.defcursor resets the cursor to. - Use screen.setcursor in screen.defcursor instead of rewriting the escape sequence. - Use screen.default_y when resetting the cursor after writing the new twiddle character, add a comment verbally describing the position just in case. --- stand/lua/password.lua | 3 ++- stand/lua/screen.lua | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/stand/lua/password.lua b/stand/lua/password.lua index d14dec675436..c8352ea519d7 100644 --- a/stand/lua/password.lua +++ b/stand/lua/password.lua @@ -47,7 +47,8 @@ function password.read(prompt_length) local function draw_twiddle() loader.printc(" " .. twiddle_chars[twiddle_pos]) - screen.setcursor(prompt_length + 2, 25) + -- Reset cursor to just after the password prompt + screen.setcursor(prompt_length + 2, screen.default_y) twiddle_pos = (twiddle_pos % #twiddle_chars) + 1 end diff --git a/stand/lua/screen.lua b/stand/lua/screen.lua index 04ab98817c32..7382e2ebbc68 100644 --- a/stand/lua/screen.lua +++ b/stand/lua/screen.lua @@ -34,6 +34,9 @@ local core = require("core") local screen = {} -- Module exports +screen.default_x = 0 +screen.default_y = 25 + function screen.clear() if core.isSerialBoot() then return @@ -71,7 +74,7 @@ function screen.defcursor() if core.isSerialBoot() then return end - loader.printc(core.KEYSTR_CSI .. "25;0H") + screen.setcursor(screen.default_x, screen.default_y) end return screen