Skip to content

Commit 2bb30ad

Browse files
committed
Add noattr and use in mode-style to allow whether attributes are ignored
or used to be configured. GitHub issue 4498.
1 parent ccf0515 commit 2bb30ad

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

usr.bin/tmux/options-table.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: options-table.c,v 1.193 2025/06/15 22:24:51 nicm Exp $ */
1+
/* $OpenBSD: options-table.c,v 1.194 2025/06/20 14:54:33 nicm Exp $ */
22

33
/*
44
* Copyright (c) 2011 Nicholas Marriott <[email protected]>
@@ -1103,7 +1103,7 @@ const struct options_table_entry options_table[] = {
11031103
.type = OPTIONS_TABLE_STRING,
11041104
.scope = OPTIONS_TABLE_WINDOW,
11051105
.flags = OPTIONS_TABLE_IS_STYLE,
1106-
.default_str = "bg=yellow,fg=black",
1106+
.default_str = "noattr,bg=yellow,fg=black",
11071107
.separator = ",",
11081108
.text = "Style of indicators and highlighting in modes."
11091109
},

usr.bin/tmux/screen.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: screen.c,v 1.89 2025/05/12 09:17:42 nicm Exp $ */
1+
/* $OpenBSD: screen.c,v 1.90 2025/06/20 14:54:33 nicm Exp $ */
22

33
/*
44
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -577,8 +577,7 @@ screen_select_cell(struct screen *s, struct grid_cell *dst,
577577
if (COLOUR_DEFAULT(dst->bg))
578578
dst->bg = src->bg;
579579
utf8_copy(&dst->data, &src->data);
580-
dst->attr = dst->attr & ~GRID_ATTR_CHARSET;
581-
dst->attr |= src->attr & GRID_ATTR_CHARSET;
580+
dst->attr = src->attr;
582581
dst->flags = src->flags;
583582
}
584583

usr.bin/tmux/style.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: style.c,v 1.37 2025/05/22 07:43:38 nicm Exp $ */
1+
/* $OpenBSD: style.c,v 1.38 2025/06/20 14:54:33 nicm Exp $ */
22

33
/*
44
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -217,7 +217,9 @@ style_parse(struct style *sy, const struct grid_cell *base, const char *in)
217217
} else if (strcasecmp(tmp, "none") == 0)
218218
sy->gc.attr = 0;
219219
else if (end > 2 && strncasecmp(tmp, "no", 2) == 0) {
220-
if ((value = attributes_fromstring(tmp + 2)) == -1)
220+
if (strcmp(tmp + 2, "attr") == 0)
221+
value = 0xffff & ~GRID_ATTR_CHARSET;
222+
else if ((value = attributes_fromstring(tmp + 2)) == -1)
221223
goto error;
222224
sy->gc.attr &= ~value;
223225
} else if (end > 6 && strncasecmp(tmp, "width=", 6) == 0) {

usr.bin/tmux/tmux.1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" $OpenBSD: tmux.1,v 1.1002 2025/06/20 13:31:59 nicm Exp $
1+
.\" $OpenBSD: tmux.1,v 1.1003 2025/06/20 14:54:33 nicm Exp $
22
.\"
33
.\" Copyright (c) 2007 Nicholas Marriott <[email protected]>
44
.\"
@@ -6305,6 +6305,8 @@ and
63056305
.Ic list=right-marker
63066306
mark the text to be used to mark that text has been trimmed from the left or
63076307
right of the list if there is not enough space.
6308+
.It Ic noattr
6309+
Do not copy attributes from the default style.
63086310
.It Xo Ic push-default ,
63096311
.Ic pop-default
63106312
.Xc

0 commit comments

Comments
 (0)