A.J.Mechelynck wrote: > Micah Cowan wrote: > [...] >> But you already have hacked support into your programs for mouse >> support. Now that you've done that, couldn't you just open it up a bit? >> Is there anything wrong with always recognizing the appropriate xterm >> sequences (provided that they don't first match a valid terminfo entry)? >> This is the approach that elinks seems to take, and I don't see any >> particular reason why vim couldn't do this as well. > [...] > > There are conflicts between xterm mouse codes and DEC mouse codes. See > ":help 'ttymouse'" for details (and, maybe, for a way of telling Vim > "which mouse" is installed).
I did some digging in the "screen" source code, and determined that when screen receives DECSET with one of the mouse-reporting params (9, 1000, 1001), it first checks (using the stupid name magic, unless the user happens to be using termcap instead of terminfo, and has the "special" screen extension for xterm included) which of the terminals connected to a session (there may be more than one) support the xterm controls, and then sets mouse mode on the terminals that have been detected as xterms corresponding to the sequence it got. Then all sequences that the terminal sends get passed through to the application. For those terminals that are not detected as xterms (have either the string "xterm" or "rxvt" in the terminal name), the mode is not sent through at all. Therefore, there would seem to be no harm whatsoever in detecting screen as an xterm-mouse-code-capable terminal, and sending the mouse-mode sequence ("xterm" protocol, since AFAIK screen provides no way to detect the underlying xterm version). If the underlying terminal claims to be xterm or rxvt, then the user will automatically get the benefit of mouse support without trouble; otherwise, screen will simply ignore the sequence and no harm is done to other terminals (such as unrecognized sequence-emitters, or DEC-mouse-only terminals). I propose that rather than using vim_is_xterm() to determine xterm-style mouse support, a separate function, vim_supports_xterm_mouse() [or somesuch] be used, which would currently return (vim_is_xterm() || <<terminal is screen>>). -- Micah J. Cowan Programmer, musician, typesetting enthusiast, gamer... http://micah.cowan.name/
signature.asc
Description: OpenPGP digital signature