diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index 612a843c..401fa414 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -88,14 +88,14 @@ static void window_prev_page(void) { GUI_WINDOW_REC *gui = WINDOW_GUI(active_win); - gui_window_scroll(active_win, -(gui->parent->last_line-gui->parent->first_line)/2); + gui_window_scroll(active_win, -gui->parent->lines/2); } static void window_next_page(void) { GUI_WINDOW_REC *gui = WINDOW_GUI(active_win); - gui_window_scroll(active_win, (gui->parent->last_line-gui->parent->first_line)/2); + gui_window_scroll(active_win, gui->parent->lines/2); } static const char *get_key_name(int key) diff --git a/src/fe-text/gui-textwidget.c b/src/fe-text/gui-textwidget.c index 2c8607b8..745162aa 100644 --- a/src/fe-text/gui-textwidget.c +++ b/src/fe-text/gui-textwidget.c @@ -269,7 +269,7 @@ static void scrollback_goto_pos(WINDOW_REC *window, GList *pos) gui->startline = gui->bottom_startline; gui->subline = gui->bottom_subline; - gui->ypos = gui->parent->last_line-gui->parent->first_line; + gui->ypos = gui->parent->lines-1; gui->bottom = TRUE; } @@ -400,7 +400,7 @@ static void cmd_scrollback_end(const char *data) gui->startline = gui->bottom_startline; gui->subline = gui->bottom_subline; - gui->ypos = gui->parent->last_line-gui->parent->first_line; + gui->ypos = gui->parent->lines-1; gui->bottom = TRUE; if (is_window_visible(active_win)) diff --git a/src/fe-text/mainwindows.c b/src/fe-text/mainwindows.c index 0d5fa25c..c5fa3d25 100644 --- a/src/fe-text/mainwindows.c +++ b/src/fe-text/mainwindows.c @@ -57,12 +57,6 @@ static MAIN_WINDOW_REC *find_window_with_room(void) return biggest_rec; } -static void create_curses_window(MAIN_WINDOW_REC *window) -{ - window->curses_win = - subwin(stdscr, window->lines, COLS, window->first_line, 0); -} - static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange) { GSList *tmp; @@ -70,8 +64,8 @@ static void mainwindow_resize(MAIN_WINDOW_REC *window, int ychange, int xchange) if (ychange == 0 && !xchange) return; window->lines = window->last_line-window->first_line+1; - delwin(window->curses_win); - create_curses_window(window); + wresize(window->curses_win, window->lines, COLS); + mvwin(window->curses_win, window->first_line, 0); for (tmp = windows; tmp != NULL; tmp = tmp->next) { WINDOW_REC *rec = tmp->data; @@ -110,13 +104,13 @@ MAIN_WINDOW_REC *mainwindow_create(void) rec->lines = rec->last_line-rec->first_line+1; parent->first_line = rec->last_line+1+rec->statusbar_lines; parent->lines = parent->last_line-parent->first_line+1; - delwin(parent->curses_win); - create_curses_window(parent); mainwindow_resize(parent, -space-1, FALSE); } - create_curses_window(rec); + rec->curses_win = newwin(rec->lines, COLS, rec->first_line, 0); + refresh(); + mainwindows = g_slist_append(mainwindows, rec); signal_emit("mainwindow created", 1, rec); return rec; @@ -416,7 +410,8 @@ int mainwindows_reserve_lines(int count, int up) return ret; } -static void mainwindows_resize_two(MAIN_WINDOW_REC *grow_win, MAIN_WINDOW_REC *shrink_win, int count) +static void mainwindows_resize_two(MAIN_WINDOW_REC *grow_win, + MAIN_WINDOW_REC *shrink_win, int count) { mainwindow_resize(grow_win, count, FALSE); mainwindow_resize(shrink_win, -count, FALSE); @@ -526,6 +521,7 @@ static void cmd_window_balance(void) rec->first_line = last_line+1; rec->last_line = rec->first_line-1 + unit_size - rec->statusbar_lines; + rec->lines = rec->last_line-rec->first_line+1; if (bigger_units > 0) { rec->last_line++; diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c index 7ea0e6dc..6de94017 100644 --- a/src/fe-text/statusbar-items.c +++ b/src/fe-text/statusbar-items.c @@ -781,7 +781,7 @@ static void sidebar_remove_items(MAIN_WINDOW_REC *window) static void sig_mainwindow_created(MAIN_WINDOW_REC *window) { - window->statusbar = statusbar_create(STATUSBAR_POS_MIDDLE, window->last_line+1); + window->statusbar = statusbar_create(STATUSBAR_POS_MIDDLE, window->first_line+window->lines); sidebar_add_items(window); } diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c index 75119163..baf191a6 100644 --- a/src/fe-text/statusbar.c +++ b/src/fe-text/statusbar.c @@ -242,7 +242,7 @@ static void sig_mainwindow_resized(MAIN_WINDOW_REC *window) STATUSBAR_REC *rec; rec = window->statusbar; - rec->ypos = window->last_line+1; + rec->ypos = window->first_line+window->lines; } void statusbar_init(void)