xaizek / hstr (License: Apachev2) (since 2018-12-07)
Bash and Zsh shell history suggest box - easily view, navigate, search and manage your command history.
Commit 5f7ad2d69924e6dc941da8504e695ea7ea26a681

MD
Author: Martin Dvorak
Author date (UTC): 2014-01-19 13:37
Committer name: Martin Dvorak
Committer date (UTC): 2014-01-19 13:37
Parent(s): a6d96409f8e1fb71cdc7fc5a3557967a49c7fc62
Signing key:
Tree: 7b374b685b2dfc43ee4408328220ffd28c98d34b
File Lines added Lines deleted
src/hstr.c 12 2
src/hstr_history.c 4 1
File src/hstr.c changed (mode: 100644) (index b9250dc..c98b42f)
44 44 #define K_CTRL_X 24 #define K_CTRL_X 24
45 45 #define K_CTRL_Z 26 #define K_CTRL_Z 26
46 46
47 #define K_ESC 27
47 48 #define K_TAB 9 #define K_TAB 9
48
49 #define K_BACKSPACE 127
49 50 #define K_ENTER 10 #define K_ENTER 10
50 #define K_ESC 27
51 51
52 52 #define color_attr_on(C) if(terminalHasColors) { attron(C); } #define color_attr_on(C) if(terminalHasColors) { attron(C); }
53 53 #define color_attr_off(C) if(terminalHasColors) { attroff(C); } #define color_attr_off(C) if(terminalHasColors) { attroff(C); }
 
... ... char *selection_loop(HistoryItems *history)
352 352 if(!skip) { if(!skip) {
353 353 c = wgetch(stdscr); c = wgetch(stdscr);
354 354 } else { } else {
355 if(strlen(prefix)>0) {
356 color_attr_on(A_BOLD);
357 mvprintw(y, basex, "%s", prefix);
358 color_attr_off(A_BOLD);
359 cursorX=getcurx(stdscr);
360 cursorY=getcury(stdscr);
361 result = print_selection(maxHistoryItems, prefix, history);
362 move(cursorY, cursorX);
363 }
355 364 skip=FALSE; skip=FALSE;
356 365 continue; continue;
357 366 } }
 
... ... char *selection_loop(HistoryItems *history)
392 401 prefix[0]=0; prefix[0]=0;
393 402 mvprintw(y, basex, ""); mvprintw(y, basex, "");
394 403 clrtoeol(); clrtoeol();
404 case K_BACKSPACE:
395 405 case KEY_BACKSPACE: case KEY_BACKSPACE:
396 406 if(strlen(prefix)>0) { if(strlen(prefix)>0) {
397 407 prefix[strlen(prefix)-1]=0; prefix[strlen(prefix)-1]=0;
File src/hstr_history.c changed (mode: 100644) (index 6a9e329..c4a82ac)
... ... typedef struct {
23 23 static HistoryItems *prioritizedHistory; static HistoryItems *prioritizedHistory;
24 24 static bool dirty; static bool dirty;
25 25 #define BLACKLIST_SIZE 5 #define BLACKLIST_SIZE 5
26 static const char *commandBlacklist[] = {"ls", "pwd", "cd", "hh", "mc"};
26 static const char *commandBlacklist[] = {
27 "ls", "pwd", "cd", "cd ..", "hh", "mc",
28 "ls ", "pwd ", "cd ", "cd .. ", "hh ", "mc "
29 };
27 30
28 31 #ifdef DEBUG_RADIX #ifdef DEBUG_RADIX
29 32 #define DEBUG_RADIXSORT() radixsort_stat(&rs); exit(0) #define DEBUG_RADIXSORT() radixsort_stat(&rs); exit(0)
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/hstr

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/hstr

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master