diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c7357..6e2c07e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ other items in 0.29 are proposed and yet to be implemented. - [DONE] Improve visibility of failure messages with red text on white background. (Thanks PartialVolume) - [DONE] Add NVME and VIRT (loop etc) devices to device type table for display in GUI and logs. NVME devices now show up as NVME devices rather than UNK (Thanks PartialVolume) - [DONE] Fix very obscure segmentation fault going back to at least 0.24 in drive selection window when resizing terminal vertical axis while drive focus symbol '>' is pointing to the last drive of a multi drive selection window. See [#248](https://github.com/martijnvanbrummelen/nwipe/pull/248) for further details (Thanks PartialVolume) +- [DONE] Warn the user if they are incorrectly typing a lower case s to start a wipe, when they should be typing a capital S [#262](https://github.com/martijnvanbrummelen/nwipe/issues/262) (Thanks PartialVolume) - Add enhancement fibre channel wiping of non 512 bytes/sector drives such as 524/528 bytes/sector etc (work in progress by PartialVolume) - HPA/DCO detection and adjustment to wipe full drive. (work in progress by PartialVolume) diff --git a/src/gui.c b/src/gui.c index 0ef8231..225393a 100644 --- a/src/gui.c +++ b/src/gui.c @@ -124,6 +124,8 @@ const char* stats_title = " Statistics "; /* Footer labels. */ const char* main_window_footer = "S=Start M=Method P=PRNG V=Verify R=Rounds B=Blanking Space=Select Ctrl-C=Quit"; +const char* main_window_footer_warning_lower_case_s = + " WARNING: To start the wipe press capital S, you pressed lower case s "; const char* selection_footer = "J=Down K=Up Space=Select Backspace=Cancel Ctrl-C=Quit"; const char* end_wipe_footer = "B=Blank screen Ctrl-C=Quit"; const char* rounds_footer = "Left=Erase Esc=Cancel Ctrl-C=Quit"; @@ -225,6 +227,9 @@ void nwipe_gui_init( void ) /* Set green on blue for reverse bold error messages */ init_pair( 9, COLOR_RED, COLOR_WHITE ); + /* Set black on yellow for warning messages */ + init_pair( 10, COLOR_BLACK, COLOR_YELLOW ); + /* Set the background style. */ wbkgdset( stdscr, COLOR_PAIR( 1 ) | ' ' ); } @@ -958,6 +963,32 @@ void nwipe_gui_select( int count, nwipe_context_t** c ) validkeyhit = 1; break; + case 's': + + /* user has mistakenly hit the lower case 's' instead of capital 'S' */ + + /* Warn the user about their mistake */ + wattron( footer_window, COLOR_PAIR( 10 ) ); + nwipe_gui_amend_footer_window( main_window_footer_warning_lower_case_s ); + doupdate(); + sleep( 2 ); + wattroff( footer_window, COLOR_PAIR( 10 ) ); + + /* After the delay return footer text back to key help */ + nwipe_gui_amend_footer_window( main_window_footer ); + doupdate(); + + /* if user insists on holding the s key down, without this the gui would hang + * for a period of time, i.e sleep above x number of repeated 's' keystrokes + * which could run into minutes */ + do + { + timeout( 250 ); // block getch() for 250ms. + keystroke = getch(); // Get user input. + timeout( -1 ); // Switch back to blocking mode. + } while( keystroke == 's' ); + break; + } /* keystroke switch */ /* Check the terminal size, if the user has changed it the while loop checks for