1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-26 15:03:27 +01:00

small improvement

This commit is contained in:
Jfreegman 2013-12-11 04:49:21 -05:00
parent 629041d465
commit ff30a29df1
2 changed files with 12 additions and 3 deletions

View File

@ -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;
}
}
}

View File

@ -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];