Re: tmux: add utf8 terminal-features
Kirill A. Korinsky <[email protected]>
| Newsgroups | gmane.os.openbsd.tech |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 31 Aug 2026 10:16:28 +0200, Nicholas Marriott <[email protected]> wrote: > > It is a little unfortunate UTF8 is a client flag rather than tty_term but > it kind of has to be, so this looks the right approach. > > I think tty_feature_present should special-case this as well (you can > check term->tty->client->flags) and then you need this in window-client.c > also so it shows up in the info pane (C-b D i): > > --- window-client.c 5 Aug 2026 08:54:56 -0000 1.48 > +++ window-client.c 31 Aug 2026 08:13:37 -0000 > @@ -102,7 +102,8 @@ static const char *window_client_info_li > WINDOW_CLIENT_FEATURE(sync) " " > WINDOW_CLIENT_FEATURE(title), > " #[#{E:tree-mode-border-style},acs]x#[default] " > - WINDOW_CLIENT_FEATURE(usstyle), > + WINDOW_CLIENT_FEATURE(usstyle) " " > + WINDOW_CLIENT_FEATURE(utf8), > > "#[#{E:tree-mode-border-style},acs]qqqqqqqqqqqqqqn#{R:q,#{window_width}}#[default]", > > "#[fg=themelightgrey]prefix > #[#{E:tree-mode-border-style},acs]x#[default] " > Thanks, here updated diff which should report utf8 state when it is enabled via locale, -u or the new feature. Ok? Index: tmux.1 =================================================================== RCS file: /home/cvs/src/usr.bin/tmux/tmux.1,v diff -u -p -r1.1159 tmux.1 --- tmux.1 25 Aug 2026 08:37:08 -0000 1.1159 +++ tmux.1 31 Aug 2026 10:45:16 -0000 @@ -5111,6 +5111,8 @@ Supports title setting. .It usstyle Allows underscore style and colour to be set. +.It utf8 +Supports UTF\-8 output. .El .It Ic terminal\-overrides[] Ar string Allow terminal descriptions read using Index: tty-features.c =================================================================== RCS file: /home/cvs/src/usr.bin/tmux/tty-features.c,v diff -u -p -r1.42 tty-features.c --- tty-features.c 17 Aug 2026 14:47:41 -0000 1.42 +++ tty-features.c 31 Aug 2026 10:42:21 -0000 @@ -358,6 +358,13 @@ static const struct tty_feature tty_feat 0 }; +/* Terminal supports UTF-8. */ +static const struct tty_feature tty_feature_utf8 = { + "utf8", + NULL, + 0 +}; + /* Available terminal features. */ static const struct tty_feature *const tty_features[] = { &tty_feature_256, @@ -380,7 +387,8 @@ static const struct tty_feature *const t &tty_feature_strikethrough, &tty_feature_sync, &tty_feature_title, - &tty_feature_usstyle + &tty_feature_usstyle, + &tty_feature_utf8 }; /* Parse features for client. */ @@ -463,6 +471,9 @@ tty_feature_present(struct tty_term *ter u_int i; char *copy; + if (strcmp(name, "utf8") == 0) + return ((term->tty->client->flags & CLIENT_UTF8) != 0); + for (i = 0; i < nitems(tty_features); i++) { tf = tty_features[i]; if (strcmp(tf->name, name) == 0) { @@ -476,7 +487,8 @@ tty_feature_present(struct tty_term *ter * We don't just have the feature flag set. Check if the capabilities * supported by the client are actual set instead. */ - if (tf == NULL || strcmp(name, "ignorefkeys") == 0) + if (tf == NULL || tf->capabilities == NULL || + strcmp(name, "ignorefkeys") == 0) return (0); if (tf->flags != 0 && (term->flags & tf->flags) != tf->flags) return (0); @@ -524,6 +536,8 @@ tty_apply_features(struct tty_term *term } } term->flags |= tf->flags; + if (tf == &tty_feature_utf8) + c->flags |= CLIENT_UTF8; } if ((term->applied_features|feat) == term->applied_features) return (0); Index: window-client.c =================================================================== RCS file: /home/cvs/src/usr.bin/tmux/window-client.c,v diff -u -p -r1.48 window-client.c --- window-client.c 5 Aug 2026 08:54:56 -0000 1.48 +++ window-client.c 31 Aug 2026 10:42:21 -0000 @@ -102,7 +102,8 @@ static const char *window_client_info_li WINDOW_CLIENT_FEATURE(sync) " " WINDOW_CLIENT_FEATURE(title), " #[#{E:tree-mode-border-style},acs]x#[default] " - WINDOW_CLIENT_FEATURE(usstyle), + WINDOW_CLIENT_FEATURE(usstyle) " " + WINDOW_CLIENT_FEATURE(utf8), "#[#{E:tree-mode-border-style},acs]qqqqqqqqqqqqqqn#{R:q,#{window_width}}#[default]", "#[fg=themelightgrey]prefix #[#{E:tree-mode-border-style},acs]x#[default] " -- wbr, Kirill