From a058a018f50ddab9c9ce54c3fe18e37031e32973 Mon Sep 17 00:00:00 2001 From: Antoine Busque Date: Wed, 2 Aug 2017 23:02:00 -0400 Subject: Fix: call using_history after initializing history entries In its current state, history expansion requiring any sort of string lookup is not working, always returing "event not found". This is due to `history_offset` being set improperly by an early call to `using_history`. A call to `using_history` needs to follow, not precede, the loop performing initialization of history entries found in `history_expand_line`. This allows for `history_offset` to reflect the now non-zero length of the history, restoring the expected behaviour of history expansion. Tested-by: Martin Hertz Signed-off-by: Antoine Busque --- src/history.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/history.c b/src/history.c index d1e9938..1466e89 100644 --- a/src/history.c +++ b/src/history.c @@ -314,10 +314,10 @@ history_expand_line (int history_id UNUSED, char *string, char **output) if (strchr (string, '!')) { clear_history (); - using_history (); list_for_each_entry(item, &histories[history_id].head, node) { add_history (item->line); } + using_history (); return history_expand (string, output); } #endif -- cgit v1.2.3