]> granicus.if.org Git - vim/commitdiff
patch 8.0.1258: 'ttymouse' is set to "sgr" even though it's not supported v8.0.1258
authorBram Moolenaar <Bram@vim.org>
Sat, 4 Nov 2017 14:16:56 +0000 (15:16 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 4 Nov 2017 14:16:56 +0000 (15:16 +0100)
Problem:    'ttymouse' is set to "sgr" even though it's not supported. (Gary
            Johnson)
Solution:   Adjust #ifdef

src/term.c
src/version.c

index 8df5e02ec72e1f019abf4e8f82cebe8f731a517d..977987c2b39bc96d0c06d45812979a24af6da2c3 100644 (file)
@@ -4547,22 +4547,6 @@ check_termcode(
                    {
                        int need_flush = FALSE;
 
-                       /* Only set 'ttymouse' automatically if it was not set
-                        * by the user already. */
-                       if (!option_was_set((char_u *)"ttym"))
-                       {
-# ifdef TTYM_SGR
-                           if (version >= 277)
-                               set_option_value((char_u *)"ttym", 0L,
-                                                         (char_u *)"sgr", 0);
-                           else
-# endif
-                           /* if xterm version >= 95 use mouse dragging */
-                           if (version >= 95)
-                               set_option_value((char_u *)"ttym", 0L,
-                                                      (char_u *)"xterm2", 0);
-                       }
-
                        /* if xterm version >= 141 try to get termcap codes */
                        if (version >= 141)
                        {
@@ -4581,6 +4565,28 @@ check_termcode(
                             * 256, libvterm supports even more. */
                            if (mch_getenv((char_u *)"COLORS") == NULL)
                                may_adjust_color_count(256);
+# ifdef FEAT_MOUSE_SGR
+                           /* Libvterm can handle SGR mouse reporting. */
+                           if (!option_was_set((char_u *)"ttym"))
+                               set_option_value((char_u *)"ttym", 0L,
+                                                          (char_u *)"sgr", 0);
+# endif
+                       }
+
+                       /* Only set 'ttymouse' automatically if it was not set
+                        * by the user already. */
+                       if (!option_was_set((char_u *)"ttym"))
+                       {
+# ifdef FEAT_MOUSE_SGR
+                           if (version >= 277)
+                               set_option_value((char_u *)"ttym", 0L,
+                                                         (char_u *)"sgr", 0);
+                           else
+# endif
+                           /* if xterm version >= 95 use mouse dragging */
+                           if (version >= 95)
+                               set_option_value((char_u *)"ttym", 0L,
+                                                      (char_u *)"xterm2", 0);
                        }
 
                        /* Detect terminals that set $TERM to something like
index 65f5a4b03ac3ee6915fb1dce412a93283d473b83..f28132cf9a7a06c0b614c28029c62fcc74af1807 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1258,
 /**/
     1257,
 /**/