void modes_post(void) { if(ANY(vle_mode_is, CMDLINE_MODE, SORT_MODE, CHANGE_MODE, ATTR_MODE)) { return; } else if(vle_mode_is(VIEW_MODE)) { view_post(); return; } else if(is_in_menu_like_mode()) { menu_post(); return; } update_screen(curr_stats.need_update); if(curr_stats.save_msg) { status_bar_message(NULL); } if(!vle_mode_is(FILE_INFO_MODE) && curr_view->list_rows > 0) { if(!is_status_bar_multiline()) { update_stat_window(curr_view); ui_ruler_update(curr_view); } } modes_statusbar_update(); }
void redraw_window(void) { int screen_x, screen_y; int x, y; struct winsize ws; curr_stats.freeze = 1; ioctl(0, TIOCGWINSZ, &ws); // changed for pdcurses resize_term(ws.ws_row, ws.ws_col); getmaxyx(stdscr, screen_y, screen_x); if (screen_y < 10) finish("Terminal is too small to run vifm\n"); if (screen_x < 30) finish("Terminal is too small to run vifm\n"); wclear(stdscr); wclear(lwin.title); wclear(lwin.win); wclear(rwin.title); wclear(rwin.win); wclear(stat_win); wclear(status_bar); wclear(pos_win); wclear(num_win); wclear(rborder); wclear(mborder); wclear(lborder); wclear(change_win); wclear(sort_win); wresize(stdscr, screen_y, screen_x); mvwin(sort_win, (screen_y - 14)/2, (screen_x -30)/2); mvwin(change_win, (screen_y - 10)/2, (screen_x -30)/2); wresize(menu_win, screen_y - 1, screen_x); wresize(error_win, (screen_y -10)/2, screen_x -2); mvwin(error_win, (screen_y -10)/2, 1); wresize(lborder, screen_y -2, 1); if (curr_stats.number_of_windows == 1) { wresize(lwin.title, 1, screen_x -1); wresize(lwin.win, screen_y -3, screen_x -2); getmaxyx(lwin.win, y, x); lwin.window_width = x -1; lwin.window_rows = y -1; wresize(rwin.title, 1, screen_x -1); mvwin(rwin.title, 0, 1); wresize(rwin.win, screen_y -3, screen_x -2); mvwin(rwin.win, 1, 1); getmaxyx(rwin.win, y, x); rwin.window_width = x -1; rwin.window_rows = y -1; } else { wresize(lwin.title, 1, screen_x/2 -2); wresize(lwin.win, screen_y -3, screen_x/2 -2); getmaxyx(lwin.win, y, x); lwin.window_width = x -1; lwin.window_rows = y -1; mvwin(mborder, 0, screen_x/2 -1); wresize(mborder, screen_y, 2); wresize(rwin.title, 1, screen_x/2 -2); mvwin(rwin.title, 0, screen_x/2 +1); wresize(rwin.win, screen_y -3, screen_x/2 -2); mvwin(rwin.win, 1, screen_x/2 +1); getmaxyx(rwin.win, y, x); rwin.window_width = x -1; rwin.window_rows = y -1; } /* For FreeBSD */ keypad(lwin.win, TRUE); keypad(rwin.win, TRUE); if (screen_x % 2) { wresize(rborder, screen_y -2, 2); mvwin(rborder, 0, screen_x -2); } else { wresize(rborder, screen_y -2, 1); mvwin(rborder, 0, screen_x -1); } wresize(stat_win, 1, screen_x); mvwin(stat_win, screen_y -2, 0); wresize(status_bar, 1, screen_x -19); /* For FreeBSD */ keypad(status_bar, TRUE); mvwin(status_bar, screen_y -1, 0); wresize(pos_win, 1, 13); mvwin(pos_win, screen_y -1, screen_x -13); wresize(num_win, 1, 6); mvwin(num_win, screen_y -1, screen_x -19); curs_set(0); change_directory(&rwin, rwin.curr_dir); load_dir_list(&rwin, 0); change_directory(&lwin, lwin.curr_dir); load_dir_list(&lwin, 0); if(curr_stats.view) { wclear(other_view->win); change_directory(curr_view, curr_view->curr_dir); load_dir_list(curr_view, 0); quick_view_file(curr_view); } else change_directory(curr_view, curr_view->curr_dir); update_stat_window(curr_view); if (curr_view->selected_files) { char status_buf[24]; snprintf(status_buf, sizeof(status_buf), "%d %s Selected", curr_view->selected_files, curr_view->selected_files == 1 ? "File" : "Files"); status_bar_message(status_buf); } else status_bar_message(" "); update_pos_window(curr_view); update_all_windows(); moveto_list_pos(curr_view, curr_view->list_pos); wrefresh(curr_view->win); curr_stats.freeze = 0; curr_stats.need_redraw = 0; }