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 b769fabef9015614d874bc95ec5beea3330f6c8c

Bug #129 is no longer reproducible + fixing #115 by improved highlighting after deletion.
Author: Martin Dvorak
Author date (UTC): 2015-02-23 19:52
Committer name: Martin Dvorak
Committer date (UTC): 2015-02-23 19:52
Parent(s): 934c5b14d5938d1f0ac0248b6a6136d3cfb470fc
Signing key:
Tree: e2fffc03fe1e190aa970879d9561d3a4b91d9f09
File Lines added Lines deleted
src/hstr.c 16 9
File src/hstr.c changed (mode: 100644) (index 6c501ca..c2fa25c)
127 127 #define LOGUTF8(Y,P) #define LOGUTF8(Y,P)
128 128 #endif #endif
129 129
130 #ifdef DEBUG_SELECTION
131 #define LOGSELECTION(Y,SCREEN,MODEL) mvprintw(Y, 0, "Selection: screen %3d, model %3d", SCREEN, MODEL); clrtoeol()
132 #else
133 #define LOGSELECTION(Y,SCREEN,MODEL)
134 #endif
135
130 136 void logstring(char* str){ void logstring(char* str){
131 137 FILE *f = fopen("/home/tbabej/hh.log", "a"); FILE *f = fopen("/home/tbabej/hh.log", "a");
132 138 if (f == NULL) if (f == NULL)
 
... ... typedef struct {
219 225 FavoriteItems *favorites; FavoriteItems *favorites;
220 226
221 227 char **selection; char **selection;
222 regmatch_t *selectionRegexpMatch;
223 228 unsigned selectionSize; unsigned selectionSize;
229 regmatch_t *selectionRegexpMatch;
224 230
225 231 int historyMatch; // TODO patternMatching: exact, regexp int historyMatch; // TODO patternMatching: exact, regexp
226 232 int historyView; // TODO view: favs, ... int historyView; // TODO view: favs, ...
 
... ... void loop_to_select(Hstr *hstr)
838 844
839 845 switch (c) { switch (c) {
840 846 case KEY_DC: // DEL case KEY_DC: // DEL
841 // TODO verification - still broken:
842 // > use 3 items history configuration
843 // > delete 2nd item in raw view > blank line
844 // > delete one of items in raw view > garbage
845 847 if(selectionCursorPosition!=SELECTION_CURSOR_IN_PROMPT) { if(selectionCursorPosition!=SELECTION_CURSOR_IN_PROMPT) {
846 848 delete=hstr->selection[selectionCursorPosition]; delete=hstr->selection[selectionCursorPosition];
847 849 msg=malloc(strlen(delete)+1); msg=malloc(strlen(delete)+1);
 
... ... void loop_to_select(Hstr *hstr)
852 854 move(y, basex+strlen(pattern)); move(y, basex+strlen(pattern));
853 855 printDefaultLabel=TRUE; printDefaultLabel=TRUE;
854 856 print_history_label(hstr); print_history_label(hstr);
857
858 if(selectionCursorPosition>0) {
859 selectionCursorPosition--;
860 } else {
861 selectionCursorPosition=hstr->selectionSize-1;
862 }
863 highlight_selection(selectionCursorPosition, SELECTION_CURSOR_IN_PROMPT, pattern, hstr);
864 move(y, basex+strlen(pattern));
855 865 } }
856 // TODO new code - coredump on view rotation
857 // highlight_selection(selectionCursorPosition, previousSelectionCursorPosition, pattern, hstr);
858 // move(y, basex+strlen(pattern));
859 // TODO end new code
860 866 break; break;
861 867 case K_CTRL_E: case K_CTRL_E:
862 868 hstr->historyMatch++; hstr->historyMatch++;
 
... ... void loop_to_select(Hstr *hstr)
1027 1033 LOGKEYS(Y_OFFSET_HELP, c); LOGKEYS(Y_OFFSET_HELP, c);
1028 1034 LOGCURSOR(Y_OFFSET_HELP); LOGCURSOR(Y_OFFSET_HELP);
1029 1035 LOGUTF8(Y_OFFSET_HELP,pattern); LOGUTF8(Y_OFFSET_HELP,pattern);
1036 LOGSELECTION(Y_OFFSET_HELP,getmaxy(stdscr),hstr->selectionSize);
1030 1037
1031 1038 if(c>K_CTRL_Z) { if(c>K_CTRL_Z) {
1032 1039 selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT; selectionCursorPosition=SELECTION_CURSOR_IN_PROMPT;
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