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 d18e37ee6a2ef20bedc35135f518765f14a80647

Fixing prefix rendering in case insensitive mode
Author: Martin Dvorak
Author date (UTC): 2014-01-04 08:27
Committer name: Martin Dvorak
Committer date (UTC): 2014-01-04 08:27
Parent(s): 53643e2b6f6c5a5d09b4ab6b923834ece9f279e4
Signing key:
Tree: baf4d6e86b6647d173a3894fdae8dfad20fcd73d
File Lines added Lines deleted
dist/dist.sh 2 2
dist/man.sh 2 2
src/hstr.c 14 5
File dist/dist.sh changed (mode: 100755) (index 101b926..9d1bbaf)
... ... cp -vf /usr/share/automake-1.11/depcomp .
12 12 cp -vf /usr/share/automake-1.11/install-sh . cp -vf /usr/share/automake-1.11/install-sh .
13 13 cp -vf /usr/share/automake-1.11/missing . cp -vf /usr/share/automake-1.11/missing .
14 14
15 cd bin
15 cd dist
16 16
17 # eof
17 # eof
File dist/man.sh changed (mode: 100755) (index a60dfa5..0cdde74)
1 1 #!/bin/bash #!/bin/bash
2 2
3 cd ../man && groff -man -Tascii hh.1
3 cd ../man && man ./hh.1
4 4
5 # eof
5 # eof
File src/hstr.c changed (mode: 100644) (index dc75181..cde6efa)
... ... unsigned make_selection(char *prefix, HistoryItems *history, int maxSelectionCou
143 143 if(prefix==NULL) { if(prefix==NULL) {
144 144 selection[selectionCount++]=history->items[i]; selection[selectionCount++]=history->items[i];
145 145 } else { } else {
146 if(history->items[i]==strstr(history->items[i], prefix)) {
147 selection[selectionCount++]=history->items[i];
146 if(caseSensitive) {
147 if(history->items[i]==strstr(history->items[i], prefix)) {
148 selection[selectionCount++]=history->items[i];
149 }
150 } else {
151 if(history->items[i]==strcasestr(history->items[i], prefix)) {
152 selection[selectionCount++]=history->items[i];
153 }
148 154 } }
149 155 } }
150 156 } }
 
... ... char *print_selection(WINDOW *win, unsigned maxHistoryItems, char *prefix, Histo
187 193 move(Y_OFFSET_ITEMS, 0); move(Y_OFFSET_ITEMS, 0);
188 194 wclrtobot(win); wclrtobot(win);
189 195
190 char *p;
196 char *p, *pdup;
191 197 for (i = 0; i<height; ++i) { for (i = 0; i<height; ++i) {
192 198 if(i<selectionSize) { if(i<selectionSize) {
193 199 snprintf(screenLine, width, " %s", selection[i]); snprintf(screenLine, width, " %s", selection[i]);
194 200 mvwprintw(win, y++, 0, screenLine); mvwprintw(win, y++, 0, screenLine);
195 if(prefix!=NULL) {
201 if(prefix!=NULL && strlen(prefix)>0) {
196 202 wattron(win,A_BOLD); wattron(win,A_BOLD);
197 203 if(caseSensitive) { if(caseSensitive) {
198 204 p=strstr(selection[i], prefix); p=strstr(selection[i], prefix);
205 mvwprintw(win, (y-1), 1+(p-selection[i]), "%s", prefix);
199 206 } else { } else {
200 207 p=strcasestr(selection[i], prefix); p=strcasestr(selection[i], prefix);
208 snprintf(screenLine, strlen(prefix)+1, "%s", p);
209 mvwprintw(win, (y-1), 1+(p-selection[i]), "%s", screenLine);
201 210 } }
202 mvwprintw(win, (y-1), 1+(p-selection[i]), "%s", prefix);
211
203 212 wattroff(win,A_BOLD); wattroff(win,A_BOLD);
204 213 } }
205 214 } else { } else {
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