Source refactoing after code review;

This commit is contained in:
2025-10-29 17:45:43 +03:00
committed by jabber.developer2
parent 07cc261f7d
commit 3344c2b1f9
2 changed files with 4 additions and 4 deletions

View File

@@ -99,7 +99,6 @@ _buffer_add(ProfBuff buffer, const char* show_char, int pad_indent, GDateTime* t
// With 10% margin to ensure overflow prevention
while (buffer->lines >= PAD_SIZE - (PAD_SIZE / 10) && g_slist_length(buffer->entries) > 1) {
log_debug("DELETING");
// Delete message from the opposite size to free buffer
GSList* buffer_entry_to_delete = append ? buffer->entries : g_slist_last(buffer->entries);
ProfBuffEntry* entry_to_delete = (ProfBuffEntry*)buffer_entry_to_delete->data;

View File

@@ -701,6 +701,7 @@ void
win_page_down(ProfWin* window, int scroll_size)
{
int total_rows = getcury(window->layout->win);
int total_rows_with_unreaded = total_rows + window->layout->unread_msg;
int* page_start = &(window->layout->y_pos);
int page_space = getmaxy(stdscr) - 4;
int page_start_initial = *page_start;
@@ -712,7 +713,7 @@ win_page_down(ProfWin* window, int scroll_size)
*page_start += scroll_size;
// Scrolled down after reaching the bottom of the page
if (((*page_start > total_rows + window->layout->unread_msg - page_space) || ((*page_start == page_space + window->layout->unread_msg) && *page_start >= (total_rows + window->layout->unread_msg))) && window->type == WIN_CHAT) {
if (((*page_start > total_rows_with_unreaded - page_space) || ((*page_start == total_rows_with_unreaded) && (*page_start >= total_rows_with_unreaded))) && window->type == WIN_CHAT) {
int bf_size = buffer_size(window->layout->buffer);
if (bf_size > 0 && *scroll_state != WIN_SCROLL_REACHED_BOTTOM) {
// How many lines are left until end of the screen
@@ -746,7 +747,7 @@ win_page_down(ProfWin* window, int scroll_size)
window->layout->paged = 1;
// update only if position has changed
if ((page_start_initial != *page_start) || (window->layout->unread_msg)) {
if ((page_start_initial != *page_start) || window->layout->unread_msg) {
win_update_virtual(window);
}
@@ -1706,7 +1707,7 @@ _win_printf(ProfWin* window, const char* show_char, int pad_indent, GDateTime* t
{
/* Prevent printing and buffer update when user is viewing message history [SCROLLING]*/
if ((window->layout->paged) && wins_is_current(window)) {
if (window->layout->paged && wins_is_current(window)) {
window->layout->unread_msg++;
return;
}