mirror of
https://github.com/dvorka/hstr.git
synced 2025-02-25 07:16:28 +08:00
MD
This commit is contained in:
parent
a6d96409f8
commit
5f7ad2d699
2 changed files with 17 additions and 4 deletions
16
src/hstr.c
16
src/hstr.c
|
@ -44,10 +44,10 @@
|
||||||
#define K_CTRL_X 24
|
#define K_CTRL_X 24
|
||||||
#define K_CTRL_Z 26
|
#define K_CTRL_Z 26
|
||||||
|
|
||||||
#define K_TAB 9
|
|
||||||
|
|
||||||
#define K_ENTER 10
|
|
||||||
#define K_ESC 27
|
#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_on(C) if(terminalHasColors) { attron(C); }
|
||||||
#define color_attr_off(C) if(terminalHasColors) { attroff(C); }
|
#define color_attr_off(C) if(terminalHasColors) { attroff(C); }
|
||||||
|
@ -352,6 +352,15 @@ char *selection_loop(HistoryItems *history)
|
||||||
if(!skip) {
|
if(!skip) {
|
||||||
c = wgetch(stdscr);
|
c = wgetch(stdscr);
|
||||||
} else {
|
} 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;
|
skip=FALSE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -392,6 +401,7 @@ char *selection_loop(HistoryItems *history)
|
||||||
prefix[0]=0;
|
prefix[0]=0;
|
||||||
mvprintw(y, basex, "");
|
mvprintw(y, basex, "");
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
|
case K_BACKSPACE:
|
||||||
case KEY_BACKSPACE:
|
case KEY_BACKSPACE:
|
||||||
if(strlen(prefix)>0) {
|
if(strlen(prefix)>0) {
|
||||||
prefix[strlen(prefix)-1]=0;
|
prefix[strlen(prefix)-1]=0;
|
||||||
|
|
|
@ -23,7 +23,10 @@ typedef struct {
|
||||||
static HistoryItems *prioritizedHistory;
|
static HistoryItems *prioritizedHistory;
|
||||||
static bool dirty;
|
static bool dirty;
|
||||||
#define BLACKLIST_SIZE 5
|
#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
|
#ifdef DEBUG_RADIX
|
||||||
#define DEBUG_RADIXSORT() radixsort_stat(&rs); exit(0)
|
#define DEBUG_RADIXSORT() radixsort_stat(&rs); exit(0)
|
||||||
|
|
Loading…
Reference in a new issue