Description
Issue description
I'm trying to enable clipboard forwarding through mosh according to:
https://gist.github.com/yudai/95b20e3da66df1b066531997f982b57b
set-option -ag terminal-overrides ",xterm-256color:Ms=\\E]52;c;%p2%s\\7"
when I add this option OSC 52 stops working at all (i.e. even through ssh instead of mosh).
i.e. the following command inside tmux doesn't set the clipboard:
> printf "\033]52;c;$(printf "%s" "clipboard" | base64)\a"
Server logs shows the following:
1701273750.514715 screen_write_start_pane: size 176x104, pane %0 (at 0,0)
1701273750.514727 input_parse_buffer: %0 ground, 20 bytes: \033]52;c;Y2xpcGJvYXJk\a
1701273750.514740 input_enter_osc
1701273750.514751 input_end_bel
1701273750.514761 input_exit_osc: "52;c;Y2xpcGJvYXJk" (end BEL)
1701273750.514769 input_osc_52: Y2xpcGJvYXJk
1701273750.514819 screen_write_start_pane: size 176x104, pane %0 (at 0,0)
1701273750.514844 could not expand Ms
1701273750.514852 screen_write_collect_flush: flushed 0 items (screen_write_stop)
Without the config it works.
I confirmed that the values are matched as expected:
# with config
> tmux info | grep Ms
192: Ms: (string) \033]52;c;%p2%s\a
# without config
> tmux info | grep Ms
192: Ms: (string) \033]52;%p1%s;%p2%s\a
#3646 Looks similar, but not the same. In my case default Ms expansion string works and i have newer version of ncurses. But it might be the problem with ncurses nevertheless.
I've seen reports that it is not working for a while, for example: mobile-shell/mosh#1054 (comment)
I know that there are workarounds to solve the XY problem and don't need terminal-overrides at all. For example with #3192 fixed, any tmux build from sources after ccc9dc3 would not require setting the override for my usecase to work. Unfortunately this doesn't seem to be included in latest release yet. Similarly building mosh patched with either mobile-shell/mosh#1054 or mobile-shell/mosh#1104 will help as well. Latter was what I was doing for several years, but custom builds is tedious to maintain, so after it broke again and I noticed mosh 1.4.0 is a thing, I am exploring again whether this is maybe solvable with stock builds.
Required information
> uname -sp && tmux -V && echo $TERM
Linux unknown
tmux 3.3a
xterm-256color
> dpkg-query -W | grep -E 'tmux|ncurses|tinfo|mosh'
libncurses-dev:amd64 6.4+20230625-2+build1
libncurses6:amd64 6.4+20230625-2+build1
libncursesw6:amd64 6.4+20230625-2+build1
libtinfo6:amd64 6.4+20230625-2+build1
libtinfo6:i386 6.4+20230625-2+build1
mosh 1.4.0-1+build2
ncurses-base 6.4+20230625-2+build1
ncurses-bin 6.4+20230625-2+build1
ncurses-term 6.4+20230625-2+build1
tmux 3.3a-4+build1