messages: fix crashes with scrollback

This commit is contained in:
Björn Linse
2019-09-03 19:27:12 +02:00
parent 72d7099abd
commit 5c8a57da81

View File

@@ -2217,9 +2217,7 @@ void msg_scroll_up(bool may_throttle)
/// we get throttling "for free" using standard redraw_win_later code paths.
void msg_scroll_flush(void)
{
if (!msg_grid.throttled) {
return;
}
if (msg_grid.throttled) {
msg_grid.throttled = false;
int pos_delta = msg_grid_pos_at_flush - msg_grid_pos;
assert(pos_delta >= 0);
@@ -2227,7 +2225,6 @@ void msg_scroll_flush(void)
if (pos_delta > 0) {
ui_ext_msg_set_pos(msg_grid_pos, true);
msg_grid_pos_at_flush = msg_grid_pos;
}
int to_scroll = delta-pos_delta-msg_grid_scroll_discount;
@@ -2246,8 +2243,10 @@ void msg_scroll_flush(void)
HL_ATTR(HLF_MSG), false);
msg_grid.dirty_col[row] = 0;
}
}
msg_scrolled_at_flush = msg_scrolled;
msg_grid_scroll_discount = 0;
msg_grid_pos_at_flush = msg_grid_pos;
}
void msg_reset_scroll(void)