menu.lua (4955048946130b56e0dc390eb137963a5a40d7c3) | menu.lua (20a81676640d7a9af91d00ef0acaf876dae1ba88) |
---|---|
1-- 2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 3-- Copyright (C) 2018 Kyle Evans <kevans@FreeBSD.org> 4-- All rights reserved. 5-- 6-- Redistribution and use in source and binary forms, with or without 7-- modification, are permitted provided that the following conditions 8-- are met: --- 313 unchanged lines hidden (view full) --- 322 submenu = function() 323 return menu.boot_options 324 end, 325 alias = {"o", "O"} 326 }, 327 }, 328} 329 | 1-- 2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> 3-- Copyright (C) 2018 Kyle Evans <kevans@FreeBSD.org> 4-- All rights reserved. 5-- 6-- Redistribution and use in source and binary forms, with or without 7-- modification, are permitted provided that the following conditions 8-- are met: --- 313 unchanged lines hidden (view full) --- 322 submenu = function() 323 return menu.boot_options 324 end, 325 alias = {"o", "O"} 326 }, 327 }, 328} 329 |
330menu.default = menu.welcome 331 |
|
330function menu.run(m) 331 332 if menu.skip() then 333 core.autoboot() 334 return false 335 end 336 337 if m == nil then | 332function menu.run(m) 333 334 if menu.skip() then 335 core.autoboot() 336 return false 337 end 338 339 if m == nil then |
338 m = menu.welcome | 340 m = menu.default |
339 end 340 341 -- redraw screen 342 screen.clear() 343 screen.defcursor() 344 local alias_table = drawer.drawscreen(m) 345 346 menu.autoboot() 347 348 cont = true 349 while cont do 350 local key = io.getchar() 351 352 -- Special key behaviors 353 if (key == core.KEY_BACKSPACE or key == core.KEY_DELETE) and | 341 end 342 343 -- redraw screen 344 screen.clear() 345 screen.defcursor() 346 local alias_table = drawer.drawscreen(m) 347 348 menu.autoboot() 349 350 cont = true 351 while cont do 352 local key = io.getchar() 353 354 -- Special key behaviors 355 if (key == core.KEY_BACKSPACE or key == core.KEY_DELETE) and |
354 m ~= menu.welcome then | 356 m ~= menu.default then |
355 break 356 elseif key == core.KEY_ENTER then 357 core.boot() 358 -- Should not return 359 end 360 361 key = string.char(key) 362 -- check to see if key is an alias --- 19 unchanged lines hidden (view full) --- 382 end 383 -- if we got an alias key the screen is out of date: 384 screen.clear() 385 screen.defcursor() 386 alias_table = drawer.drawscreen(m) 387 end 388 end 389 | 357 break 358 elseif key == core.KEY_ENTER then 359 core.boot() 360 -- Should not return 361 end 362 363 key = string.char(key) 364 -- check to see if key is an alias --- 19 unchanged lines hidden (view full) --- 384 end 385 -- if we got an alias key the screen is out of date: 386 screen.clear() 387 screen.defcursor() 388 alias_table = drawer.drawscreen(m) 389 end 390 end 391 |
390 if m == menu.welcome then | 392 if m == menu.default then |
391 screen.defcursor() 392 print("Exiting menu!") 393 return false 394 end 395 396 return true 397end 398 --- 62 unchanged lines hidden --- | 393 screen.defcursor() 394 print("Exiting menu!") 395 return false 396 end 397 398 return true 399end 400 --- 62 unchanged lines hidden --- |