1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-12-23 12:03:25 +01:00

fix some buggy behaviour with scrolling

This commit is contained in:
Jfreegman 2014-06-13 15:37:04 -04:00
parent b36680d767
commit 65ad64bf42
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -52,19 +52,21 @@ void line_info_init(struct history *hst)
}
/* resets line_start */
static void line_info_reset_start(struct history *hst)
static void line_info_reset_start(ToxWindow *self, struct history *hst)
{
int y2, x2;
getmaxyx(self->window, y2, x2);
struct line_info *line = hst->line_end;
uint32_t start_id = hst->start_id;
while (line) {
if (line->id == start_id) {
hst->line_start = line->next;
break;
}
uint16_t lncnt = 0;
int offst = self->is_groupchat ? SIDEBAR_WIDTH : 0;
while (line->prev && lncnt < (y2 - CHATBOX_HEIGHT - 3)) {
line = line->prev;
lncnt += (1 + line->len / (x2 - offst));
}
hst->line_start = line;
}
void line_info_cleanup(struct history *hst)
@ -418,7 +420,7 @@ bool line_info_onKey(ToxWindow *self, wint_t key)
break;
case KEY_END:
line_info_reset_start(hst);
line_info_reset_start(self, hst);
break;
default: