summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/include_lua/printtable.lua
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-04-29 01:56:49 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2021-04-30 13:38:54 +0000
commit20cd89908d3b7276c50295ccd6c4f09f7324f6e2 (patch)
tree794d3da185c17429a64881eb8702dae9659f1b5a /apps/plugins/lua/include_lua/printtable.lua
parent48b77898dce686f77b86adb977ba49400f5a3f7d (diff)
downloadrockbox-20cd89908d3b7276c50295ccd6c4f09f7324f6e2.tar.gz
rockbox-20cd89908d3b7276c50295ccd6c4f09f7324f6e2.zip
lua submenus add a way to dynamically add items
updated example script and renamed some functions as well fixed bug in printtable cursor position if greater than maxlines for the screen would reset to item 1 now we move the list start and select it (and try to center it on the screen) fixed a few bugs in the add_menu code Change-Id: I01dead0481ef2e925af8b4cc6c14e36c2859dbba
Diffstat (limited to 'apps/plugins/lua/include_lua/printtable.lua')
-rw-r--r--apps/plugins/lua/include_lua/printtable.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/plugins/lua/include_lua/printtable.lua b/apps/plugins/lua/include_lua/printtable.lua
index bf81c7b060..7a883367b7 100644
--- a/apps/plugins/lua/include_lua/printtable.lua
+++ b/apps/plugins/lua/include_lua/printtable.lua
@@ -336,6 +336,16 @@ function print_table(t, t_count, settings)
336 336
337 table_p = init_position(15, 5) 337 table_p = init_position(15, 5)
338 line, maxline = _print.opt.area(5, 1, rb.LCD_WIDTH - 10 - sb_width, rb.LCD_HEIGHT - 2) 338 line, maxline = _print.opt.area(5, 1, rb.LCD_WIDTH - 10 - sb_width, rb.LCD_HEIGHT - 2)
339
340 if curpos > maxline then
341 local c = maxline / 2
342 start = (start or 1) + curpos - maxline
343 curpos = maxline
344 while start + maxline <= t_count and curpos > c do
345 curpos = curpos - 1
346 start = start + 1
347 end
348 end
339 maxline = math.min(maxline, t_count) 349 maxline = math.min(maxline, t_count)
340 350
341 -- allow user to start at a position other than the beginning 351 -- allow user to start at a position other than the beginning