ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] [PATCH] Fix: call using_history after initializing history entries


From: Antoine Busque
Subject: [RP] [PATCH] Fix: call using_history after initializing history entries
Date: Wed, 2 Aug 2017 23:02:00 -0400

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 <address@hidden>
Signed-off-by: Antoine Busque <address@hidden>
---
 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
-- 
2.13.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]