updated for version 7.3.632
Problem:    Cannot select beyond 222 columns with the mouse in xterm.
Solution:   Add support for SGR mouse tracking. (Hayaki Saito)
diff --git a/src/os_unix.c b/src/os_unix.c
index 860fbcc..98ff1ea 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2159,10 +2159,13 @@
  * Return 1 for "xterm".
  * Return 2 for "xterm2".
  * Return 3 for "urxvt".
+ * Return 4 for "sgr".
  */
     int
 use_xterm_mouse()
 {
+    if (ttym_flags == TTYM_SGR)
+	return 4;
     if (ttym_flags == TTYM_URXVT)
 	return 3;
     if (ttym_flags == TTYM_XTERM2)
@@ -3339,7 +3342,8 @@
     xterm_mouse_vers = use_xterm_mouse();
 
 # ifdef FEAT_MOUSE_URXVT
-    if (ttym_flags == TTYM_URXVT) {
+    if (ttym_flags == TTYM_URXVT)
+    {
 	out_str_nf((char_u *)
 		   (on
 		   ? IF_EB("\033[?1015h", ESC_STR "[?1015h")
@@ -3348,6 +3352,17 @@
     }
 # endif
 
+# ifdef FEAT_MOUSE_SGR
+    if (ttym_flags == TTYM_SGR)
+    {
+	out_str_nf((char_u *)
+		   (on
+		   ? IF_EB("\033[?1006h", ESC_STR "[?1006h")
+		   : IF_EB("\033[?1006l", ESC_STR "[?1006l")));
+	ison = on;
+    }
+# endif
+
     if (xterm_mouse_vers > 0)
     {
 	if (on)	/* enable mouse events, use mouse tracking if available */
@@ -3577,6 +3592,27 @@
     else
 	del_mouse_termcode(KS_URXVT_MOUSE);
 # endif
+# ifdef FEAT_MOUSE_SGR
+    /* same as the dec mouse */
+    if (use_xterm_mouse() == 4
+#  ifdef FEAT_GUI
+	    && !gui.in_use
+#  endif
+	    )
+    {
+	set_mouse_termcode(KS_SGR_MOUSE, (char_u *)(term_is_8bit(T_NAME)
+		    ? IF_EB("\233<", CSI_STR "<")
+		    : IF_EB("\033[<", ESC_STR "[<")));
+
+	if (*p_mouse != NUL)
+	{
+	    mch_setmouse(FALSE);
+	    setmouse();
+	}
+    }
+    else
+	del_mouse_termcode(KS_SGR_MOUSE);
+# endif
 }
 #endif