svn commit: r330099 - head/stand/lua

Kyle Evans kevans at FreeBSD.org
Wed Feb 28 04:31:20 UTC 2018


Author: kevans
Date: Wed Feb 28 04:31:19 2018
New Revision: 330099
URL: https://svnweb.freebsd.org/changeset/base/330099

Log:
  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.

Modified:
  head/stand/lua/password.lua
  head/stand/lua/screen.lua

Modified: head/stand/lua/password.lua
==============================================================================
--- head/stand/lua/password.lua	Wed Feb 28 04:23:28 2018	(r330098)
+++ head/stand/lua/password.lua	Wed Feb 28 04:31:19 2018	(r330099)
@@ -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
 

Modified: head/stand/lua/screen.lua
==============================================================================
--- head/stand/lua/screen.lua	Wed Feb 28 04:23:28 2018	(r330098)
+++ head/stand/lua/screen.lua	Wed Feb 28 04:31:19 2018	(r330099)
@@ -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


More information about the svn-src-all mailing list