diff -NprcC5 vim.91c52d4cb1be/src/term.c vim/src/term.c
*** vim.91c52d4cb1be/src/term.c	2012-09-19 19:22:02.000000000 +0900
--- vim/src/term.c	2012-09-19 19:22:02.000000000 +0900
*************** check_termcode(max_offset, buf, bufsize,
*** 4082,4101 ****
--- 4082,4107 ----
  # ifdef TTYM_SGR
  			if (extra >= 277
  # ifdef TTYM_URXVT
  				&& ttym_flags != TTYM_URXVT
  # endif
+ # ifdef TTYM_SGR
+ 				&& ttym_flags != TTYM_SGR
+ # endif
  				)
  			    set_option_value((char_u *)"ttym", 0L,
  							  (char_u *)"sgr", 0);
                          else
  # endif
  			/* if xterm version >= 95 use mouse dragging */
  			if (extra >= 95
  # ifdef TTYM_URXVT
  				&& ttym_flags != TTYM_URXVT
  # endif
+ # ifdef TTYM_SGR
+ 				&& ttym_flags != TTYM_SGR
+ # endif
  				)
  			    set_option_value((char_u *)"ttym", 0L,
  						       (char_u *)"xterm2", 0);
  			/* if xterm version >= 141 try to get termcap codes */
  			if (extra >= 141)
