mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-26 22:13:26 +01:00
ugly partial fix for bug
This commit is contained in:
parent
ff30a29df1
commit
12e1a60ca3
14
src/prompt.c
14
src/prompt.c
@ -170,9 +170,21 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key)
|
|||||||
wmove(self->window, prt->orig_y, X_OFST);
|
wmove(self->window, prt->orig_y, X_OFST);
|
||||||
fetch_hist_item(prt->line, &prt->pos, &prt->len, prt->ln_history, prt->hst_tot,
|
fetch_hist_item(prt->line, &prt->pos, &prt->len, prt->ln_history, prt->hst_tot,
|
||||||
&prt->hst_pos, LN_HIST_MV_UP);
|
&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) {
|
if (prt->at_bottom && prt->len >= x2 - X_OFST) {
|
||||||
|
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;
|
--prt->orig_y;
|
||||||
prt->scroll = true;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
if (--(*hst_pos) < 0) {
|
||||||
++(*hst_pos);
|
++(*hst_pos);
|
||||||
beep();
|
beep();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (++(*hst_pos) == hst_tot) {
|
if (++(*hst_pos) == hst_tot) {
|
||||||
|
Loading…
Reference in New Issue
Block a user