mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-20 06:46:21 +00:00
fix(scroll): handle edge case of extremely long messages
Prior commit (6ad8a190) did not properly handle overflow by long (9000 lines) message,
to address this issue, multiple changes were made:
- Add lines recalculation on win_redraw
- Move `prof_buff_t` struct to header file so its lines could be externally changed
- Call win_redraw once overflow is detected: it allows to recalculate sizes in lines and apply changes to the buffer
This commit is contained in:
@@ -2003,6 +2003,10 @@ win_redraw(ProfWin* window)
|
||||
_win_print_internal(window, e->show_char, e->pad_indent, e->time, e->flags, e->theme_item, e->display_from, e->message, e->receipt);
|
||||
}
|
||||
e->y_end_pos = getcury(window->layout->win);
|
||||
// Recalculate lines (might be incorrect in case of NCurses overflow)
|
||||
window->layout->buffer->lines -= e->_lines;
|
||||
e->_lines = e->y_end_pos - e->y_start_pos;
|
||||
window->layout->buffer->lines += e->_lines;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user