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;
|
unsigned int focus = 0;
|
||||||
long current_selection = 0;
|
long current_selection = 0;
|
||||||
bool dirs_size = DIRS_SIZE;
|
bool dirs_size = DIRS_SIZE;
|
||||||
|
bool show_hidden = SHOW_HIDDEN;
|
||||||
char *cwd;
|
char *cwd;
|
||||||
char *p_cwd; /* previous cwd */
|
char *p_cwd; /* previous cwd */
|
||||||
int half_width;
|
int half_width;
|
||||||
|
@ -244,9 +245,17 @@ int main(int argc, char** argv)
|
||||||
change_dir(p_cwd, 0);
|
change_dir(p_cwd, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* show help */
|
||||||
case '?':
|
case '?':
|
||||||
show_help();
|
show_help();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case '.':
|
||||||
|
show_hidden = !show_hidden;
|
||||||
|
clear_files();
|
||||||
|
populate_files(cwd, 0);
|
||||||
|
highlight_current_line();
|
||||||
|
break;
|
||||||
|
|
||||||
/* mark one file */
|
/* mark one file */
|
||||||
case SPACE:
|
case SPACE:
|
||||||
|
@ -430,8 +439,8 @@ void populate_files(const char *path, int ftype)
|
||||||
filename[0] = '\0';
|
filename[0] = '\0';
|
||||||
strcat(filename, ep->d_name);
|
strcat(filename, ep->d_name);
|
||||||
|
|
||||||
/* can't be strncmp as that would filter out the dotfiles */
|
/* use strncmp to filter out dotfiles */
|
||||||
if (strcmp(filename, ".") && strcmp(filename, "..")) {
|
if ((show_hidden && strncmp(filename, ".", 1) && strncmp(filename, "..", 2)) || (!show_hidden && strcmp(filename, ".") && strcmp(filename, ".."))) {
|
||||||
/* construct full file path */
|
/* construct full file path */
|
||||||
filename[0] = '\0';
|
filename[0] = '\0';
|
||||||
strcat(filename, cwd);
|
strcat(filename, cwd);
|
||||||
|
|
1
config.h
1
config.h
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#define DRAW_BORDERS true /* Draw borders around windows? */
|
#define DRAW_BORDERS true /* Draw borders around windows? */
|
||||||
#define DRAW_PREVIEW true /* Draw file preview? */
|
#define DRAW_PREVIEW true /* Draw file preview? */
|
||||||
|
#define SHOW_HIDDEN true /* show hidden files/dotfiles in preview */
|
||||||
|
|
||||||
/* set width offset for windows:
|
/* set width offset for windows:
|
||||||
+-------------%-------------+
|
+-------------%-------------+
|
||||||
|
|
Loading…
Reference in a new issue