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...
Этот коммит содержится в:
родитель
f416a7a121
Коммит
d571c080b5
@ -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 = ∥
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user