summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/menu.c9
-rw-r--r--apps/tree.c9
2 files changed, 15 insertions, 3 deletions
diff --git a/apps/menu.c b/apps/menu.c
index d35db0e23c..04e0bb278c 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -319,6 +319,10 @@ int menu_show(int m)
319 case MENU_PREV: 319 case MENU_PREV:
320 case MENU_PREV | BUTTON_REPEAT: 320 case MENU_PREV | BUTTON_REPEAT:
321 if (menus[m].cursor) { 321 if (menus[m].cursor) {
322 /* keep the cursor at 1/3 of the screen */
323 if (menus[m].top && menus[m].cursor - menus[m].top <
324 menu_lines - (2 * menu_lines) / 3)
325 menus[m].top--;
322 /* move up */ 326 /* move up */
323 put_cursor(m, menus[m].cursor-1); 327 put_cursor(m, menus[m].cursor-1);
324 } 328 }
@@ -327,7 +331,6 @@ int menu_show(int m)
327 menus[m].top = menus[m].itemcount-(menu_lines+1); 331 menus[m].top = menus[m].itemcount-(menu_lines+1);
328 if (menus[m].top < 0) 332 if (menus[m].top < 0)
329 menus[m].top = 0; 333 menus[m].top = 0;
330 menus[m].cursor = menus[m].itemcount-1;
331 put_cursor(m, menus[m].itemcount-1); 334 put_cursor(m, menus[m].itemcount-1);
332 } 335 }
333 break; 336 break;
@@ -335,6 +338,10 @@ int menu_show(int m)
335 case MENU_NEXT: 338 case MENU_NEXT:
336 case MENU_NEXT | BUTTON_REPEAT: 339 case MENU_NEXT | BUTTON_REPEAT:
337 if (menus[m].cursor < menus[m].itemcount-1) { 340 if (menus[m].cursor < menus[m].itemcount-1) {
341 /* keep the cursor at 2/3 of the screen */
342 if (menus[m].itemcount - menus[m].top > menu_lines &&
343 menus[m].cursor - menus[m].top >= (2 * menu_lines) / 3)
344 menus[m].top++;
338 /* move down */ 345 /* move down */
339 put_cursor(m, menus[m].cursor+1); 346 put_cursor(m, menus[m].cursor+1);
340 } 347 }
diff --git a/apps/tree.c b/apps/tree.c
index ca86bb2725..e9a648ed80 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -844,7 +844,10 @@ static bool dirbrowse(void)
844 if (!tc.filesindir) 844 if (!tc.filesindir)
845 break; 845 break;
846 846
847 if (tc.dircursor) { 847 /* start scrolling when at 1/3 of the screen */
848 if (tc.dircursor >=
849 tree_max_on_screen - (2 * tree_max_on_screen) / 3
850 || (tc.dirstart == 0 && tc.dircursor > 0)) {
848 put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, false); 851 put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, false);
849 tc.dircursor--; 852 tc.dircursor--;
850 put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, true); 853 put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, true);
@@ -906,7 +909,9 @@ static bool dirbrowse(void)
906 break; 909 break;
907 910
908 if (tc.dircursor + tc.dirstart + 1 < numentries ) { 911 if (tc.dircursor + tc.dirstart + 1 < numentries ) {
909 if(tc.dircursor+1 < tree_max_on_screen) { 912 /* start scrolling when at 2/3 of the screen */
913 if(tc.dircursor < (2 * tree_max_on_screen) / 3 ||
914 numentries - tc.dirstart <= tree_max_on_screen) {
910 put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, false); 915 put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, false);
911 tc.dircursor++; 916 tc.dircursor++;
912 put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, true); 917 put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, true);