diff --git a/tmux.h b/tmux.h index c667f013d..b961b67d0 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1421 2026/08/03 20:18:20 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1422 2026/08/05 08:54:56 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1731,6 +1731,7 @@ struct tty_term { #define TERM_RGBCOLOURS 0x10 #define TERM_VT100LIKE 0x20 #define TERM_SIXEL 0x40 +#define TERM_INVALIDMS 0x80 int flags; LIST_ENTRY(tty_term) entry; diff --git a/tty-term.c b/tty-term.c index 164b9f977..850adf31c 100644 --- a/tty-term.c +++ b/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.106 2026/06/13 09:17:29 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.107 2026/08/05 08:54:56 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -31,6 +31,7 @@ #include "tmux.h" static char *tty_term_strip(const char *); +static void tty_term_validate(struct tty_term *); struct tty_terms tty_terms = LIST_HEAD_INITIALIZER(tty_terms); @@ -519,6 +520,26 @@ tty_term_apply_overrides(struct tty_term *term) acs = "a#j+k+l+m+n+o-p-q-r-s-t+u+v+w+x|y~."; for (; acs[0] != '\0' && acs[1] != '\0'; acs += 2) term->acs[(u_char) acs[0]][0] = acs[1]; + + tty_term_validate(term); +} + +static void +tty_term_validate(struct tty_term *term) +{ + struct tty_code *code = &term->codes[TTYC_MS]; + + if (code->type != TTYCODE_STRING) + return; + if (*tty_term_string_ss(term, TTYC_MS, "c", "?") != '\0') { + term->flags &= ~TERM_INVALIDMS; + return; + } + + log_debug("removing invalid Ms capability"); + term->flags |= TERM_INVALIDMS; + free(code->value.string); + code->type = TTYCODE_NONE; } struct tty_term * diff --git a/window-client.c b/window-client.c index b94c22119..f42aa5b7a 100644 --- a/window-client.c +++ b/window-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-client.c,v 1.47 2026/07/14 17:17:18 nicm Exp $ */ +/* $OpenBSD: window-client.c,v 1.48 2026/08/05 08:54:56 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott @@ -113,14 +113,16 @@ static const char *window_client_info_lines[] = { "#{?#{I/c:kmous},,#[align=right]unavailable: [kmous] missing}", "#[fg=themelightgrey]set-clipboard #[#{E:tree-mode-border-style},acs]x#[default] " - "#{?#{!=:#{set-clipboard},off},#{?#{I/f:clipboard},," + "#{?#{!=:#{set-clipboard},off},#{?#{I/c:Ms},," "#[fg=themered]}#{set-clipboard},#[fg=themelightgrey]off} " - "#{?#{I/f:clipboard},,#[align=right]unavailable: [Ms] missing}", + "#{?#{I/c:Ms},,#[align=right]unavailable: [Ms] " + "#{?clipboard_invalid,invalid,missing}}", "#[fg=themelightgrey]get-clipboard #[#{E:tree-mode-border-style},acs]x#[default] " - "#{?#{!=:#{get-clipboard},off},#{?#{I/f:clipboard},," + "#{?#{!=:#{get-clipboard},off},#{?#{I/c:Ms},," "#[fg=themered]}#{get-clipboard},#[fg=themelightgrey]off} " - "#{?#{I/f:clipboard},,#[align=right]unavailable: [Ms] missing}", + "#{?#{I/c:Ms},,#[align=right]unavailable: [Ms] " + "#{?clipboard_invalid,invalid,missing}}", "#[fg=themelightgrey]focus-events #[#{E:tree-mode-border-style},acs]x#[default] " "#{?focus-events,#{?#{I/f:focus},,#[fg=themered]}on,#[fg=themelightgrey]off} " @@ -273,6 +275,10 @@ window_client_draw_info(__unused void *modedata, void *itemdata, char *expanded; ft = format_create_defaults(NULL, c, NULL, NULL, NULL); + if (c->tty.term->flags & TERM_INVALIDMS) + format_add(ft, "clipboard_invalid", "1"); + else + format_add(ft, "clipboard_invalid", "0"); screen_write_cursormove(ctx, cx, cy, 0); for (i = 0; i < nitems(window_client_info_lines); i++) {