diff options
author | Roland Walker <walker@pobox.com> | 2017-06-29 17:47:59 -0400 |
---|---|---|
committer | Jonas Fonseca <jonas.fonseca@gmail.com> | 2017-07-11 18:10:52 -0400 |
commit | ef34df8c551092e7833777366cec6fef10776d84 (patch) | |
tree | cb71c8151f0612714bc4caa1a36add0d850bcbef | |
parent | a628e9d1680d8e9a1ffeba60bd07db24f993bbf0 (diff) |
preload last search from history
more specifically: preload last item from history and treat it as a
search query
-rw-r--r-- | src/prompt.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/prompt.c b/src/prompt.c index e01593c1..db5e697b 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -525,12 +525,18 @@ prompt_teardown(void) void prompt_init(void) { + HIST_ENTRY *last_entry; + readline_init(); using_history(); stifle_history(HISTORY_SIZE); read_history(prompt_histfile()); if (atexit(prompt_teardown)) die("Failed to register prompt_teardown"); + + last_entry = history_get(history_length); + if (last_entry) + string_copy(argv_env.search, last_entry->line); } #else char * |