Skip to content
Snippets Groups Projects
Commit a71bc368 authored by Yorhel's avatar Yorhel
Browse files

Select next item after deleting

This makes deleting multiple files a -lot- easier...
parent 44f64cf3
No related branches found
No related tags found
No related merge requests found
......@@ -336,13 +336,12 @@ void browse_key_sel(int change) {
}
#define toggle(x,y) if(x & y) x -=y; else x |= y
int browse_key(int ch) {
char tmp[PATH_MAX];
char sort = 0, nonfo = 0;
struct dir *n;
struct dir *n, *r;
switch(ch) {
/* selecting items */
......@@ -450,8 +449,14 @@ int browse_key(int ch) {
break;
if(n == NULL)
break;
delete_init(n);
nonfo++;
/* quirky method of getting the next selected dir without actually selecting it */
browse_key_sel(n->next ? 1 : -1);
for(r=browse_dir; r!=NULL; r=r->next)
if(r->flags & FF_BSEL)
break;
browse_key_sel(n->next ? -1 : 1);
delete_init(n, r);
break;
}
......
......@@ -42,7 +42,7 @@
int delete_delay = 100;
suseconds_t lastupdate;
struct dir *root;
struct dir *root, *nextsel;
char noconfirm = 0,
ignoreerr = 0,
state, seloption, curfile[PATH_MAX];
......@@ -229,28 +229,32 @@ int delete_dir(struct dir *dr) {
void delete_process() {
struct dir *n;
/* 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)
if(input_handle(0))
return browse_init(root);
n = root->parent->sub != root ? root->parent->sub : root->next ? root->next : root->parent;
/* delete */
lastupdate = 999;
seloption = 0;
if(delete_dir(root))
browse_init(root);
else
else {
browse_init(n);
if(nextsel)
nextsel->flags |= FF_BSEL;
}
}
void delete_init(struct dir *dr) {
void delete_init(struct dir *dr, struct dir *s) {
state = DS_CONFIRM;
root = dr;
pstate = ST_DEL;
nextsel = s;
}
......@@ -33,7 +33,7 @@ extern int delete_delay;
void delete_process(void);
int delete_key(int);
int delete_draw(void);
void delete_init(struct dir *);
void delete_init(struct dir *, struct dir *);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment