lualoader: Don't execute menu.autoboot() for every opened menu
Attempt to autoboot when we open the default menu, and only when we open the default menu. This alleviates the need for checking menu.already_autoboot, because we're not trying to autoboot every time we open a submenu. I note that escaping to loader prompt and going back to the menu (by running require('menu').run() at the loader prompt) will happily work and not re-initiate the autoboot sequence since "Escape to loader prompt" disables the autoboot_delay.
This commit is contained in:
parent
3889e6cd04
commit
7dcffa9042
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329734
@ -361,8 +361,10 @@ function menu.run(m)
|
|||||||
local alias_table = drawer.drawscreen(m)
|
local alias_table = drawer.drawscreen(m)
|
||||||
|
|
||||||
-- Might return nil, that's ok
|
-- Might return nil, that's ok
|
||||||
local autoboot_key = menu.autoboot()
|
local autoboot_key;
|
||||||
|
if m == menu.default then
|
||||||
|
autoboot_key = menu.autoboot()
|
||||||
|
end
|
||||||
cont = true
|
cont = true
|
||||||
while cont do
|
while cont do
|
||||||
local key = autoboot_key or io.getchar()
|
local key = autoboot_key or io.getchar()
|
||||||
@ -430,11 +432,6 @@ function menu.skip()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function menu.autoboot()
|
function menu.autoboot()
|
||||||
if menu.already_autoboot then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
menu.already_autoboot = true
|
|
||||||
|
|
||||||
local ab = loader.getenv("autoboot_delay")
|
local ab = loader.getenv("autoboot_delay")
|
||||||
if ab ~= nil and ab:lower() == "no" then
|
if ab ~= nil and ab:lower() == "no" then
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user