mirror of
https://github.com/opnsense/src.git
synced 2026-02-18 18:20:26 -05:00
loader: Use printc instead of print to fit in 24,80
print automatically adds a newline, while printc does not. Use printc in preference to print for managing the autoboot message. This means we can use line 24 safely on a 24x80 terminal, restoring some functionality that was lost in 101afbc6ee2f0. Note: we still set the default curosor position to 25,1 in screen.lua, but real VT100s (and successors) will treat any row larger than the pnumber of rows in a cursor motion command to be the last physical row (this is so you can move to 9999,9999 and do a cursor location query to get the size of the screen). Keeping that as is looks better on a typical VGA console. Fixes: 101afbc6ee2f0 Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D46771 (cherry picked from commit 3fb656f8ef21332d96de8097521aaa51ddeb649d)
This commit is contained in:
parent
3463f0d85a
commit
940984f4c1
1 changed files with 7 additions and 3 deletions
|
|
@ -530,6 +530,7 @@ function menu.run()
|
|||
drawn_menu = nil
|
||||
|
||||
screen.defcursor()
|
||||
-- We explicitly want the newline print adds
|
||||
print("Exiting menu!")
|
||||
end
|
||||
|
||||
|
|
@ -544,7 +545,7 @@ function menu.autoboot(delay)
|
|||
if last == nil or last ~= time then
|
||||
last = time
|
||||
screen.setcursor(x, y)
|
||||
print("Autoboot in " .. time ..
|
||||
printc("Autoboot in " .. time ..
|
||||
" seconds. [Space] to pause ")
|
||||
screen.defcursor()
|
||||
end
|
||||
|
|
@ -553,9 +554,12 @@ function menu.autoboot(delay)
|
|||
if ch == core.KEY_ENTER then
|
||||
break
|
||||
else
|
||||
-- erase autoboot msg
|
||||
-- Erase autoboot msg. While real VT100s
|
||||
-- wouldn't scroll when receiving a char with
|
||||
-- the cursor at (24, 79), bad emulators do.
|
||||
-- Avoid the issue by stopping at 79.
|
||||
screen.setcursor(0, y)
|
||||
print(string.rep(" ", 80))
|
||||
printc(string.rep(" ", 79))
|
||||
screen.defcursor()
|
||||
return ch
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue