]> granicus.if.org Git - vim/commitdiff
patch 8.1.1034: too many #ifdefs v8.1.1034
authorBram Moolenaar <Bram@vim.org>
Fri, 22 Mar 2019 11:03:30 +0000 (12:03 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 22 Mar 2019 11:03:30 +0000 (12:03 +0100)
Problem:    Too many #ifdefs.
Solution:   Merge FEAT_MOUSE_SGR into FEAT_MOUSE_XTERM / FEAT_MOUSE_TTY.

src/evalfunc.c
src/feature.h
src/misc2.c
src/os_unix.c
src/term.c
src/version.c

index f5d1da73b86a07fb7889af5a97a093ad80648821..f5a0bd8b5db4717886c5507f9f7d43abdbcd5096 100644 (file)
@@ -6414,7 +6414,7 @@ f_has(typval_T *argvars, typval_T *rettv)
 # ifdef FEAT_MOUSE_PTERM
        "mouse_pterm",
 # endif
-# ifdef FEAT_MOUSE_SGR
+# ifdef FEAT_MOUSE_XTERM
        "mouse_sgr",
 # endif
 # ifdef FEAT_SYSMOUSE
index 284c8e0801cd03a52a1e07320f5e8a6791acb114..e16fc62269501a8e40ed37a64c76aa4d6070fffa 100644 (file)
 # ifdef FEAT_BIG
 #  define FEAT_MOUSE_URXVT
 # endif
-# ifdef FEAT_BIG
-#  define FEAT_MOUSE_SGR
-# endif
 # if defined(FEAT_NORMAL) && defined(MSWIN)
 #  define DOS_MOUSE
 # endif
 # define FEAT_MOUSE_XTERM
 #endif
 
-/* sgr is a small variation of mouse_xterm, and shares its code */
-#if defined(FEAT_MOUSE_SGR) && !defined(FEAT_MOUSE_XTERM)
-# define FEAT_MOUSE_XTERM
-#endif
-
 /* Define FEAT_MOUSE when any of the above is defined or FEAT_GUI. */
 #if !defined(FEAT_MOUSE_TTY) \
        && (defined(FEAT_MOUSE_XTERM) \
            || defined(FEAT_MOUSE_JSB) \
            || defined(FEAT_MOUSE_PTERM) \
            || defined(FEAT_SYSMOUSE) \
-           || defined(FEAT_MOUSE_URXVT) \
-           || defined(FEAT_MOUSE_SGR))
+           || defined(FEAT_MOUSE_URXVT))
 # define FEAT_MOUSE_TTY                /* include non-GUI mouse support */
 #endif
 #if !defined(FEAT_MOUSE) && (defined(FEAT_MOUSE_TTY) || defined(FEAT_GUI))
index e513c1b61db2f55250e229c4c90f9779ec2dfdad..30ac958955ab397c36055f61c54908bd37d589fd 100644 (file)
@@ -2453,10 +2453,8 @@ static struct key_name_entry
 #ifdef FEAT_MOUSE_URXVT
     {K_URXVT_MOUSE,    (char_u *)"UrxvtMouse"},
 #endif
-#ifdef FEAT_MOUSE_SGR
     {K_SGR_MOUSE,      (char_u *)"SgrMouse"},
     {K_SGR_MOUSERELEASE, (char_u *)"SgrMouseRelelase"},
-#endif
     {K_LEFTMOUSE,      (char_u *)"LeftMouse"},
     {K_LEFTMOUSE_NM,   (char_u *)"LeftMouseNM"},
     {K_LEFTDRAG,       (char_u *)"LeftDrag"},
index 0d9f69e53fc3e8615ae54325536c7085817bac0f..b3982979b18992b616f934bf3f0fb874f9111f68 100644 (file)
@@ -3596,7 +3596,6 @@ mch_setmouse(int on)
     }
 # endif
 
-# ifdef FEAT_MOUSE_SGR
     if (ttym_flags == TTYM_SGR)
     {
        /* SGR mode supports columns above 223 */
@@ -3606,7 +3605,6 @@ mch_setmouse(int on)
                   : IF_EB("\033[?1006l", ESC_STR "[?1006l")));
        mouse_ison = on;
     }
-# endif
 
 # ifdef FEAT_BEVAL_TERM
     if (bevalterm_ison != (p_bevalterm && on))
@@ -3864,11 +3862,10 @@ check_mouse_termcode(void)
     else
        del_mouse_termcode(KS_URXVT_MOUSE);
 # endif
-# ifdef FEAT_MOUSE_SGR
     if (use_xterm_mouse() == 4
-#  ifdef FEAT_GUI
+# ifdef FEAT_GUI
            && !gui.in_use
-#  endif
+# endif
            )
     {
        set_mouse_termcode(KS_SGR_MOUSE, (char_u *)(term_is_8bit(T_NAME)
@@ -3890,7 +3887,6 @@ check_mouse_termcode(void)
        del_mouse_termcode(KS_SGR_MOUSE);
        del_mouse_termcode(KS_SGR_MOUSE_RELEASE);
     }
-# endif
 }
 #endif
 
index 8ee9264da416fe6a847818aa579fb1fabee4f33e..c058171814e04557d7cd963d5986c9d551f4cbf9 100644 (file)
@@ -2126,13 +2126,11 @@ set_mouse_termcode(
        has_mouse_termcode |= HMT_URXVT;
     else
 #   endif
-#   ifdef FEAT_MOUSE_SGR
     if (n == KS_SGR_MOUSE)
        has_mouse_termcode |= HMT_SGR;
     else if (n == KS_SGR_MOUSE_RELEASE)
        has_mouse_termcode |= HMT_SGR_REL;
     else
-#   endif
        has_mouse_termcode |= HMT_NORMAL;
 #  endif
 }
@@ -2175,13 +2173,11 @@ del_mouse_termcode(
        has_mouse_termcode &= ~HMT_URXVT;
     else
 #   endif
-#   ifdef FEAT_MOUSE_SGR
     if (n == KS_SGR_MOUSE)
        has_mouse_termcode &= ~HMT_SGR;
     else if (n == KS_SGR_MOUSE_RELEASE)
        has_mouse_termcode &= ~HMT_SGR_REL;
     else
-#   endif
        has_mouse_termcode &= ~HMT_NORMAL;
 #  endif
 }
@@ -4690,7 +4686,6 @@ check_termcode(
                    if (tp[1 + (tp[0] != CSI)] == '>' && semicols == 2)
                    {
                        int need_flush = FALSE;
-# ifdef FEAT_MOUSE_SGR
                        int is_iterm2 = FALSE;
                        int is_mintty = FALSE;
 
@@ -4698,7 +4693,6 @@ check_termcode(
                        // (77 is ASCII 'M' for mintty.)
                        if (STRNCMP(tp + extra - 3, "77;", 3) == 0)
                            is_mintty = TRUE;
-# endif
 
                        /* if xterm version >= 141 try to get termcap codes */
                        if (version >= 141)
@@ -4718,12 +4712,10 @@ 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
                        }
 
                        if (version == 95)
@@ -4734,14 +4726,11 @@ check_termcode(
                                is_not_xterm = TRUE;
                                is_mac_terminal = TRUE;
                            }
-# ifdef FEAT_MOUSE_SGR
                            // iTerm2 sends 0;95;0
                            if (STRNCMP(tp + extra - 2, "0;95;0c", 7) == 0)
                                is_iterm2 = TRUE;
-                           else
-# endif
                            // old iTerm2 sends 0;95;
-                           if (STRNCMP(tp + extra - 2, "0;95;c", 6) == 0)
+                           else if (STRNCMP(tp + extra - 2, "0;95;c", 6) == 0)
                                is_not_xterm = TRUE;
                        }
 
@@ -4749,17 +4738,14 @@ check_termcode(
                         * by the user already. */
                        if (!option_was_set((char_u *)"ttym"))
                        {
-# ifdef FEAT_MOUSE_SGR
                            /* Xterm version 277 supports SGR.  Also support
                             * Terminal.app, iTerm2 and mintty. */
                            if (version >= 277 || is_iterm2 || is_mac_terminal
                                    || is_mintty)
                                set_option_value((char_u *)"ttym", 0L,
                                                          (char_u *)"sgr", 0);
-                           else
-# endif
                            /* if xterm version >= 95 use mouse dragging */
-                           if (version >= 95)
+                           else if (version >= 95)
                                set_option_value((char_u *)"ttym", 0L,
                                                       (char_u *)"xterm2", 0);
                        }
@@ -5127,11 +5113,8 @@ check_termcode(
 # ifdef FEAT_MOUSE_URXVT
                || key_name[0] == KS_URXVT_MOUSE
 # endif
-# ifdef FEAT_MOUSE_SGR
                || key_name[0] == KS_SGR_MOUSE
-               || key_name[0] == KS_SGR_MOUSE_RELEASE
-# endif
-               )
+               || key_name[0] == KS_SGR_MOUSE_RELEASE)
        {
            is_click = is_drag = FALSE;
 
@@ -5163,7 +5146,7 @@ check_termcode(
                 */
                for (;;)
                {
-#ifdef FEAT_GUI
+#  ifdef FEAT_GUI
                    if (gui.in_use)
                    {
                        /* GUI uses more bits for columns > 223 */
@@ -5177,7 +5160,7 @@ check_termcode(
                                                         + bytes[4] - ' ' - 1;
                    }
                    else
-#endif
+#  endif
                    {
                        num_bytes = get_bytes_from_buf(tp + slen, bytes, 3);
                        if (num_bytes == -1)    /* not enough coordinates */
@@ -5191,21 +5174,21 @@ check_termcode(
                    /* If the following bytes is also a mouse code and it has
                     * the same code, dump this one and get the next.  This
                     * makes dragging a whole lot faster. */
-#ifdef FEAT_GUI
+#  ifdef FEAT_GUI
                    if (gui.in_use)
                        j = 3;
                    else
-#endif
+#  endif
                        j = termcodes[idx].len;
                    if (STRNCMP(tp, tp + slen, (size_t)j) == 0
                            && tp[slen + j] == mouse_code
                            && tp[slen + j + 1] != NUL
                            && tp[slen + j + 2] != NUL
-#ifdef FEAT_GUI
+#  ifdef FEAT_GUI
                            && (!gui.in_use
                                || (tp[slen + j + 3] != NUL
                                        && tp[slen + j + 4] != NUL))
-#endif
+#  endif
                            )
                        slen += j;
                    else
@@ -5213,7 +5196,6 @@ check_termcode(
                }
            }
 
-# if defined(FEAT_MOUSE_URXVT) || defined(FEAT_MOUSE_SGR)
            if (key_name[0] == KS_URXVT_MOUSE
                || key_name[0] == KS_SGR_MOUSE
                || key_name[0] == KS_SGR_MOUSE_RELEASE)
@@ -5267,17 +5249,13 @@ check_termcode(
                 * modifier keys (alt/shift/ctrl/meta) state. */
                modifiers = 0;
            }
-# endif
 
        if (key_name[0] == (int)KS_MOUSE
-#ifdef FEAT_MOUSE_URXVT
+#  ifdef FEAT_MOUSE_URXVT
            || key_name[0] == (int)KS_URXVT_MOUSE
-#endif
-#ifdef FEAT_MOUSE_SGR
+#  endif
            || key_name[0] == KS_SGR_MOUSE
-           || key_name[0] == KS_SGR_MOUSE_RELEASE
-#endif
-           )
+           || key_name[0] == KS_SGR_MOUSE_RELEASE)
        {
 #  if !defined(MSWIN)
                /*
index 277c84260c58eadf0c9ba7c07f6f5af8765f159f..9114570f87347447693e6ca3789aebe7a839ed35 100644 (file)
@@ -426,7 +426,7 @@ static char *(features[]) =
 #endif
 
 #if defined(UNIX) || defined(VMS)
-# ifdef FEAT_MOUSE_SGR
+# ifdef FEAT_MOUSE_XTERM
        "+mouse_sgr",
 # else
        "-mouse_sgr",
@@ -779,6 +779,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1034,
 /**/
     1033,
 /**/