diff options
| author | Louis Burda <quent.burda@gmail.com> | 2021-12-04 13:48:01 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2021-12-20 15:31:16 +0100 |
| commit | 9fe644f0d99375ffd3011d8828f7dbd0fb103af0 (patch) | |
| tree | 71ed89f1c7316dba818bc921d772aaa1fc957dab /history.c | |
| parent | d68d0f39ab7675745e7d177f6774736f7ec58783 (diff) | |
| download | tmus-9fe644f0d99375ffd3011d8828f7dbd0fb103af0.tar.gz tmus-9fe644f0d99375ffd3011d8828f7dbd0fb103af0.zip | |
Added more gui interaction
Diffstat (limited to 'history.c')
| -rw-r--r-- | history.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -103,7 +103,8 @@ history_add(struct history *history, struct inputln *line) struct link *back; if (list_len(&history->list) == HISTORY_MAX) { - back = list_back(&history->list); + /* pop last item to make space */ + back = link_back(&history->list); back->prev->next = NULL; ln = UPCAST(back, struct inputln); inputln_free(ln); @@ -163,6 +164,7 @@ inputln_addch(struct inputln *line, wchar_t c) for (i = line->len; i > line->cur; i--) line->buf[i] = line->buf[i-1]; line->buf[line->cur] = c; + line->len++; line->cur++; } @@ -177,8 +179,10 @@ inputln_del(struct inputln *line, int n) n = MIN(n, line->cur); for (i = line->cur; i <= line->len; i++) line->buf[i-n] = line->buf[i]; + for (i = line->len - n; i <= line->len; i++) line->buf[i] = 0; + line->len -= n; line->cur -= n; } |
