mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
Determine which item to select after deletion in browser.c
Rather than the ugly hack in delete.c.
This commit is contained in:
parent
eed949d48d
commit
79733f7d64
2 changed files with 4 additions and 7 deletions
|
|
@ -379,7 +379,8 @@ int browse_key(int ch) {
|
|||
break;
|
||||
info_show = 0;
|
||||
if((t = dirlist_get(1)) == sel)
|
||||
t = dirlist_get(-1);
|
||||
if((t = dirlist_get(-1)) == sel || t == dirlist_parent)
|
||||
t = sel->parent;
|
||||
delete_init(sel, t);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -211,9 +211,6 @@ delete_nxt:
|
|||
|
||||
|
||||
void delete_process() {
|
||||
/* determine dir to open after successful delete */
|
||||
struct dir *n = root->parent->sub != root ? root->parent->sub : root->next ? root->next : root->parent;
|
||||
|
||||
/* confirm */
|
||||
seloption = 1;
|
||||
while(state == DS_CONFIRM && !noconfirm)
|
||||
|
|
@ -237,9 +234,8 @@ void delete_process() {
|
|||
if(delete_dir(root))
|
||||
browse_init(root);
|
||||
else {
|
||||
if(nextsel)
|
||||
nextsel->flags |= FF_BSEL;
|
||||
browse_init(n);
|
||||
nextsel->flags |= FF_BSEL;
|
||||
browse_init(nextsel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue