Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2018 04:12:20 +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: r329861 - head/stand/lua
Message-ID:  <201802230412.w1N4CKTi058707@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Fri Feb 23 04:12:19 2018
New Revision: 329861
URL: https://svnweb.freebsd.org/changeset/base/329861

Log:
  lualoader: Track effective line number, use it for drawing
  
  Takes into account hidden entries, so that we don't draw blank lines in
  place of a hidden item.

Modified:
  head/stand/lua/drawer.lua

Modified: head/stand/lua/drawer.lua
==============================================================================
--- head/stand/lua/drawer.lua	Fri Feb 23 04:06:15 2018	(r329860)
+++ head/stand/lua/drawer.lua	Fri Feb 23 04:12:19 2018	(r329861)
@@ -273,6 +273,7 @@ function drawer.drawmenu(m)
 	local alias_table = {}
 	local entry_num = 0
 	local menu_entries = m.entries
+	local effective_line_num = 0
 	if type(menu_entries) == "function" then
 		menu_entries = menu_entries()
 	end
@@ -282,9 +283,10 @@ function drawer.drawmenu(m)
 		if e.visible ~= nil and not e.visible() then
 			goto continue
 		end
+		effective_line_num = effective_line_num + 1
 		if e.entry_type ~= core.MENU_SEPARATOR then
 			entry_num = entry_num + 1
-			screen.setcursor(x, y + line_num)
+			screen.setcursor(x, y + effective_line_num)
 
 			print(entry_num .. ". " .. menu_entry_name(m, e))
 
@@ -296,7 +298,7 @@ function drawer.drawmenu(m)
 				end
 			end
 		else
-			screen.setcursor(x, y + line_num)
+			screen.setcursor(x, y + effective_line_num)
 			print(menu_entry_name(m, e))
 		end
 		::continue::



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802230412.w1N4CKTi058707>