1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-29 15:47:46 +02:00

ugly partial fix for bug

This commit is contained in:
Jfreegman 2013-12-11 05:41:02 -05:00
parent ff30a29df1
commit 12e1a60ca3
2 changed files with 14 additions and 3 deletions

View File

@ -170,9 +170,21 @@ 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);
/* adjust line y origin appropriately when window scrolls down */
if (prt->at_bottom && prt->len >= x2 - X_OFST) {
--prt->orig_y;
prt->scroll = true;
int px2 = prt->len >= x2 ? x2 : x2 - X_OFST;
int p_ofst = px2 != x2 ? 0 : X_OFST;
if (px2 <= 0)
return;
int k = prt->orig_y + ((prt->len + p_ofst) / px2);
if (k == y2) { /* cursor is below max_y */
wprintw(self->window, "\n");
--prt->orig_y;
}
}
}
}

View File

@ -119,7 +119,6 @@ void fetch_hist_item(wchar_t *buf, size_t *pos, size_t *len, wchar_t (*hst)[MAX_
if (--(*hst_pos) < 0) {
++(*hst_pos);
beep();
return;
}
} else {
if (++(*hst_pos) == hst_tot) {