1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-10-27 20:30:13 -04:00

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
This commit is contained in:
Michael Vetter 2019-11-05 17:16:27 +01:00
parent 330ef3bcf3
commit ba0f925222

View File

@ -822,11 +822,8 @@ static int
_inp_rl_down_arrow_handler(int count, int key) _inp_rl_down_arrow_handler(int count, int key)
{ {
add_history(rl_line_buffer); add_history(rl_line_buffer);
//also tried: add_history(rl_copy_text(0, rl_end)); using_history();
//also tried: add_history("Hello");
rl_replace_line("", 0); rl_replace_line("", 0);
rl_redisplay(); 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; return 0;
} }