1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-23 01:53:02 +01:00

Add input line text to history on UP and DOWN

This commit is contained in:
Rodrigo Martins 2019-12-07 18:29:33 -03:00
parent 127f9462e0
commit ddeca171a0
No known key found for this signature in database
GPG Key ID: 6ED09E999DD17339

View File

@ -236,6 +236,13 @@ void add_line_to_hist(ChatContext *ctx)
resets line if at end of history */ resets line if at end of history */
void fetch_hist_item(ChatContext *ctx, int key_dir) void fetch_hist_item(ChatContext *ctx, int key_dir)
{ {
if(wcscmp(ctx->line, L"\0") != 0
&& ctx->hst_pos == ctx->hst_tot)
{
add_line_to_hist(ctx);
ctx->hst_pos--;
}
if (key_dir == KEY_UP) { if (key_dir == KEY_UP) {
if (--ctx->hst_pos < 0) { if (--ctx->hst_pos < 0) {
ctx->hst_pos = 0; ctx->hst_pos = 0;