From 47a87198f27c0087f12b753477ba6a7c87447461 Mon Sep 17 00:00:00 2001
From: Johannes Altmanninger <aclopte@gmail.com>
Date: Fri, 16 Oct 2026 18:40:02 +0200
Subject: [PATCH] completions/tmux: pass -u flag to fix parsing when locale
 vars undefined

Our dynamic tmux completions run "tmux list-commands" with a template
that contains a literal tab character.

If $LC_CTYPE or $LANG don't contain UTF-8, passes output through
utf8_sanitize(), which also replaces nonprintable ASCII control
characters with "_" (not sure why).

This breaks our logic of splitting at the tab character, causing
macOS and Windows CI failures in check-completions:

    complete: Expected a string, but found a pipe
    server-access _[-adglrw] [-t target-pane] [user|group]

I wonder if this also happens to human users?  At least on an old
mac here, none of LC_ALL, LC_CTYPE, LANG is set to an UTF-8 locale,
so I was able to reproduce here.. :(
--- a/share/completions/tmux.fish
+++ b/share/completions/tmux.fish
@@ -63,7 +63,7 @@ complete -c tmux -x
 # them with better-documented completions and custom completions for some
 # arguments, e.g. for target panes, but only have partial coverage.
 function __fish_tmux_parse_lscm_usage
-    set -l lscm (tmux list-commands -F "#{command_list_name} #{command_list_alias}"\t"#{command_list_usage}" 2>/dev/null)
+    set -l lscm (tmux -u list-commands -F "#{command_list_name} #{command_list_alias}"\t"#{command_list_usage}" 2>/dev/null)
     or return
 
     for cmd_tab_usage in $lscm
