Index | Thread | Search

From:
Nicholas Marriott <nicholas.marriott@gmail.com>
Subject:
Re: tmux: add utf8 terminal-features
To:
tech@openbsd.org
Date:
Mon, 31 Aug 2026 09:16:28 +0100

Download raw body.

Thread
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] "





On Sun, 30 Aug 2026 at 22:08, Kirill A. Korinsky <kirill@korins.ky> wrote:

> Nicholas,
>
> as discussed / suggested in https://github.com/tmux/tmux/issues/5546 I had
> tried to implement utf8 in terminal-features which seems quite trivial.
>
> 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      30 Aug 2026 15:03:51 -0000
> @@ -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: August 25 2026 $
> +.Dd $Mdocdate: August 30 2026 $
>  .Dt TMUX 1
>  .Os
>  .Sh NAME
> @@ -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      30 Aug 2026 15:06:47 -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. */
> @@ -476,7 +484,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 +533,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);
>
>
> --
> wbr, Kirill
>