Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2025-09-07 18:01:08 +01:00
4 changed files with 42 additions and 3 deletions

View File

@@ -18,6 +18,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <ctype.h>
#include <errno.h> #include <errno.h>
#include <glob.h> #include <glob.h>
#include <stdlib.h> #include <stdlib.h>
@@ -149,6 +150,21 @@ cmd_source_file_add(struct cmd_source_file_data *cdata, const char *path)
cdata->files[cdata->nfiles++] = xstrdup(path); cdata->files[cdata->nfiles++] = xstrdup(path);
} }
static char *
cmd_source_file_quote_for_glob(const char *path)
{
char *quoted = xmalloc(2 * strlen(path) + 1), *q = quoted;
const char *p = path;
while (*p != '\0') {
if ((u_char)*p < 128 && !isalnum((u_char)*p) && *p != '/')
*q++ = '\\';
*q++ = *p++;
}
*q = '\0';
return (quoted);
}
static enum cmd_retval static enum cmd_retval
cmd_source_file_exec(struct cmd *self, struct cmdq_item *item) cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
{ {
@@ -188,7 +204,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item)
if (args_has(args, 'v')) if (args_has(args, 'v'))
cdata->flags |= CMD_PARSE_VERBOSE; cdata->flags |= CMD_PARSE_VERBOSE;
utf8_stravis(&cwd, server_client_get_cwd(c, NULL), VIS_GLOB); cwd = cmd_source_file_quote_for_glob(server_client_get_cwd(c, NULL));
for (i = 0; i < args_count(args); i++) { for (i = 0; i < args_count(args); i++) {
path = args_string(args, i); path = args_string(args, i);

View File

@@ -584,10 +584,11 @@ layout_set_main_v_mirrored(struct window *w)
void void
layout_set_tiled(struct window *w) layout_set_tiled(struct window *w)
{ {
struct options *oo = w->options;
struct window_pane *wp; struct window_pane *wp;
struct layout_cell *lc, *lcrow, *lcchild; struct layout_cell *lc, *lcrow, *lcchild;
u_int n, width, height, used, sx, sy; 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); layout_print_cell(w->layout_root, __func__, 1);
@@ -596,11 +597,15 @@ layout_set_tiled(struct window *w)
if (n <= 1) if (n <= 1)
return; return;
/* Get maximum columns from window option. */
max_columns = options_get_number(oo, "tiled-layout-max-columns");
/* How many rows and columns are wanted? */ /* How many rows and columns are wanted? */
rows = columns = 1; rows = columns = 1;
while (rows * columns < n) { while (rows * columns < n) {
rows++; rows++;
if (rows * columns < n) if (rows * columns < n &&
(max_columns == 0 || columns < max_columns))
columns++; columns++;
} }

View File

@@ -1394,6 +1394,16 @@ const struct options_table_entry options_table[] = {
.text = "Whether typing should be sent to all panes simultaneously." .text = "Whether typing should be sent to all panes simultaneously."
}, },
{ .name = "tiled-layout-max-columns",
.type = OPTIONS_TABLE_NUMBER,
.scope = OPTIONS_TABLE_WINDOW,
.minimum = 0,
.maximum = USHRT_MAX,
.default_num = 0,
.text = "Maximum number of columns in the 'tiled' layout. "
"A value of 0 means no limit."
},
{ .name = "window-active-style", { .name = "window-active-style",
.type = OPTIONS_TABLE_STRING, .type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,

8
tmux.1
View File

@@ -5222,6 +5222,14 @@ see the
.Sx STYLES .Sx STYLES
section. section.
.Pp .Pp
.It Ic tiled-layout-max-columns Ar number
Set the maximum number of columns in the
.Ic tiled
layout.
A value of 0 (the default) means no limit.
When a limit is set, panes are arranged to not exceed this number of columns,
with additional panes stacked in extra rows.
.Pp
.It Ic window-status-activity-style Ar style .It Ic window-status-activity-style Ar style
Set status line style for windows with an activity alert. Set status line style for windows with an activity alert.
For how to specify For how to specify