about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-11-05 17:16:27 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-11-05 17:19:51 +0100
commitba0f92522247eab264bf2b316adfe3754d26a818 (patch)
treeedef13f4f4b8a026d189801ba72a6d17a7a38ccb
parent330ef3bcf3f78b0e3844c042b480c8484e22f777 (diff)
downloadprofani-tty-ba0f92522247eab264bf2b316adfe3754d26a818.tar.gz
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
-rw-r--r--src/ui/inputwin.c5
1 files changed, 1 insertions, 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;
 }