@@ -4546,6 +4546,9 @@ check_termcode(
45464546 if (tp [1 + (tp [0 ] != CSI )] == '>' && semicols == 2 )
45474547 {
45484548 int need_flush = FALSE;
4549+ # ifdef FEAT_MOUSE_SGR
4550+ int is_iterm2 = FALSE;
4551+ # endif
45494552
45504553 /* if xterm version >= 141 try to get termcap codes */
45514554 if (version >= 141 )
@@ -4573,12 +4576,29 @@ check_termcode(
45734576# endif
45744577 }
45754578
4579+ if (version == 95 )
4580+ {
4581+ /* Mac Terminal.app sends 1;95;0 */
4582+ if (STRNCMP (tp + extra - 2 , "1;95;0c" , 7 ) == 0 )
4583+ {
4584+ is_not_xterm = TRUE;
4585+ is_mac_terminal = TRUE;
4586+ }
4587+ # ifdef FEAT_MOUSE_SGR
4588+ /* Iterm2 sends 0;95;0 */
4589+ if (STRNCMP (tp + extra - 2 , "0;95;0c" , 7 ) == 0 )
4590+ is_iterm2 = TRUE;
4591+ # endif
4592+ }
4593+
45764594 /* Only set 'ttymouse' automatically if it was not set
45774595 * by the user already. */
45784596 if (!option_was_set ((char_u * )"ttym" ))
45794597 {
45804598# ifdef FEAT_MOUSE_SGR
4581- if (version >= 277 )
4599+ /* Xterm version 277 supports SGR. Also support
4600+ * Terminal.app and iterm2. */
4601+ if (version >= 277 || is_iterm2 || is_mac_terminal )
45824602 set_option_value ((char_u * )"ttym" , 0L ,
45834603 (char_u * )"sgr" , 0 );
45844604 else
@@ -4593,14 +4613,6 @@ check_termcode(
45934613 * "xterm-256colors" but are not fully xterm
45944614 * compatible. */
45954615
4596- /* Mac Terminal.app sends 1;95;0 */
4597- if (version == 95
4598- && STRNCMP (tp + extra - 2 , "1;95;0c" , 7 ) == 0 )
4599- {
4600- is_not_xterm = TRUE;
4601- is_mac_terminal = TRUE;
4602- }
4603-
46044616 /* Gnome terminal sends 1;3801;0, 1;4402;0 or 1;2501;0.
46054617 * xfce4-terminal sends 1;2802;0.
46064618 * screen sends 83;40500;0
0 commit comments