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 <mvhe...@gmail.com>
Signed-off-by: Antoine Busque <antoinebus...@gmail.com>
---
 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


_______________________________________________
Ratpoison-devel mailing list
Ratpoison-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/ratpoison-devel

Reply via email to