Context
#319 made a copy that Terminal.Gui's clipboard refuses land anyway, through pbcopy, and checks it by reading back through pbpaste. But pbcopy and pbpaste decode and encode text using the locale they're started with. With no UTF-8 locale in the environment (LANG/LC_ALL/LC_CTYPE unset — common under launchd, some SSH sessions and tmux setups), pbcopy stores — as ‚Äî and pbpaste hands back the original bytes, so the read-back matches and TuiCode reports Copied … while the clipboard holds garbled text. That's the exact silent failure #210 set out to end. Pitch: #210.
Reproduced on origin/main (7877e3b):
printf 'a — b §' | env -u LANG -u LC_ALL -u LC_CTYPE pbcopy
osascript -e 'the clipboard' # a — b §
env -u LANG -u LC_ALL -u LC_CTYPE pbpaste | od -c # a 342 200 224 b 302 247 (matches the input)
Acceptance criteria
Tests
- The fallback runs its copy and paste programs with a UTF-8 locale in their environment, whatever TuiCode itself inherited, without dropping the rest of the environment (
WAYLAND_DISPLAY, DISPLAY must still reach wl-copy/xclip).
- Check whether
wl-copy/xclip have the same problem and cover them if so; say in the PR what you found.
- Process invocation stays behind the existing seam, so tests don't spawn real processes.
Out of scope
Context
#319 made a copy that Terminal.Gui's clipboard refuses land anyway, through
pbcopy, and checks it by reading back throughpbpaste. Butpbcopyandpbpastedecode and encode text using the locale they're started with. With no UTF-8 locale in the environment (LANG/LC_ALL/LC_CTYPEunset — common under launchd, some SSH sessions and tmux setups),pbcopystores—as‚Äîandpbpastehands back the original bytes, so the read-back matches and TuiCode reportsCopied …while the clipboard holds garbled text. That's the exact silent failure #210 set out to end. Pitch: #210.Reproduced on
origin/main(7877e3b):Acceptance criteria
LANG,LC_ALLandLC_CTYPEare unset, a copy that falls back to the system's clipboard program and contains non-ASCII text (—,§,é, emoji) pastes in another app exactly as it was in the editor.Copy failed: …rather thanCopied ….Tests
WAYLAND_DISPLAY,DISPLAYmust still reachwl-copy/xclip).wl-copy/xcliphave the same problem and cover them if so; say in the PR what you found.Out of scope