From a0ef4d752faac63cba99828122d6575b7fd433ab Mon Sep 17 00:00:00 2001 From: Jfreegman Date: Fri, 13 Jun 2014 17:37:11 -0400 Subject: [PATCH] small fix --- src/line_info.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/line_info.c b/src/line_info.c index ddb6a52..0297429 100644 --- a/src/line_info.c +++ b/src/line_info.c @@ -59,11 +59,13 @@ static void line_info_reset_start(ToxWindow *self, struct history *hst) struct line_info *line = hst->line_end; uint16_t lncnt = 0; - int offst = self->is_groupchat ? SIDEBAR_WIDTH : 0; + int side_offst = self->is_groupchat ? SIDEBAR_WIDTH : 0; + int top_offst = self->is_chat ? 4 : 1; /* leave one blank space at bottom */ + int max_y = (y2 - CHATBOX_HEIGHT - top_offst); - while (line->prev && lncnt < (y2 - CHATBOX_HEIGHT - 3)) { + while (line->prev && lncnt < max_y) { line = line->prev; - lncnt += (1 + line->len / (x2 - offst)); + lncnt += (1 + line->len / (x2 - side_offst)); } hst->line_start = line;