summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-05-02 13:01:12 +0200
committerYorhel <git@yorhel.nl>2009-05-02 13:01:12 +0200
commitd571c080b542ec9df687051ec987d9ffae61e5be (patch)
treee33739fd43d70ce1ece1e4165a633f48d24099cd
parentf416a7a121d49f95825c15abb3e1dc8d9472e0b6 (diff)
Fixed a browsing bug related to hiding items
Reproducable with the following steps: - Make sure the first item in the list is a directory starting with a dot - Make sure the next item is a normal directory - Select first item - Press 'h' to hide it, next item will properly be selected - Open selected directory (right arrow), and see how the first (hidden) directory was opened. It's amazing how I've even found this bug, considering that really is the only way to reproduce it...
-rw-r--r--src/browser.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/browser.c b/src/browser.c
index 7d2e226..0ce02b7 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -267,7 +267,7 @@ void browse_draw() {
}
/* get maximum size and selected item */
- for(n=cur, selected=i=0; n!=NULL; n=n->next) {
+ for(n=cur, selected=-1, i=0; n!=NULL; n=n->next) {
if(ishidden(n))
continue;
if(n->flags & FF_BSEL) {
@@ -278,7 +278,7 @@ void browse_draw() {
max = flags & BF_AS ? n->asize : n->size;
i++;
}
- if(!selected)
+ if(selected < 0)
cur->flags |= FF_BSEL;
/* determine start position */
@@ -314,6 +314,7 @@ void browse_key_sel(int change) {
if((cur = browse_dir) == NULL)
return;
par.next = cur;
+ par.flags = 0;
if(cur->parent->parent)
cur = &par;
@@ -410,6 +411,7 @@ int browse_key(int ch) {
browse_dir = browse_dir->parent->parent->sub;
sort++;
}
+ browse_key_sel(0);
nonfo++;
break;
case KEY_LEFT:
@@ -417,6 +419,7 @@ int browse_key(int ch) {
browse_dir = browse_dir->parent->parent->sub;
sort++;
}
+ browse_key_sel(0);
nonfo++;
break;
@@ -479,5 +482,6 @@ void browse_init(struct dir *cur) {
browse_dir = cur->parent->sub;
if(browse_dir != NULL)
browse_dir = browse_sort(browse_dir);
+ browse_key_sel(0);
}