summaryrefslogtreecommitdiffstats
path: root/history.c
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-12-16 18:32:50 +0100
committerLouis Burda <quent.burda@gmail.com>2021-12-20 15:32:22 +0100
commit69e7a9341e811bf658f8d75bb43f6613d298c87d (patch)
tree0fff59ab0bbc4a7af29079d611bf3cc4c2e8e2fd /history.c
parent3eea7a245a7ed49127a222628543f9509a6ff2b6 (diff)
downloadtmus-69e7a9341e811bf658f8d75bb43f6613d298c87d.tar.gz
tmus-69e7a9341e811bf658f8d75bb43f6613d298c87d.zip
Completion search into both directions, added delay to prevent pops when seeking, small refactor for readability
Diffstat (limited to 'history.c')
-rw-r--r--history.c5
1 files changed, 3 insertions, 2 deletions
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--)