diff --git a/src/hstr.c b/src/hstr.c index b9250dc..c98b42f 100644 --- a/src/hstr.c +++ b/src/hstr.c @@ -44,10 +44,10 @@ #define K_CTRL_X 24 #define K_CTRL_Z 26 -#define K_TAB 9 - -#define K_ENTER 10 #define K_ESC 27 +#define K_TAB 9 +#define K_BACKSPACE 127 +#define K_ENTER 10 #define color_attr_on(C) if(terminalHasColors) { attron(C); } #define color_attr_off(C) if(terminalHasColors) { attroff(C); } @@ -352,6 +352,15 @@ char *selection_loop(HistoryItems *history) if(!skip) { c = wgetch(stdscr); } else { + if(strlen(prefix)>0) { + color_attr_on(A_BOLD); + mvprintw(y, basex, "%s", prefix); + color_attr_off(A_BOLD); + cursorX=getcurx(stdscr); + cursorY=getcury(stdscr); + result = print_selection(maxHistoryItems, prefix, history); + move(cursorY, cursorX); + } skip=FALSE; continue; } @@ -392,6 +401,7 @@ char *selection_loop(HistoryItems *history) prefix[0]=0; mvprintw(y, basex, ""); clrtoeol(); + case K_BACKSPACE: case KEY_BACKSPACE: if(strlen(prefix)>0) { prefix[strlen(prefix)-1]=0; diff --git a/src/hstr_history.c b/src/hstr_history.c index 6a9e329..c4a82ac 100644 --- a/src/hstr_history.c +++ b/src/hstr_history.c @@ -23,7 +23,10 @@ typedef struct { static HistoryItems *prioritizedHistory; static bool dirty; #define BLACKLIST_SIZE 5 -static const char *commandBlacklist[] = {"ls", "pwd", "cd", "hh", "mc"}; +static const char *commandBlacklist[] = { + "ls", "pwd", "cd", "cd ..", "hh", "mc", + "ls ", "pwd ", "cd ", "cd .. ", "hh ", "mc " +}; #ifdef DEBUG_RADIX #define DEBUG_RADIXSORT() radixsort_stat(&rs); exit(0)