diff --git a/doc/ncdu.1 b/doc/ncdu.1 index f026816d9e927ea56ca1f6770d1c2a5afbc82a1b..e6ad9ab5f206d7df14fd9e476ab14b4886436c7a 100644 --- a/doc/ncdu.1 +++ b/doc/ncdu.1 @@ -120,6 +120,10 @@ that the totals shown at the bottom of the screen are not correct, make sure you haven't enabled this option. .TP .B +r +Refresh/recalculate the current directory. +.TP +.B q Quit .SH AUTHOR diff --git a/src/help.c b/src/help.c index a5e9ac717e8682e8305c04070df05eab561414e6..a932d67565f893ffb81d8d5d9b17122adeab5518 100644 --- a/src/help.c +++ b/src/help.c @@ -36,71 +36,71 @@ void drawHelp(int page) { wattroff(hlp, A_BOLD); mvwaddstr(hlp, 13, 32, "Press any key to continue"); + if(page == 1) + wattron(hlp, A_REVERSE); + mvwaddstr(hlp, 0, 30, "1:Keys"); + wattroff(hlp, A_REVERSE); + if(page == 2) + wattron(hlp, A_REVERSE); + mvwaddstr(hlp, 0, 39, "2:Format"); + wattroff(hlp, A_REVERSE); + if(page == 3) + wattron(hlp, A_REVERSE); + mvwaddstr(hlp, 0, 50, "3:About"); + wattroff(hlp, A_REVERSE); + switch(page) { case 1: wattron(hlp, A_BOLD); - mvwaddstr(hlp, 1, 30, "1:Keys"); - wattroff(hlp, A_BOLD); - mvwaddstr(hlp, 1, 39, "2:Format"); - mvwaddstr(hlp, 1, 50, "3:About"); - wattron(hlp, A_BOLD); - mvwaddstr(hlp, 3, 7, "up/down"); - mvwaddstr(hlp, 4, 3, "right/enter"); - mvwaddstr(hlp, 5, 10, "left"); - mvwaddstr(hlp, 6, 11, "n/s"); - mvwaddch( hlp, 7, 13, 'd'); - mvwaddch( hlp, 8, 13, 't'); - mvwaddch( hlp, 9, 13, 'g'); - mvwaddch( hlp,10, 13, 'p'); - mvwaddch( hlp,11, 13, 'h'); + mvwaddstr(hlp, 2, 7, "up/down"); + mvwaddstr(hlp, 3, 3, "right/enter"); + mvwaddstr(hlp, 4, 10, "left"); + mvwaddstr(hlp, 5, 11, "n/s"); + mvwaddch( hlp, 6, 13, 'd'); + mvwaddch( hlp, 7, 13, 't'); + mvwaddch( hlp, 8, 13, 'g'); + mvwaddch( hlp, 9, 13, 'p'); + mvwaddch( hlp,10, 13, 'h'); + mvwaddch( hlp,11, 13, 'r'); mvwaddch( hlp,12, 13, 'q'); wattroff(hlp, A_BOLD); - mvwaddstr(hlp, 3, 16, "Cycle through the items"); - mvwaddstr(hlp, 4, 16, "Open directory"); - mvwaddstr(hlp, 5, 16, "Previous directory"); - mvwaddstr(hlp, 6, 16, "Sort by name or size (asc/desc)"); - mvwaddstr(hlp, 7, 16, "Delete selected file or directory"); - mvwaddstr(hlp, 8, 16, "Toggle dirs before files when sorting"); - mvwaddstr(hlp, 9, 16, "Show percentage and/or graph"); - mvwaddstr(hlp,10, 16, "Toggle between powers of 1000 and 1024"); - mvwaddstr(hlp,11, 16, "Show/hide hidden or excluded files"); + mvwaddstr(hlp, 2, 16, "Cycle through the items"); + mvwaddstr(hlp, 3, 16, "Open directory"); + mvwaddstr(hlp, 4, 16, "Previous directory"); + mvwaddstr(hlp, 5, 16, "Sort by name or size (asc/desc)"); + mvwaddstr(hlp, 6, 16, "Delete selected file or directory"); + mvwaddstr(hlp, 7, 16, "Toggle dirs before files when sorting"); + mvwaddstr(hlp, 8, 16, "Show percentage and/or graph"); + mvwaddstr(hlp, 9, 16, "Toggle between powers of 1000 and 1024"); + mvwaddstr(hlp,10, 16, "Show/hide hidden or excluded files"); + mvwaddstr(hlp,11, 16, "Recalculate the current directory"); mvwaddstr(hlp,12, 16, "Quit ncdu"); break; case 2: - mvwaddstr(hlp, 1, 30, "1:Keys"); - wattron(hlp, A_BOLD); - mvwaddstr(hlp, 1, 39, "2:Format"); - wattroff(hlp, A_BOLD); - mvwaddstr(hlp, 1, 50, "3:About"); wattron(hlp, A_BOLD); - mvwaddstr(hlp, 3, 3, "X [size] [file or directory]"); + mvwaddstr(hlp, 2, 3, "X [size] [graph] [file or directory]"); wattroff(hlp, A_BOLD); - mvwaddstr(hlp, 5, 4, "The X is only present in the following cases:"); + mvwaddstr(hlp, 3, 4, "The X is only present in the following cases:"); wattron(hlp, A_BOLD); - mvwaddch(hlp, 6, 4, '!'); - mvwaddch(hlp, 7, 4, '.'); + mvwaddch(hlp, 5, 4, '!'); + mvwaddch(hlp, 6, 4, '.'); + mvwaddch(hlp, 7, 4, '<'); mvwaddch(hlp, 8, 4, '>'); - mvwaddch(hlp, 9, 4, '<'); - mvwaddch(hlp,10, 4, '@'); - mvwaddch(hlp,11, 4, 'e'); + mvwaddch(hlp, 9, 4, '@'); + mvwaddch(hlp,10, 4, 'e'); wattroff(hlp, A_BOLD); - mvwaddstr(hlp, 6, 7, "An error occured while reading this directory"); - mvwaddstr(hlp, 7, 7, "An error occured while reading a subdirectory"); - mvwaddstr(hlp, 8, 7, "File or directory is excluded from the statistics"); - mvwaddstr(hlp, 9, 7, "Directory was on an other filesystem"); - mvwaddstr(hlp,10, 7, "This is not a file nor a dir (symlink, socket, ...)"); - mvwaddstr(hlp,11, 7, "Empty directory"); + mvwaddstr(hlp, 5, 7, "An error occured while reading this directory"); + mvwaddstr(hlp, 6, 7, "An error occured while reading a subdirectory"); + mvwaddstr(hlp, 7, 7, "File or directory is excluded from the statistics"); + mvwaddstr(hlp, 8, 7, "Directory was on an other filesystem"); + mvwaddstr(hlp, 9, 7, "This is not a file nor a dir (symlink, socket, ...)"); + mvwaddstr(hlp,10, 7, "Empty directory"); break; case 3: /* Indeed, too much spare time */ - mvwaddstr(hlp, 1, 30, "1:Keys"); - mvwaddstr(hlp, 1, 39, "2:Format"); - wattron(hlp, A_BOLD); - mvwaddstr(hlp, 1, 50, "3:About"); - wattroff(hlp, A_BOLD); wattron(hlp, A_REVERSE); #define x 12 -#define y 4 +#define y 3 /* N */ mvwaddstr(hlp, y+0, x+0, " "); mvwaddstr(hlp, y+1, x+0, " "); @@ -139,14 +139,9 @@ void drawHelp(int page) { mvwaddstr(hlp, y+1, x+30, "Disk"); mvwaddstr(hlp, y+2, x+30, "Usage"); mvwprintw(hlp, y+4, x+30, "%s", PACKAGE_VERSION); - mvwaddstr(hlp,10, 7, "Written by Yoran Heling <projects@yorhel.nl>"); - mvwaddstr(hlp,11, 16, "http://dev.yorhel.nl/ncdu/"); + mvwaddstr(hlp, 9, 7, "Written by Yoran Heling <projects@yorhel.nl>"); + mvwaddstr(hlp,10, 16, "http://dev.yorhel.nl/ncdu/"); break; - case 4: - mvwaddstr(hlp, 1, 30, "1:Keys"); - mvwaddstr(hlp, 1, 39, "2:Format"); - mvwaddstr(hlp, 1, 50, "3:About"); - mvwaddstr(hlp, 3, 3, "There is no fourth window, baka~~"); } wrefresh(hlp); delwin(hlp); /* no need to use it anymore - free it */ @@ -159,6 +154,8 @@ void showHelp(void) { drawHelp(p); while((ch = getch())) { switch(ch) { + case ERR: + break; case '1': p = 1; break; @@ -168,14 +165,13 @@ void showHelp(void) { case '3': p = 3; break; - case '4': - p = 4; - break; case KEY_RIGHT: - if(++p > 4) - p = 4; + case KEY_NPAGE: + if(++p > 3) + p = 3; break; case KEY_LEFT: + case KEY_PPAGE: if(--p < 1) p = 1; break;