Open brandonkal opened 4 years ago
I think I can reproduce this, but I'm honestly not sure how to use tmux -CC
. Can you help explain the best way to test this?
When using SSH, runningecho 'list-clients' | tmux -C
seems to do the right thing (I get a bunch of data sent back to my terminal). But using the -CC
mode I get:
$ echo "list-clients" | tmux -CC
tcgetattr failed: Inappropriate ioctl for device
But when I run tmux -CC
interactively and try to type in "list-clientsret", I don't see any output (which is I think the bug you're reporting)
I don't know of any other terminal emulators that support tmux Control Center outside of iTerm2 https://www.iterm2.com/documentation-tmux-integration.html If you have a mac, that would be the easiest way to test. Thanks.
Then my login command is essentially this:
ssh -t dev 'tmux -CC new -A -s main'
Which means: Start a tmux session or attach to the existing one named main and let iTerm2 manage windows and tabs.
You will probably not see anything with tmux -CC
because tmux sends an unterminated DCS at the start (\033P1000p
) as a marker that control mode has been entered; terminals that don't expect it will hang (at least for a while) waiting for the terminator. I don't remember why that escape sequence is used, I think George suggested it.
If you are parsing escape sequences you will need to recognise this. Other than this sequence at the start, the control mode output should be valid UTF-8.
DCS 1000p was inspired by ReGIS which is entered with DCS [0-3]p and exited with ST.
tmux doesn't send the ST when control mode is exited but it probably should.
Control mode with -CC puts the terminal into raw mode and is only really of use if the end terminal understands it (that is, it is iTerm2).
So would this be possible to fix? It should be possible to delegate that task to iTerm so Mosh doesn't hang no?
mosh doesn't just send output from server to client; it uses the output to update a model of what the screen is supposed to look like, and sends a minimal set of changes to make the client's screen look like the server's. This is part of what makes it perform well on low-bandwidth links, but it means anything that doesn't fit in mosh's model (such as scrollback) is hard to support.
It would be theoretically possible for mosh to support tmux -CC, but it would be a big challenge: that "model of your screen" would need to be extended into a "model of every session in the tmux". This requires mosh to understand the tmux control protocol, etc.
I'm curious if any of the mosh maintainers can weigh in on whether they'd be interested in supporting this in mainline mosh, if someone were to write it. If not, there's always forking.
In the meantime, you might want to look into Eternal Terminal https://eternalterminal.dev/ -- it gives you the roaming features of mosh without the clever state compression ones, which mean it's not quite as magical on low-bandwidth links but can support things like scrollback and tmux -CC.
not work during running tmux -CC
inside mosh
connection,
my setup is
iterm2 Build 3.5.0beta5
, tmux 3.3a
, mosh-server 1.4.0 ubuntu
, mosh client 1.4.0 macOS
,
the normal ssh
with tmux -CC
and tmux -CC attach
works fine with iTerm2
.
Besides, the ~/.tmux.conf
is:
# Scroll up with mouse
set-option -g mouse on
set -g set-clipboard on
# Scrollback buffer
set -g history-limit 10000
# tmux display things in 256 colors
set-option -g default-terminal "screen-256color"
set-option -g terminal-overrides "screen-256color"
# allow for navigating between words with option
set-window-option -g xterm-keys on
# command delay? We don't want that, make it short
set -g escape-time 10
# Allow the arrow key to be used immediately after changing windows
set-option -g repeat-time 0
# Set window notifications
set -g monitor-activity on
set -g visual-activity on
# Update files on focus (using for vim)
set -g focus-events on
# Status update interval
set -g status-interval 1
# Reduce time to wait for Escape key. You'll want this for neovim.
set-option escape-time 40
# Option to clear histroy
bind -n C-k clear-history
bind-key -n C-l send-keys 'C-l'
bind-key R switch-client -r
Mosh breaks with
tmux -CC
. After running the command, it freezes and all input is ignored.