mirror of
https://github.com/tmux/tmux.git
synced 2025-10-13 13:26:01 +00:00
Introduce a new window option: tiled-layout-max-columns. It configures
the maximum number of columns in the tiled layout. The default value is 0 which means no limit and makes the change backward-compatible. From vkadlcik at redhat dot com.
This commit is contained in:
@@ -584,10 +584,11 @@ layout_set_main_v_mirrored(struct window *w)
|
||||
void
|
||||
layout_set_tiled(struct window *w)
|
||||
{
|
||||
struct options *oo = w->options;
|
||||
struct window_pane *wp;
|
||||
struct layout_cell *lc, *lcrow, *lcchild;
|
||||
u_int n, width, height, used, sx, sy;
|
||||
u_int i, j, columns, rows;
|
||||
u_int i, j, columns, rows, max_columns;
|
||||
|
||||
layout_print_cell(w->layout_root, __func__, 1);
|
||||
|
||||
@@ -596,11 +597,15 @@ layout_set_tiled(struct window *w)
|
||||
if (n <= 1)
|
||||
return;
|
||||
|
||||
/* Get maximum columns from window option. */
|
||||
max_columns = options_get_number(oo, "tiled-layout-max-columns");
|
||||
|
||||
/* How many rows and columns are wanted? */
|
||||
rows = columns = 1;
|
||||
while (rows * columns < n) {
|
||||
rows++;
|
||||
if (rows * columns < n)
|
||||
if (rows * columns < n &&
|
||||
(max_columns == 0 || columns < max_columns))
|
||||
columns++;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user