diff --git a/src/frontend.c b/src/frontend.c index 7276e61..4c6551d 100644 --- a/src/frontend.c +++ b/src/frontend.c @@ -321,13 +321,8 @@ void front_setcharcursor(char ch) { void redraw_canvas_win() { // find max ranges to draw canvas - int max_x = view_max_x; - int max_y = view_max_y; - - if (max_x >= view->canvas->num_cols - view->x) - (max_x = view->canvas->num_cols - view->x); - if (max_y >= view->canvas->num_rows - view->y) - (max_y = view->canvas->num_rows - view->y); + int max_x = min(view_max_x, view->canvas->num_cols - view->x); + int max_y = min(view_max_y, view->canvas->num_rows - view->y); // draw canvas onto window for (int x = 0; x < max_x; x++) {