I wrote:
> 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).

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. :)

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/
Index: os_unix.c
===================================================================
--- os_unix.c	(revision 276)
+++ os_unix.c	(working copy)
@@ -2034,6 +2034,21 @@
 		|| STRCMP(name, "builtin_xterm") == 0);
 }
 
+/*
+ * Return TRUE if "name" appears to be that of a terminal
+ * known to support the xterm-style mouse protocol.
+ * Relies on term_is_xterm having been set to its correct value.
+ */
+    int
+vim_uses_xterm_mouse(name)
+    char_u *name;
+{
+    if (name == NULL)
+	return FALSE;
+    return (STRNICMP(name, "screen", 6) == 0
+		|| term_is_xterm);
+}
+
 #if defined(FEAT_MOUSE_TTY) || defined(PROTO)
 /*
  * Return non-zero when using an xterm mouse, according to 'ttymouse'.
Index: term.c
===================================================================
--- term.c	(revision 276)
+++ term.c	(working copy)
@@ -1601,6 +1601,9 @@
     int		try;
     int		termcap_cleared = FALSE;
 #endif
+#if defined(UNIX) || defined(VMS)
+    int		term_uses_xterm_mouse;
+#endif
     int		width = 0, height = 0;
     char_u	*error_msg = NULL;
     char_u	*bs_p, *del_p;
@@ -1903,6 +1906,7 @@
 
 #if defined(UNIX) || defined(VMS)
     term_is_xterm = vim_is_xterm(term);
+    term_uses_xterm_mouse = vim_uses_xterm_mouse(term);
 #endif
 
 #ifdef FEAT_MOUSE
@@ -1923,7 +1927,7 @@
 #    endif
 	    clip_init(FALSE);
 #   endif
-	if (term_is_xterm)
+	if (term_uses_xterm_mouse)
 	{
 	    if (use_xterm_mouse())
 		p = NULL;	/* keep existing value, might be "xterm2" */

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to