From 69e7a9341e811bf658f8d75bb43f6613d298c87d Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Thu, 16 Dec 2021 18:32:50 +0100 Subject: Completion search into both directions, added delay to prevent pops when seeking, small refactor for readability --- history.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'history.c') diff --git a/history.c b/history.c index eb1b936..6fc615e 100644 --- a/history.c +++ b/history.c @@ -157,9 +157,10 @@ inputln_addch(struct inputln *line, wchar_t c) { int i; - if (line->len + 1 == line->cap) { + if (line->len + 1 >= line->cap) { line->cap *= 2; - line->buf = realloc(line->buf, line->cap); + line->buf = realloc(line->buf, + line->cap * sizeof(wchar_t)); } for (i = line->len; i > line->cur; i--) -- cgit v1.2.3-71-gd317