summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/tmux.114
-rw-r--r--usr.bin/tmux/tmux.h3
-rw-r--r--usr.bin/tmux/tty-features.c3
-rw-r--r--usr.bin/tmux/tty-term.c3
-rw-r--r--usr.bin/tmux/tty.c26
5 files changed, 34 insertions, 15 deletions
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 1072bf7341a..4a33de855b7 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.930 2023/09/01 13:48:54 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.931 2023/09/02 09:17:23 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: September 1 2023 $
+.Dd $Mdocdate: September 2 2023 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -6802,9 +6802,15 @@ Set a styled underscore.
The single parameter is one of: 0 for no underscore, 1 for normal
underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
underscore and 5 for dashed underscore.
-.It Em \&Setulc , \&ol
+.It Em \&Setulc , \&Setulc1, \&ol
Set the underscore colour or reset to the default.
-The argument is (red * 65536) + (green * 256) + blue where each is between 0
+.Em Setulc
+is for RGB colours and
+.Em Setulc1
+for ANSI or 256 colours.
+The
+.Em Setulc
+argument is (red * 65536) + (green * 256) + blue where each is between 0
and 255.
.It Em \&Ss , Se
Set or reset the cursor style.
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index d3268a190a3..cdebd4b4f7b 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.1207 2023/09/01 14:29:11 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.1208 2023/09/02 09:17:23 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -536,6 +536,7 @@ enum tty_code_code {
TTYC_SETRGBB,
TTYC_SETRGBF,
TTYC_SETULC,
+ TTYC_SETULC1,
TTYC_SGR0,
TTYC_SITM,
TTYC_SMACS,
diff --git a/usr.bin/tmux/tty-features.c b/usr.bin/tmux/tty-features.c
index deb43f24776..de6652c6bfa 100644
--- a/usr.bin/tmux/tty-features.c
+++ b/usr.bin/tmux/tty-features.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-features.c,v 1.28 2022/11/11 08:44:11 nicm Exp $ */
+/* $OpenBSD: tty-features.c,v 1.29 2023/09/02 09:17:23 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -145,6 +145,7 @@ static const struct tty_feature tty_feature_overline = {
static const char *const tty_feature_usstyle_capabilities[] = {
"Smulx=\\E[4::%p1%dm",
"Setulc=\\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m",
+ "Setulc1=\\E[58::5::%p1%dm",
"ol=\\E[59m",
NULL
};
diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c
index 6ca24f4a286..8e6d76a95f0 100644
--- a/usr.bin/tmux/tty-term.c
+++ b/usr.bin/tmux/tty-term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-term.c,v 1.99 2023/06/30 13:19:32 nicm Exp $ */
+/* $OpenBSD: tty-term.c,v 1.100 2023/09/02 09:17:23 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -264,6 +264,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_SETRGBB] = { TTYCODE_STRING, "setrgbb" },
[TTYC_SETRGBF] = { TTYCODE_STRING, "setrgbf" },
[TTYC_SETULC] = { TTYCODE_STRING, "Setulc" },
+ [TTYC_SETULC1] = { TTYCODE_STRING, "Setulc1" },
[TTYC_SE] = { TTYCODE_STRING, "Se" },
[TTYC_SXL] = { TTYCODE_FLAG, "Sxl" },
[TTYC_SGR0] = { TTYCODE_STRING, "sgr0" },
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 94b33ce686e..00988286f83 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.432 2023/07/13 06:03:48 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.433 2023/09/02 09:17:23 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2814,11 +2814,13 @@ tty_check_us(__unused struct tty *tty, struct colour_palette *palette,
gc->us = c;
}
- /* Underscore colour is set as RGB so convert. */
- if ((c = colour_force_rgb (gc->us)) == -1)
- gc->us = 8;
- else
- gc->us = c;
+ /* Convert underscore colour if only RGB can be supported. */
+ if (!tty_term_has(tty->term, TTYC_SETULC1)) {
+ if ((c = colour_force_rgb (gc->us)) == -1)
+ gc->us = 8;
+ else
+ gc->us = c;
+ }
}
static void
@@ -2898,9 +2900,17 @@ tty_colours_us(struct tty *tty, const struct grid_cell *gc)
goto save;
}
- /* Must be an RGB colour - this should never happen. */
- if (~gc->us & COLOUR_FLAG_RGB)
+ /*
+ * If this is not an RGB colour, use Setulc1 if it exists, otherwise
+ * convert.
+ */
+ if (~gc->us & COLOUR_FLAG_RGB) {
+ c = gc->us;
+ if ((~c & COLOUR_FLAG_256) && (c >= 90 && c <= 97))
+ c -= 82;
+ tty_putcode_i(tty, TTYC_SETULC1, c & ~COLOUR_FLAG_256);
return;
+ }
/*
* Setulc and setal follows the ncurses(3) one argument "direct colour"