mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
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...
This commit is contained in:
parent
f416a7a121
commit
d571c080b5
1 changed files with 6 additions and 2 deletions
|
|
@ -267,7 +267,7 @@ void browse_draw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get maximum size and selected item */
|
/* 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))
|
if(ishidden(n))
|
||||||
continue;
|
continue;
|
||||||
if(n->flags & FF_BSEL) {
|
if(n->flags & FF_BSEL) {
|
||||||
|
|
@ -278,7 +278,7 @@ void browse_draw() {
|
||||||
max = flags & BF_AS ? n->asize : n->size;
|
max = flags & BF_AS ? n->asize : n->size;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if(!selected)
|
if(selected < 0)
|
||||||
cur->flags |= FF_BSEL;
|
cur->flags |= FF_BSEL;
|
||||||
|
|
||||||
/* determine start position */
|
/* determine start position */
|
||||||
|
|
@ -314,6 +314,7 @@ void browse_key_sel(int change) {
|
||||||
if((cur = browse_dir) == NULL)
|
if((cur = browse_dir) == NULL)
|
||||||
return;
|
return;
|
||||||
par.next = cur;
|
par.next = cur;
|
||||||
|
par.flags = 0;
|
||||||
if(cur->parent->parent)
|
if(cur->parent->parent)
|
||||||
cur = ∥
|
cur = ∥
|
||||||
|
|
||||||
|
|
@ -410,6 +411,7 @@ int browse_key(int ch) {
|
||||||
browse_dir = browse_dir->parent->parent->sub;
|
browse_dir = browse_dir->parent->parent->sub;
|
||||||
sort++;
|
sort++;
|
||||||
}
|
}
|
||||||
|
browse_key_sel(0);
|
||||||
nonfo++;
|
nonfo++;
|
||||||
break;
|
break;
|
||||||
case KEY_LEFT:
|
case KEY_LEFT:
|
||||||
|
|
@ -417,6 +419,7 @@ int browse_key(int ch) {
|
||||||
browse_dir = browse_dir->parent->parent->sub;
|
browse_dir = browse_dir->parent->parent->sub;
|
||||||
sort++;
|
sort++;
|
||||||
}
|
}
|
||||||
|
browse_key_sel(0);
|
||||||
nonfo++;
|
nonfo++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -479,5 +482,6 @@ void browse_init(struct dir *cur) {
|
||||||
browse_dir = cur->parent->sub;
|
browse_dir = cur->parent->sub;
|
||||||
if(browse_dir != NULL)
|
if(browse_dir != NULL)
|
||||||
browse_dir = browse_sort(browse_dir);
|
browse_dir = browse_sort(browse_dir);
|
||||||
|
browse_key_sel(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue