--- ekg-1.7.orig/src/ui-ncurses.c 2026-10-18 06:39:39.472899722 +0200 +++ ekg-1.7/src/ui-ncurses.c 2026-10-18 06:39:39.505021438 +0200 @@ -309,7 +309,7 @@ int contacts_size() if (!config_contacts) return 0; - if (config_contacts_size + 2 > (stdscr->_maxx + 1) / 2) + if (config_contacts_size + 2 > (getmaxx(stdscr)) / 2) return 0; return config_contacts_size + (contacts_frame) ? 1 : 0; @@ -575,9 +575,9 @@ void window_resize() list_t l; left = 0; - right = stdscr->_maxx + 1; + right = getmaxx(stdscr); top = config_header_size; - bottom = stdscr->_maxy + 1 - input_size - config_statusbar_size; + bottom = getmaxy(stdscr) - input_size - config_statusbar_size; width = right - left; height = bottom - top; @@ -694,13 +694,13 @@ void window_resize() if (w->left < 0) w->left = 0; - if (w->left > stdscr->_maxx) - w->left = stdscr->_maxx; + if (w->left > (getmaxx(stdscr) - 1)) + w->left = (getmaxx(stdscr) - 1); if (w->top < 0) w->top = 0; - if (w->top > stdscr->_maxy) - w->top = stdscr->_maxy; + if (w->top > (getmaxy(stdscr) - 1)) + w->top = (getmaxy(stdscr) - 1); mvwin(w->window, w->top, w->left); @@ -1007,9 +1007,9 @@ static void window_refresh() wnoutrefresh(w->window); } - mvwin(status, stdscr->_maxy + 1 - input_size - config_statusbar_size, 0); - wresize(input, input_size, input->_maxx + 1); - mvwin(input, stdscr->_maxy - input_size + 1, 0); + mvwin(status, getmaxy(stdscr) - input_size - config_statusbar_size, 0); + wresize(input, input_size, getmaxx(input)); + mvwin(input, (getmaxy(stdscr) - 1) - input_size + 1, 0); } /* @@ -1184,14 +1184,14 @@ static struct window *window_new(const c array_free(argv); - if (w.left > stdscr->_maxx) - w.left = stdscr->_maxx; - if (w.top > stdscr->_maxy) - w.top = stdscr->_maxy; - if (w.left + w.width > stdscr->_maxx) - w.width = stdscr->_maxx + 1 - w.left; - if (w.top + w.height > stdscr->_maxy) - w.height = stdscr->_maxy + 1 - w.top; + if (w.left > (getmaxx(stdscr) - 1)) + w.left = (getmaxx(stdscr) - 1); + if (w.top > (getmaxy(stdscr) - 1)) + w.top = (getmaxy(stdscr) - 1); + if (w.left + w.width > (getmaxx(stdscr) - 1)) + w.width = getmaxx(stdscr) - w.left; + if (w.top + w.height > (getmaxy(stdscr) - 1)) + w.height = getmaxy(stdscr) - w.top; } if (!w.target) { @@ -1702,7 +1702,7 @@ static void update_header(int commit) wmove(header, y, 0); - for (x = 0; x <= status->_maxx; x++) + for (x = 0; x <= (getmaxx(status) - 1); x++) waddch(header, ' '); } @@ -1751,13 +1751,13 @@ int window_printat(WINDOW *w, int x, int wmove(w, y, 0); - for (i = 0; i <= w->_maxx; i++) + for (i = 0; i <= (getmaxx(w) - 1); i++) waddch(w, ' '); } wmove(w, y, x); - while (*p && *p != '}' && x <= w->_maxx) { + while (*p && *p != '}' && x <= (getmaxx(w) - 1)) { int i, nest; if (*p != '%') { @@ -1801,7 +1801,7 @@ int window_printat(WINDOW *w, int x, int bold = 0; break; case '|': - while (x <= w->_maxx) { + while (x <= (getmaxx(w) - 1)) { waddch(w, ' '); x++; } @@ -2248,8 +2248,8 @@ void ui_ncurses_init() use_default_colors(); } - ui_screen_width = stdscr->_maxx + 1; - ui_screen_height = stdscr->_maxy + 1; + ui_screen_width = getmaxx(stdscr); + ui_screen_height = getmaxy(stdscr); ui_need_refresh = 0; #ifndef GG_DEBUG_DISABLE @@ -2257,8 +2257,8 @@ void ui_ncurses_init() #endif window_current = window_new(NULL, 0); - status = newwin(1, stdscr->_maxx + 1, stdscr->_maxy - 1, 0); - input = newwin(1, stdscr->_maxx + 1, stdscr->_maxy, 0); + status = newwin(1, getmaxx(stdscr), (getmaxy(stdscr) - 1) - 1, 0); + input = newwin(1, getmaxx(stdscr), (getmaxy(stdscr) - 1), 0); keypad(input, TRUE); nodelay(input, TRUE); @@ -2456,10 +2456,10 @@ static void line_adjust() int prompt_len = (lines) ? 0 : window_current->prompt_len; line_index = strlen(line); - if (strlen(line) < input->_maxx - 9 - prompt_len) + if (strlen(line) < (getmaxx(input) - 1) - 9 - prompt_len) line_start = 0; else - line_start = strlen(line) - strlen(line) % (input->_maxx - 9 - prompt_len); + line_start = strlen(line) - strlen(line) % ((getmaxx(input) - 1) - 9 - prompt_len); } /* @@ -3975,10 +3975,10 @@ static void ui_ncurses_loop() redraw_prompt: - if (line_index - line_start > input->_maxx - 9 - window_current->prompt_len) - line_start += input->_maxx - 19 - window_current->prompt_len; + if (line_index - line_start > (getmaxx(input) - 1) - 9 - window_current->prompt_len) + line_start += (getmaxx(input) - 1) - 19 - window_current->prompt_len; if (line_index - line_start < 10) { - line_start -= input->_maxx - 19 - window_current->prompt_len; + line_start -= (getmaxx(input) - 1) - 19 - window_current->prompt_len; if (line_start < 0) line_start = 0; } @@ -4005,7 +4005,7 @@ redraw_prompt: if (config_aspell == 1) spellcheck(p, aspell_line); - for (j = 0; j + line_start < strlen(p) && j < input->_maxx + 1; j++) { + for (j = 0; j + line_start < strlen(p) && j < getmaxx(input); j++) { if (aspell_line[line_start + j] == ASPELLBADCHAR) /* jesli błędny to wyświetlamy podkreślony */ print_char_underlined(input, i, j, p[line_start + j]); @@ -4013,7 +4013,7 @@ redraw_prompt: print_char(input, i, j, p[j + line_start]); } #else - for (j = 0; j + line_start < strlen(p) && j < input->_maxx + 1; j++) + for (j = 0; j + line_start < strlen(p) && j < getmaxx(input); j++) print_char(input, i, j, p[j + line_start]); #endif } @@ -4031,7 +4031,7 @@ redraw_prompt: if (config_aspell == 1) spellcheck(line, aspell_line); - for (i = 0; i < input->_maxx + 1 - window_current->prompt_len && i < strlen(line) - line_start; i++) { + for (i = 0; i < getmaxx(input) - window_current->prompt_len && i < strlen(line) - line_start; i++) { if (aspell_line[line_start + i] == ASPELLBADCHAR) /* jesli błędny to wyświetlamy podkreślony */ print_char_underlined(input, 0, i + window_current->prompt_len, line[line_start + i]); @@ -4039,15 +4039,15 @@ redraw_prompt: print_char(input, 0, i + window_current->prompt_len, line[line_start + i]); } #else - for (i = 0; i < input->_maxx + 1 - window_current->prompt_len && i < strlen(line) - line_start; i++) + for (i = 0; i < getmaxx(input) - window_current->prompt_len && i < strlen(line) - line_start; i++) print_char(input, 0, i + window_current->prompt_len, line[line_start + i]); #endif wattrset(input, color_pair(COLOR_BLACK, 1, COLOR_BLACK)); if (line_start > 0) mvwaddch(input, 0, window_current->prompt_len, '<'); - if (strlen(line) - line_start > input->_maxx + 1 - window_current->prompt_len) - mvwaddch(input, 0, input->_maxx, '>'); + if (strlen(line) - line_start > getmaxx(input) - window_current->prompt_len) + mvwaddch(input, 0, (getmaxx(input) - 1), '>'); wattrset(input, color_pair(COLOR_WHITE, 0, COLOR_BLACK)); wmove(input, 0, line_index - line_start + window_current->prompt_len); } @@ -4960,11 +4960,11 @@ static int ui_ncurses_event(const char * array_free(argv); - if (w->left + w->width > stdscr->_maxx + 1) - w->left = stdscr->_maxx + 1 - w->width; + if (w->left + w->width > getmaxx(stdscr)) + w->left = getmaxx(stdscr) - w->width; - if (w->top + w->height > stdscr->_maxy + 1) - w->top = stdscr->_maxy + 1 - w->height; + if (w->top + w->height > getmaxy(stdscr)) + w->top = getmaxy(stdscr) - w->height; if (w->floating) mvwin(w->window, w->top, w->left); @@ -5142,9 +5142,9 @@ void header_statusbar_resize(const char if (config_header_size) { if (!header) - header = newwin(config_header_size, stdscr->_maxx + 1, 0, 0); + header = newwin(config_header_size, getmaxx(stdscr), 0, 0); else - wresize(header, config_header_size, stdscr->_maxx + 1); + wresize(header, config_header_size, getmaxx(stdscr)); update_header(0); } @@ -5156,8 +5156,8 @@ void header_statusbar_resize(const char window_resize(); - wresize(status, config_statusbar_size, stdscr->_maxx + 1); - mvwin(status, stdscr->_maxy + 1 - input_size - config_statusbar_size, 0); + wresize(status, config_statusbar_size, getmaxx(stdscr)); + mvwin(status, getmaxy(stdscr) - input_size - config_statusbar_size, 0); update_statusbar(0);