From ff30a29df131a18fcda660ed17dd03875f53401d Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Wed, 11 Dec 2013 04:49:21 -0500 Subject: [PATCH] small improvement --- src/prompt.c | 4 ++++ src/toxic_strings.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/prompt.c b/src/prompt.c index 12121a0..0f7fcc1 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -170,6 +170,10 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key) wmove(self->window, prt->orig_y, X_OFST); fetch_hist_item(prt->line, &prt->pos, &prt->len, prt->ln_history, prt->hst_tot, &prt->hst_pos, LN_HIST_MV_UP); + if (prt->at_bottom && prt->len >= x2 - X_OFST) { + --prt->orig_y; + prt->scroll = true; + } } } diff --git a/src/toxic_strings.c b/src/toxic_strings.c index 34ea2bd..0ba06c5 100644 --- a/src/toxic_strings.c +++ b/src/toxic_strings.c @@ -116,11 +116,16 @@ void fetch_hist_item(wchar_t *buf, size_t *pos, size_t *len, wchar_t (*hst)[MAX_ int hst_tot, int *hst_pos, int key_dir) { if (key_dir == LN_HIST_MV_UP) { - if (--(*hst_pos) < 0) + if (--(*hst_pos) < 0) { ++(*hst_pos); + beep(); + return; + } } else { - if (++(*hst_pos) == hst_tot) - --(*hst_pos); + if (++(*hst_pos) == hst_tot) { + discard_buf(buf, pos, len); + return; + } } const wchar_t *hst_line = hst[*hst_pos];