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 37cec6441850181a72a3bb97dcb134bd571c18a8

Fixed #50 by env var based configuration of sorting and case sensitivity + improved highlighted line (E2E on screen)
Author: Martin Dvorak
Author date (UTC): 2014-01-28 07:47
Committer name: Martin Dvorak
Committer date (UTC): 2014-01-28 07:47
Parent(s): 0a667f8ab70ae032ecbee0a659ae30acfeb043e0
Signing key:
Tree: ab19cecb200200b6b560ac38ef9d35dfe7fffa54
File Lines added Lines deleted
dist/ubuntu-env.sh 1 1
dist/ubuntu-make-distro.sh 3 1
man/hh.1 8 1
src/hstr.c 16 3
File dist/ubuntu-env.sh changed (mode: 100755) (index 77842ea..d4e8fc9)
1 1 #!/bin/bash #!/bin/bash
2 2
3 export HHVERSION="1.6.3"
3 export HHVERSION="1.7.1"
4 4 export HHFULLVERSION=${HHVERSION}-0ubuntu1 export HHFULLVERSION=${HHVERSION}-0ubuntu1
5 5 export HH=hh_${HHVERSION} export HH=hh_${HHVERSION}
6 6 export HHRELEASE=hh_${HHFULLVERSION} export HHRELEASE=hh_${HHFULLVERSION}
File dist/ubuntu-make-distro.sh changed (mode: 100755) (index dbb4498..48ad9b5)
... ... cd hh/dist
41 41 ./2-ubuntu-build-deb.sh ./2-ubuntu-build-deb.sh
42 42
43 43 pwd pwd
44 echo -e "\n\nFinish by running 3-ubuntu-push-deb.sh\n"
44 #echo -e "\n\nFinish by running 3-ubuntu-push-deb.sh\n"
45 ./3-ubuntu-push-deb.sh
46
45 47
46 48 # eof # eof
File man/hh.1 changed (mode: 100644) (index 403ea83..d9b3972)
... ... Exit with empty prompt.
59 59 \fBhh\fR defines the following environment variables: \fBhh\fR defines the following environment variables:
60 60 .TP .TP
61 61 \fBHH_CONFIG\fR \fBHH_CONFIG\fR
62 Configuration options: \fBhicolor\fR to get more colors (default is monochromatic).
62 Configuration options. \fBhh\fR is monochromatic by default - use \fBhicolor\fR to get more colors.
63 Make the pattern-based filtering case sensitive using \fBcasesensitive\fR. Force raw history view instead
64 of metric-based one using \fBrawhistory\fR. Example:
65 .nf
66 .sp
67 export HH_CONFIG=casesensitive,hicolor # color version with case sensitive search
68 .sp
69 .fi
63 70 .SH CONFIGURATION .SH CONFIGURATION
64 71 Optionally add the following lines to ~/.bashrc: Optionally add the following lines to ~/.bashrc:
65 72 .nf .nf
File src/hstr.c changed (mode: 100644) (index e0aa26e..9f9ae60)
59 59 #define HH_COLOR_DELETE 4 #define HH_COLOR_DELETE 4
60 60
61 61 #define ENV_VAR_HH_CONFIG "HH_CONFIG" #define ENV_VAR_HH_CONFIG "HH_CONFIG"
62 #define HH_CONFIG_HICOLOR "hicolor"
63 #define HH_CONFIG_CASE "casesensitive"
64 #define HH_CONFIG_SORTING "rawhistory"
65
66 #define SPACE_PADDING " "
62 67
63 68 #ifdef DEBUG_KEYS #ifdef DEBUG_KEYS
64 69 #define LOGKEYS(Y,KEY) mvprintw(Y, 0, "Key: '%3d' / Char: '%c'", KEY, KEY); clrtoeol() #define LOGKEYS(Y,KEY) mvprintw(Y, 0, "Key: '%3d' / Char: '%c'", KEY, KEY); clrtoeol()
 
... ... void get_env_configuration()
108 113 { {
109 114 char *hhconfig=getenv(ENV_VAR_HH_CONFIG); char *hhconfig=getenv(ENV_VAR_HH_CONFIG);
110 115 if(hhconfig && strlen(hhconfig)>0) { if(hhconfig && strlen(hhconfig)>0) {
111 if(strstr(hhconfig,"hicolor")) {
116 if(strstr(hhconfig,HH_CONFIG_HICOLOR)) {
112 117 hicolor=TRUE; hicolor=TRUE;
113 118 } }
119 if(strstr(hhconfig,HH_CONFIG_CASE)) {
120 caseSensitive=TRUE;
121 }
122 if(strstr(hhconfig,HH_CONFIG_SORTING)) {
123 defaultOrder=TRUE;
124 }
114 125 } }
115 126 } }
116 127
 
... ... unsigned make_selection(char *prefix, HistoryItems *history, int maxSelectionCou
263 274
264 275 void print_selection_row(char *text, int y, int width, char *prefix) { void print_selection_row(char *text, int y, int width, char *prefix) {
265 276 snprintf(screenLine, width, " %s", text); snprintf(screenLine, width, " %s", text);
266 mvprintw(y, 0, screenLine);
277 mvprintw(y, 0, screenLine); clrtoeol();
267 278 if(prefix!=NULL && strlen(prefix)>0) { if(prefix!=NULL && strlen(prefix)>0) {
268 279 color_attr_on(A_BOLD); color_attr_on(A_BOLD);
269 280 char *p; char *p;
 
... ... void print_highlighted_selection_row(char *text, int y, int width) {
286 297 } else { } else {
287 298 color_attr_on(A_REVERSE); color_attr_on(A_REVERSE);
288 299 } }
289 snprintf(screenLine, getmaxx(stdscr), "%s%s", (terminal_has_colors()?" ":">"), text);
300 snprintf(screenLine, getmaxx(stdscr),
301 "%s%s" SPACE_PADDING SPACE_PADDING SPACE_PADDING,
302 (terminal_has_colors()?" ":">"), text);
290 303 mvprintw(y, 0, "%s", screenLine); mvprintw(y, 0, "%s", screenLine);
291 304 if(hicolor) { if(hicolor) {
292 305 color_attr_on(COLOR_PAIR(1)); color_attr_on(COLOR_PAIR(1));
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