Post by Elliott Cable
So, I can use the mouse to adjust `tmux` panes in Terminals wider than
223 characters (I'm not sure *how*, as theoretically the xterm
sequences should only support indexing up to 223 characters in both X
and Y *anyway*, if I recall correctly.) Similarly, `vim` and `nano -m`
both support Terminals wider than 223 columns.
The original xterm mouse protocol only supports up to 223 columns and
lines. Later versions of the protocol used UTF-8 encoding, which turned
out to be a terrible idea, and more modern terminals support
a completely different protocol based on the SGR escape sequence that's
much more sane.
tmux automatically supports the original protocol and the SGR protocol
both ways (to the terminal it's running inside of, and to the
applications running inside it.) but it only requests UTF-8 mode from
the outer terminal if 'mouse-utf8' is enabled in the config file.
You can use the vttest tool to experiment with different mouse protocols
inside and outside tmux to get a better idea what's going on.
Post by Elliott Cable
However, when console applications such as those are launched *inside*
a single, large `tmux` pane, I can no longer mouse-address columns
past 223. (This is particularly problematic for me, personally,
because that's almost precisely the section of my screen where my vim
directory-tree sits. :P)
According to the documentation for Vim's 'ttymouse' option, it will ask
the terminal for original-xterm-protocol support if $TERM is a variant
of xterm, mlterm or screen (and tmux reports itself as screen, so that's
OK). If the terminal supports the "RV" termcap feature to determine the
xterm version number, Vim will use that to automatically upgrade to
'xterm2' or 'sgr' mouse protocols... but typically only xterm advertises
"RV" support, so tmux is left out of the automatic upgrade process.
In my ~/.vimrc I have the following code to enable decent mouse support,
instead of relying on Vim's autodetection:
" Screen/tmux can also handle xterm mousiness, but Vim doesn't
" detect it by default.
if &term == "screen"
if v:version >= 704 && &term =~ "^screen"
" Odds are good that this is a modern tmux, so let's pick the
" best mouse-handling mode.