diff options
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 62 |
1 files changed, 32 insertions, 30 deletions
@@ -68,39 +68,41 @@ main(int argc, char **argv) char next_path[PATH_MAX]; timeout(100); while (1) { - if (!need_redraw) - continue; - - fm_draw_entries(info->windows[FM_PANE_LEFT], info->cur, - info->cursor, info->top, info->bottom); - - if (!info->cur->items[info->cursor].is_dir) { - size_t len = snprintf( - next_path, sizeof(next_path), "%s/%s", info->cwd, - info->cur->items[info->cursor].name); - if (len >= sizeof(next_path)) { - die("Length of items error"); + if (need_redraw) { + + fm_draw_entries(info->windows[FM_PANE_LEFT], info->cur, + info->cursor, info->top, info->bottom); + + if (!info->cur->items[info->cursor].is_dir) { + size_t len = snprintf( + next_path, sizeof(next_path), "%s/%s", + info->cwd, + info->cur->items[info->cursor].name); + if (len >= sizeof(next_path)) { + die("Length of items error"); + } + fm_preview_file(info->windows[FM_PANE_RIGHT], + next_path); + } else { + size_t len = snprintf( + next_path, sizeof(next_path), "%s/%s", + info->cwd, + info->cur->items[info->cursor].name); + if (len >= sizeof(next_path)) { + die("Length of items error"); + } + + fm_preview_dir(info, next_path); } - fm_preview_file(info->windows[FM_PANE_RIGHT], - next_path); - } else { - size_t len = snprintf( - next_path, sizeof(next_path), "%s/%s", info->cwd, - info->cur->items[info->cursor].name); - if (len >= sizeof(next_path)) { - die("Length of items error"); - } - - fm_preview_dir(info, next_path); - } - draw_status_bar(term->windows[stat_bar_win_index], info->cwd, - info->cur->items[info->cursor].permission); - - wrefresh(info->windows[FM_PANE_RIGHT]->win); - wrefresh(info->windows[FM_PANE_LEFT]->win); - wrefresh(term->windows[stat_bar_win_index]->win); + draw_status_bar( + term->windows[stat_bar_win_index], info->cwd, + info->cur->items[info->cursor].permission); + wrefresh(info->windows[FM_PANE_RIGHT]->win); + wrefresh(info->windows[FM_PANE_LEFT]->win); + wrefresh(term->windows[stat_bar_win_index]->win); + } ch = getch(); handling_keys(ch, info); } |
