A.J.Mechelynck wrote:
> Micah Cowan wrote:
>> Attached is a proposed patch that effects the change I'm requesting. I
>> would love to get some feedback/further discussion based on it. They say
>> "code talks", and so here is my concrete expression. :)
> 
> Shouldn't it rather use the 'ttymouse' option?

It does. :)   ...or rather, my code is what would be used to set
ttymouse's default based on the detected terminal.

> IIUC, that option is
> supposed to be set to either "xterm" or "xterm2" at startup if the
> terminal is known to support xterm mouse codes.

My code is used at the spot where the value of the 'ttymouse' option is
set automatically by setting the 'term' option: both at startup, and
whenever the user sets it manually via :set term=.

> This is done as a result
> of sending the t_RV code and receiving an answer for it, which happens
> after the first file has been loaded and all -c commands have been
> processed: probably just before or just after the VimEnter event. IOW,
> you cannot test them in your vimrc or even in a global plugin (they are
> sourced too early). At the VimEnter event might be late enough but I
> haven't tested it

What happens, to the best of my reading, is:

1. If the terminal is detected as supporting t_RV (which basically means
that it has been detected as fully compatible), it issues that sequence
and checks for a result. If it gets an expected response, it will set
ttymouse appropriately.

2. Sometime later, but before the first file is loaded, etc, the "term"
option is automatically set based on the TERM environment variable.
   The "term" option is a magic option which causes it to check a bunch
of things, including whether xterm mouse support is enabled (at the
point where I set the term_uses_xterm_mouse var).

3. If the tty is xterm-mouse capable (before patch, if it is a full
xterm implementation), then it sets ttymouse to xterm: but only if
ttymouse doesn't already contain a setting that works for the current
terminal (thus, if t_RV is set and the xterm said it was
xterm2-compliant, ttymouse will already have been set to "xterm2").

Screen is actually quite capable of understanding and transmitting
xterm2 protocol, but it doesn't provide t_RV, and so has no way of
telling vim whether it's on an xterm2-supporting xterm or not.

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to