summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-04-14 07:53:58 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-04-14 07:53:58 +0000
commit57e928f9f3c78aa2aa4dbcbd0fb90151566f7cb0 (patch)
tree0bd2037382a5a6c16f5f3c72ff958465c699092e
parente6c8badc0e7a3a5322b9cb783fd40355a93d518f (diff)
downloadrockbox-57e928f9f3c78aa2aa4dbcbd0fb90151566f7cb0.tar.gz
rockbox-57e928f9f3c78aa2aa4dbcbd0fb90151566f7cb0.zip
Fixed the garbled display when deleting the last file in a directory (bug #680811)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3549 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tree.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/tree.c b/apps/tree.c
index b50dd5c826..5a8618babb 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -380,6 +380,21 @@ static int showdir(char *path, int start)
dirstart = start;
}
+ /* The cursor might point to an invalid line, for example if someone
+ deleted the last file in the dir */
+ if(filesindir)
+ {
+ while(start + dircursor >= filesindir)
+ {
+ if(start)
+ start--;
+ else
+ if(dircursor)
+ dircursor--;
+ }
+ dirstart = start;
+ }
+
#ifdef HAVE_LCD_CHARCELLS
lcd_stop_scroll();
lcd_double_height(false);
@@ -1119,6 +1134,7 @@ bool dirbrowse(char *root)
if (restore || reload_dir) {
/* restore display */
+
/* We need to adjust if the number of lines on screen have
changed because of a status bar change */
if(CURSOR_Y+LINE_Y+dircursor>tree_max_on_screen) {