fix go back doesnt work after going trash + TESTING SORT
This commit is contained in:
parent
00e9ab4555
commit
d6d0fd671a
1 changed files with 19 additions and 1 deletions
20
ccc.c
20
ccc.c
|
@ -34,6 +34,7 @@ void edit_file();
|
||||||
void toggle_executable();
|
void toggle_executable();
|
||||||
char *replace_home(char *str);
|
char *replace_home(char *str);
|
||||||
int write_last_d();
|
int write_last_d();
|
||||||
|
void sort_files();
|
||||||
void create_file();
|
void create_file();
|
||||||
void delete_files();
|
void delete_files();
|
||||||
void wpprintw(const char *fmt, ...);
|
void wpprintw(const char *fmt, ...);
|
||||||
|
@ -280,8 +281,15 @@ int main(int argc, char** argv)
|
||||||
/* go to the trash dir */
|
/* go to the trash dir */
|
||||||
case 't':;
|
case 't':;
|
||||||
char *trash_dir = check_trash_dir();
|
char *trash_dir = check_trash_dir();
|
||||||
if (trash_dir != NULL)
|
if (trash_dir != NULL) {
|
||||||
|
strcpy(p_cwd, cwd);
|
||||||
change_dir(trash_dir, 0, 0);
|
change_dir(trash_dir, 0, 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* sort files */
|
||||||
|
case 'u':
|
||||||
|
sort_files();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* show directories' sizes */
|
/* show directories' sizes */
|
||||||
|
@ -941,6 +949,16 @@ int write_last_d()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sort_compare(const void *a, const void *b) {
|
||||||
|
return strcmp(((file *) a)->name, ((file *) b)->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sort_files()
|
||||||
|
{
|
||||||
|
qsort(files->items, files->length, sizeof(file), sort_compare);
|
||||||
|
highlight_current_line();
|
||||||
|
}
|
||||||
|
|
||||||
void create_file()
|
void create_file()
|
||||||
{
|
{
|
||||||
echo();
|
echo();
|
||||||
|
|
Loading…
Reference in a new issue