On Thu, Apr 30, 2015 at 07:39:01PM -0500, Elliott Cable wrote:
> 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.

> 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"
        set ttymouse=xterm2
    endif

    if v:version >= 704 && &term =~ "^screen"
        " Odds are good that this is a modern tmux, so let's pick the
        " best mouse-handling mode.
        set ttymouse=sgr
    endif


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to