use '.' to toggle hidden files
This commit is contained in:
parent
b459866236
commit
1251bc9aed
2 changed files with 12 additions and 2 deletions
13
ccc.c
13
ccc.c
|
@ -35,6 +35,7 @@ void draw_border_title(WINDOW *window, bool active);
|
|||
unsigned int focus = 0;
|
||||
long current_selection = 0;
|
||||
bool dirs_size = DIRS_SIZE;
|
||||
bool show_hidden = SHOW_HIDDEN;
|
||||
char *cwd;
|
||||
char *p_cwd; /* previous cwd */
|
||||
int half_width;
|
||||
|
@ -244,10 +245,18 @@ int main(int argc, char** argv)
|
|||
change_dir(p_cwd, 0);
|
||||
break;
|
||||
|
||||
/* show help */
|
||||
case '?':
|
||||
show_help();
|
||||
break;
|
||||
|
||||
case '.':
|
||||
show_hidden = !show_hidden;
|
||||
clear_files();
|
||||
populate_files(cwd, 0);
|
||||
highlight_current_line();
|
||||
break;
|
||||
|
||||
/* mark one file */
|
||||
case SPACE:
|
||||
add_file_stat(get_filepath(current_selection), 1);
|
||||
|
@ -430,8 +439,8 @@ void populate_files(const char *path, int ftype)
|
|||
filename[0] = '\0';
|
||||
strcat(filename, ep->d_name);
|
||||
|
||||
/* can't be strncmp as that would filter out the dotfiles */
|
||||
if (strcmp(filename, ".") && strcmp(filename, "..")) {
|
||||
/* use strncmp to filter out dotfiles */
|
||||
if ((show_hidden && strncmp(filename, ".", 1) && strncmp(filename, "..", 2)) || (!show_hidden && strcmp(filename, ".") && strcmp(filename, ".."))) {
|
||||
/* construct full file path */
|
||||
filename[0] = '\0';
|
||||
strcat(filename, cwd);
|
||||
|
|
1
config.h
1
config.h
|
@ -8,6 +8,7 @@
|
|||
|
||||
#define DRAW_BORDERS true /* Draw borders around windows? */
|
||||
#define DRAW_PREVIEW true /* Draw file preview? */
|
||||
#define SHOW_HIDDEN true /* show hidden files/dotfiles in preview */
|
||||
|
||||
/* set width offset for windows:
|
||||
+-------------%-------------+
|
||||
|
|
Loading…
Reference in a new issue