From ba0f92522247eab264bf2b316adfe3754d26a818 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 5 Nov 2019 17:16:27 +0100 Subject: [PATCH] Fix add_history usage in down arrow handler [Programming with GNU History](http://www.math.utah.edu/docs/info/hist_2.html) mentions using_history(). Chet, maintainer of readline told me about it. (Thanks Chet!) Seems like we need to call this so that the history offset is at the right end of the list. I assume it's called in the linehandler automatically. Fix https://github.com/profanity-im/profanity/issues/200 --- src/ui/inputwin.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index db42c5a8..5c4b6630 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -822,11 +822,8 @@ static int _inp_rl_down_arrow_handler(int count, int key) { add_history(rl_line_buffer); - //also tried: add_history(rl_copy_text(0, rl_end)); - //also tried: add_history("Hello"); + using_history(); rl_replace_line("", 0); rl_redisplay(); - rl_end = 0; // why is this neeed? shouln't replace_line do this? - rl_point = 0; // why is this neeed? shouln't replace_line do this? return 0; }