mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Fix divide by zero on small windows with main-* layouts.
This commit is contained in:
parent
9ffe549ab1
commit
d6bd9c0e7f
@ -244,6 +244,8 @@ layout_set_main_h(struct window *w)
|
|||||||
|
|
||||||
/* How many rows and columns will be needed? */
|
/* How many rows and columns will be needed? */
|
||||||
columns = w->sx / (PANE_MINIMUM + 1); /* maximum columns */
|
columns = w->sx / (PANE_MINIMUM + 1); /* maximum columns */
|
||||||
|
if (columns == 0)
|
||||||
|
columns = 1;
|
||||||
rows = 1 + (n - 1) / columns;
|
rows = 1 + (n - 1) / columns;
|
||||||
columns = 1 + (n - 1) / rows;
|
columns = 1 + (n - 1) / rows;
|
||||||
width = w->sx / columns;
|
width = w->sx / columns;
|
||||||
@ -353,6 +355,8 @@ layout_set_main_v(struct window *w)
|
|||||||
|
|
||||||
/* How many rows and columns will be needed? */
|
/* How many rows and columns will be needed? */
|
||||||
rows = w->sy / (PANE_MINIMUM + 1); /* maximum rows */
|
rows = w->sy / (PANE_MINIMUM + 1); /* maximum rows */
|
||||||
|
if (rows == 0)
|
||||||
|
rows = 1;
|
||||||
columns = 1 + (n - 1) / rows;
|
columns = 1 + (n - 1) / rows;
|
||||||
rows = 1 + (n - 1) / columns;
|
rows = 1 + (n - 1) / columns;
|
||||||
height = w->sy / rows;
|
height = w->sy / rows;
|
||||||
|
Loading…
Reference in New Issue
Block a user