Date: Tue, 20 Feb 2018 04:11:48 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329622 - head/stand/lua Message-ID: <201802200411.w1K4Bm2M058514@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Tue Feb 20 04:11:48 2018 New Revision: 329622 URL: https://svnweb.freebsd.org/changeset/base/329622 Log: stand/lua: Move drawer.menu_name_handlers further up As a good candidate for modification, move this table further up in the module to improve visibility. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 03:58:45 2018 (r329621) +++ head/stand/lua/drawer.lua Tue Feb 20 04:11:48 2018 (r329622) @@ -32,6 +32,24 @@ local screen = require("screen"); local drawer = {}; +drawer.menu_name_handlers = { + -- Menu name handlers should take the menu being drawn and entry being + -- drawn as parameters, and return the name of the item. + -- This is designed so that everything, including menu separators, may + -- have their names derived differently. The default action for entry + -- types not specified here is to call and use entry.name(). + [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) + local carid = entry.carousel_id; + local caridx = menu.getCarouselIndex(carid); + local choices = entry.items(); + + if (#choices < caridx) then + caridx = 1; + end + return entry.name(caridx, choices[caridx], choices); + end, +}; + drawer.brand_position = {x = 2, y = 1}; drawer.fbsd_logo = { " ______ ____ _____ _____ ", @@ -158,24 +176,6 @@ function drawer.drawscreen(menu_opts) drawer.drawbox(); return drawer.drawmenu(menu_opts); end - -drawer.menu_name_handlers = { - -- Menu name handlers should take the menu being drawn and entry being - -- drawn as parameters, and return the name of the item. - -- This is designed so that everything, including menu separators, may - -- have their names derived differently. The default action for entry - -- types not specified here is to call and use entry.name(). - [core.MENU_CAROUSEL_ENTRY] = function(drawing_menu, entry) - local carid = entry.carousel_id; - local caridx = menu.getCarouselIndex(carid); - local choices = entry.items(); - - if (#choices < caridx) then - caridx = 1; - end - return entry.name(caridx, choices[caridx], choices); - end, -}; function menu_entry_name(drawing_menu, entry) local name_handler = drawer.menu_name_handlers[entry.entry_type];
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802200411.w1K4Bm2M058514>