Select next item after deleting
This makes deleting multiple files a -lot- easier...
Этот коммит содержится в:
родитель
44f64cf3d3
Коммит
a71bc36860
@ -336,13 +336,12 @@ void browse_key_sel(int change) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define toggle(x,y) if(x & y) x -=y; else x |= y
|
#define toggle(x,y) if(x & y) x -=y; else x |= y
|
||||||
|
|
||||||
int browse_key(int ch) {
|
int browse_key(int ch) {
|
||||||
char tmp[PATH_MAX];
|
char tmp[PATH_MAX];
|
||||||
char sort = 0, nonfo = 0;
|
char sort = 0, nonfo = 0;
|
||||||
struct dir *n;
|
struct dir *n, *r;
|
||||||
|
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
/* selecting items */
|
/* selecting items */
|
||||||
@ -450,8 +449,14 @@ int browse_key(int ch) {
|
|||||||
break;
|
break;
|
||||||
if(n == NULL)
|
if(n == NULL)
|
||||||
break;
|
break;
|
||||||
delete_init(n);
|
|
||||||
nonfo++;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
src/delete.c
16
src/delete.c
@ -42,7 +42,7 @@
|
|||||||
int delete_delay = 100;
|
int delete_delay = 100;
|
||||||
|
|
||||||
suseconds_t lastupdate;
|
suseconds_t lastupdate;
|
||||||
struct dir *root;
|
struct dir *root, *nextsel;
|
||||||
char noconfirm = 0,
|
char noconfirm = 0,
|
||||||
ignoreerr = 0,
|
ignoreerr = 0,
|
||||||
state, seloption, curfile[PATH_MAX];
|
state, seloption, curfile[PATH_MAX];
|
||||||
@ -229,28 +229,32 @@ int delete_dir(struct dir *dr) {
|
|||||||
|
|
||||||
|
|
||||||
void delete_process() {
|
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 */
|
/* confirm */
|
||||||
seloption = 1;
|
seloption = 1;
|
||||||
while(state == DS_CONFIRM && !noconfirm)
|
while(state == DS_CONFIRM && !noconfirm)
|
||||||
if(input_handle(0))
|
if(input_handle(0))
|
||||||
return browse_init(root);
|
return browse_init(root);
|
||||||
|
|
||||||
n = root->parent->sub != root ? root->parent->sub : root->next ? root->next : root->parent;
|
|
||||||
|
|
||||||
/* delete */
|
/* delete */
|
||||||
lastupdate = 999;
|
lastupdate = 999;
|
||||||
seloption = 0;
|
seloption = 0;
|
||||||
if(delete_dir(root))
|
if(delete_dir(root))
|
||||||
browse_init(root);
|
browse_init(root);
|
||||||
else
|
else {
|
||||||
browse_init(n);
|
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;
|
state = DS_CONFIRM;
|
||||||
root = dr;
|
root = dr;
|
||||||
pstate = ST_DEL;
|
pstate = ST_DEL;
|
||||||
|
nextsel = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ extern int delete_delay;
|
|||||||
void delete_process(void);
|
void delete_process(void);
|
||||||
int delete_key(int);
|
int delete_key(int);
|
||||||
int delete_draw(void);
|
int delete_draw(void);
|
||||||
void delete_init(struct dir *);
|
void delete_init(struct dir *, struct dir *);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user