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 0ff12d01e2a64de02bad52db31ed72b3b9de9e46

Sync.
Author: Martin Dvorak
Author date (UTC): 2014-01-09 21:33
Committer name: Martin Dvorak
Committer date (UTC): 2014-01-09 21:33
Parent(s): 327b1a7e5d0ef7052e2f8ef279eff8002dd08251
Signing key:
Tree: b24121d1b1004e95e34e377558c96537ad44c83f
File Lines added Lines deleted
src/hstr.c 16 3
File src/hstr.c changed (mode: 100644) (index a6d2487..0a9af5e)
10 10 #define _GNU_SOURCE #define _GNU_SOURCE
11 11
12 12 #include <curses.h> #include <curses.h>
13 #include <signal.h>
13 14 #include <stdbool.h> #include <stdbool.h>
14 15 #include <stddef.h> #include <stddef.h>
15 16 #include <stdio.h> #include <stdio.h>
 
... ... void selection_remove(char *cmd, HistoryItems *history)
305 306 } }
306 307 } }
307 308
309 void hstr_on_exit(char *command) {
310 history_mgmt_close();
311 fill_terminal_input(command, true);
312 free_prioritized_history();
313 }
314
315 void signal_callback_handler_ctrl_c(int signum)
316 {
317 hstr_on_exit(NULL);
318 exit(signum);
319 }
320
308 321 char *selection_loop(HistoryItems *history) char *selection_loop(HistoryItems *history)
309 322 { {
323 //signal(SIGINT, signal_callback_handler_ctrl_c);
324
310 325 initscr(); initscr();
311 326 color_start(); color_start();
312 327
 
... ... void hstr()
477 492 if(history) { if(history) {
478 493 history_mgmt_open(); history_mgmt_open();
479 494 char *command = selection_loop(history); char *command = selection_loop(history);
480 history_mgmt_close();
481 fill_terminal_input(command, true);
482 free_prioritized_history();
495 hstr_on_exit(command);
483 496 } else { } else {
484 497 printf("Empty shell history - nothing to suggest...\n"); printf("Empty shell history - nothing to suggest...\n");
485 498 } }
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