mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.1.1034: too many #ifdefs
Problem: Too many #ifdefs. Solution: Merge FEAT_MOUSE_SGR into FEAT_MOUSE_XTERM / FEAT_MOUSE_TTY.
This commit is contained in:
@@ -6414,7 +6414,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
# ifdef FEAT_MOUSE_PTERM
|
# ifdef FEAT_MOUSE_PTERM
|
||||||
"mouse_pterm",
|
"mouse_pterm",
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_MOUSE_SGR
|
# ifdef FEAT_MOUSE_XTERM
|
||||||
"mouse_sgr",
|
"mouse_sgr",
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_SYSMOUSE
|
# ifdef FEAT_SYSMOUSE
|
||||||
|
@@ -1026,9 +1026,6 @@
|
|||||||
# ifdef FEAT_BIG
|
# ifdef FEAT_BIG
|
||||||
# define FEAT_MOUSE_URXVT
|
# define FEAT_MOUSE_URXVT
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_BIG
|
|
||||||
# define FEAT_MOUSE_SGR
|
|
||||||
# endif
|
|
||||||
# if defined(FEAT_NORMAL) && defined(MSWIN)
|
# if defined(FEAT_NORMAL) && defined(MSWIN)
|
||||||
# define DOS_MOUSE
|
# define DOS_MOUSE
|
||||||
# endif
|
# endif
|
||||||
@@ -1057,11 +1054,6 @@
|
|||||||
# define FEAT_MOUSE_XTERM
|
# define FEAT_MOUSE_XTERM
|
||||||
#endif
|
#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. */
|
/* Define FEAT_MOUSE when any of the above is defined or FEAT_GUI. */
|
||||||
#if !defined(FEAT_MOUSE_TTY) \
|
#if !defined(FEAT_MOUSE_TTY) \
|
||||||
&& (defined(FEAT_MOUSE_XTERM) \
|
&& (defined(FEAT_MOUSE_XTERM) \
|
||||||
@@ -1072,8 +1064,7 @@
|
|||||||
|| defined(FEAT_MOUSE_JSB) \
|
|| defined(FEAT_MOUSE_JSB) \
|
||||||
|| defined(FEAT_MOUSE_PTERM) \
|
|| defined(FEAT_MOUSE_PTERM) \
|
||||||
|| defined(FEAT_SYSMOUSE) \
|
|| defined(FEAT_SYSMOUSE) \
|
||||||
|| defined(FEAT_MOUSE_URXVT) \
|
|| defined(FEAT_MOUSE_URXVT))
|
||||||
|| defined(FEAT_MOUSE_SGR))
|
|
||||||
# define FEAT_MOUSE_TTY /* include non-GUI mouse support */
|
# define FEAT_MOUSE_TTY /* include non-GUI mouse support */
|
||||||
#endif
|
#endif
|
||||||
#if !defined(FEAT_MOUSE) && (defined(FEAT_MOUSE_TTY) || defined(FEAT_GUI))
|
#if !defined(FEAT_MOUSE) && (defined(FEAT_MOUSE_TTY) || defined(FEAT_GUI))
|
||||||
|
@@ -2453,10 +2453,8 @@ static struct key_name_entry
|
|||||||
#ifdef FEAT_MOUSE_URXVT
|
#ifdef FEAT_MOUSE_URXVT
|
||||||
{K_URXVT_MOUSE, (char_u *)"UrxvtMouse"},
|
{K_URXVT_MOUSE, (char_u *)"UrxvtMouse"},
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_MOUSE_SGR
|
|
||||||
{K_SGR_MOUSE, (char_u *)"SgrMouse"},
|
{K_SGR_MOUSE, (char_u *)"SgrMouse"},
|
||||||
{K_SGR_MOUSERELEASE, (char_u *)"SgrMouseRelelase"},
|
{K_SGR_MOUSERELEASE, (char_u *)"SgrMouseRelelase"},
|
||||||
#endif
|
|
||||||
{K_LEFTMOUSE, (char_u *)"LeftMouse"},
|
{K_LEFTMOUSE, (char_u *)"LeftMouse"},
|
||||||
{K_LEFTMOUSE_NM, (char_u *)"LeftMouseNM"},
|
{K_LEFTMOUSE_NM, (char_u *)"LeftMouseNM"},
|
||||||
{K_LEFTDRAG, (char_u *)"LeftDrag"},
|
{K_LEFTDRAG, (char_u *)"LeftDrag"},
|
||||||
|
@@ -3596,7 +3596,6 @@ mch_setmouse(int on)
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef FEAT_MOUSE_SGR
|
|
||||||
if (ttym_flags == TTYM_SGR)
|
if (ttym_flags == TTYM_SGR)
|
||||||
{
|
{
|
||||||
/* SGR mode supports columns above 223 */
|
/* SGR mode supports columns above 223 */
|
||||||
@@ -3606,7 +3605,6 @@ mch_setmouse(int on)
|
|||||||
: IF_EB("\033[?1006l", ESC_STR "[?1006l")));
|
: IF_EB("\033[?1006l", ESC_STR "[?1006l")));
|
||||||
mouse_ison = on;
|
mouse_ison = on;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef FEAT_BEVAL_TERM
|
# ifdef FEAT_BEVAL_TERM
|
||||||
if (bevalterm_ison != (p_bevalterm && on))
|
if (bevalterm_ison != (p_bevalterm && on))
|
||||||
@@ -3864,7 +3862,6 @@ check_mouse_termcode(void)
|
|||||||
else
|
else
|
||||||
del_mouse_termcode(KS_URXVT_MOUSE);
|
del_mouse_termcode(KS_URXVT_MOUSE);
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_MOUSE_SGR
|
|
||||||
if (use_xterm_mouse() == 4
|
if (use_xterm_mouse() == 4
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
&& !gui.in_use
|
&& !gui.in_use
|
||||||
@@ -3890,7 +3887,6 @@ check_mouse_termcode(void)
|
|||||||
del_mouse_termcode(KS_SGR_MOUSE);
|
del_mouse_termcode(KS_SGR_MOUSE);
|
||||||
del_mouse_termcode(KS_SGR_MOUSE_RELEASE);
|
del_mouse_termcode(KS_SGR_MOUSE_RELEASE);
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
30
src/term.c
30
src/term.c
@@ -2126,13 +2126,11 @@ set_mouse_termcode(
|
|||||||
has_mouse_termcode |= HMT_URXVT;
|
has_mouse_termcode |= HMT_URXVT;
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_MOUSE_SGR
|
|
||||||
if (n == KS_SGR_MOUSE)
|
if (n == KS_SGR_MOUSE)
|
||||||
has_mouse_termcode |= HMT_SGR;
|
has_mouse_termcode |= HMT_SGR;
|
||||||
else if (n == KS_SGR_MOUSE_RELEASE)
|
else if (n == KS_SGR_MOUSE_RELEASE)
|
||||||
has_mouse_termcode |= HMT_SGR_REL;
|
has_mouse_termcode |= HMT_SGR_REL;
|
||||||
else
|
else
|
||||||
# endif
|
|
||||||
has_mouse_termcode |= HMT_NORMAL;
|
has_mouse_termcode |= HMT_NORMAL;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
@@ -2175,13 +2173,11 @@ del_mouse_termcode(
|
|||||||
has_mouse_termcode &= ~HMT_URXVT;
|
has_mouse_termcode &= ~HMT_URXVT;
|
||||||
else
|
else
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_MOUSE_SGR
|
|
||||||
if (n == KS_SGR_MOUSE)
|
if (n == KS_SGR_MOUSE)
|
||||||
has_mouse_termcode &= ~HMT_SGR;
|
has_mouse_termcode &= ~HMT_SGR;
|
||||||
else if (n == KS_SGR_MOUSE_RELEASE)
|
else if (n == KS_SGR_MOUSE_RELEASE)
|
||||||
has_mouse_termcode &= ~HMT_SGR_REL;
|
has_mouse_termcode &= ~HMT_SGR_REL;
|
||||||
else
|
else
|
||||||
# endif
|
|
||||||
has_mouse_termcode &= ~HMT_NORMAL;
|
has_mouse_termcode &= ~HMT_NORMAL;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
@@ -4690,7 +4686,6 @@ check_termcode(
|
|||||||
if (tp[1 + (tp[0] != CSI)] == '>' && semicols == 2)
|
if (tp[1 + (tp[0] != CSI)] == '>' && semicols == 2)
|
||||||
{
|
{
|
||||||
int need_flush = FALSE;
|
int need_flush = FALSE;
|
||||||
# ifdef FEAT_MOUSE_SGR
|
|
||||||
int is_iterm2 = FALSE;
|
int is_iterm2 = FALSE;
|
||||||
int is_mintty = FALSE;
|
int is_mintty = FALSE;
|
||||||
|
|
||||||
@@ -4698,7 +4693,6 @@ check_termcode(
|
|||||||
// (77 is ASCII 'M' for mintty.)
|
// (77 is ASCII 'M' for mintty.)
|
||||||
if (STRNCMP(tp + extra - 3, "77;", 3) == 0)
|
if (STRNCMP(tp + extra - 3, "77;", 3) == 0)
|
||||||
is_mintty = TRUE;
|
is_mintty = TRUE;
|
||||||
# endif
|
|
||||||
|
|
||||||
/* if xterm version >= 141 try to get termcap codes */
|
/* if xterm version >= 141 try to get termcap codes */
|
||||||
if (version >= 141)
|
if (version >= 141)
|
||||||
@@ -4718,12 +4712,10 @@ check_termcode(
|
|||||||
* 256, libvterm supports even more. */
|
* 256, libvterm supports even more. */
|
||||||
if (mch_getenv((char_u *)"COLORS") == NULL)
|
if (mch_getenv((char_u *)"COLORS") == NULL)
|
||||||
may_adjust_color_count(256);
|
may_adjust_color_count(256);
|
||||||
# ifdef FEAT_MOUSE_SGR
|
|
||||||
/* Libvterm can handle SGR mouse reporting. */
|
/* Libvterm can handle SGR mouse reporting. */
|
||||||
if (!option_was_set((char_u *)"ttym"))
|
if (!option_was_set((char_u *)"ttym"))
|
||||||
set_option_value((char_u *)"ttym", 0L,
|
set_option_value((char_u *)"ttym", 0L,
|
||||||
(char_u *)"sgr", 0);
|
(char_u *)"sgr", 0);
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version == 95)
|
if (version == 95)
|
||||||
@@ -4734,14 +4726,11 @@ check_termcode(
|
|||||||
is_not_xterm = TRUE;
|
is_not_xterm = TRUE;
|
||||||
is_mac_terminal = TRUE;
|
is_mac_terminal = TRUE;
|
||||||
}
|
}
|
||||||
# ifdef FEAT_MOUSE_SGR
|
|
||||||
// iTerm2 sends 0;95;0
|
// iTerm2 sends 0;95;0
|
||||||
if (STRNCMP(tp + extra - 2, "0;95;0c", 7) == 0)
|
if (STRNCMP(tp + extra - 2, "0;95;0c", 7) == 0)
|
||||||
is_iterm2 = TRUE;
|
is_iterm2 = TRUE;
|
||||||
else
|
|
||||||
# endif
|
|
||||||
// old iTerm2 sends 0;95;
|
// 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;
|
is_not_xterm = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4749,17 +4738,14 @@ check_termcode(
|
|||||||
* by the user already. */
|
* by the user already. */
|
||||||
if (!option_was_set((char_u *)"ttym"))
|
if (!option_was_set((char_u *)"ttym"))
|
||||||
{
|
{
|
||||||
# ifdef FEAT_MOUSE_SGR
|
|
||||||
/* Xterm version 277 supports SGR. Also support
|
/* Xterm version 277 supports SGR. Also support
|
||||||
* Terminal.app, iTerm2 and mintty. */
|
* Terminal.app, iTerm2 and mintty. */
|
||||||
if (version >= 277 || is_iterm2 || is_mac_terminal
|
if (version >= 277 || is_iterm2 || is_mac_terminal
|
||||||
|| is_mintty)
|
|| is_mintty)
|
||||||
set_option_value((char_u *)"ttym", 0L,
|
set_option_value((char_u *)"ttym", 0L,
|
||||||
(char_u *)"sgr", 0);
|
(char_u *)"sgr", 0);
|
||||||
else
|
|
||||||
# endif
|
|
||||||
/* if xterm version >= 95 use mouse dragging */
|
/* if xterm version >= 95 use mouse dragging */
|
||||||
if (version >= 95)
|
else if (version >= 95)
|
||||||
set_option_value((char_u *)"ttym", 0L,
|
set_option_value((char_u *)"ttym", 0L,
|
||||||
(char_u *)"xterm2", 0);
|
(char_u *)"xterm2", 0);
|
||||||
}
|
}
|
||||||
@@ -5127,11 +5113,8 @@ check_termcode(
|
|||||||
# ifdef FEAT_MOUSE_URXVT
|
# ifdef FEAT_MOUSE_URXVT
|
||||||
|| key_name[0] == KS_URXVT_MOUSE
|
|| key_name[0] == KS_URXVT_MOUSE
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_MOUSE_SGR
|
|
||||||
|| key_name[0] == KS_SGR_MOUSE
|
|| key_name[0] == KS_SGR_MOUSE
|
||||||
|| key_name[0] == KS_SGR_MOUSE_RELEASE
|
|| key_name[0] == KS_SGR_MOUSE_RELEASE)
|
||||||
# endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
is_click = is_drag = FALSE;
|
is_click = is_drag = FALSE;
|
||||||
|
|
||||||
@@ -5213,7 +5196,6 @@ check_termcode(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(FEAT_MOUSE_URXVT) || defined(FEAT_MOUSE_SGR)
|
|
||||||
if (key_name[0] == KS_URXVT_MOUSE
|
if (key_name[0] == KS_URXVT_MOUSE
|
||||||
|| key_name[0] == KS_SGR_MOUSE
|
|| key_name[0] == KS_SGR_MOUSE
|
||||||
|| key_name[0] == KS_SGR_MOUSE_RELEASE)
|
|| key_name[0] == KS_SGR_MOUSE_RELEASE)
|
||||||
@@ -5267,17 +5249,13 @@ check_termcode(
|
|||||||
* modifier keys (alt/shift/ctrl/meta) state. */
|
* modifier keys (alt/shift/ctrl/meta) state. */
|
||||||
modifiers = 0;
|
modifiers = 0;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
|
|
||||||
if (key_name[0] == (int)KS_MOUSE
|
if (key_name[0] == (int)KS_MOUSE
|
||||||
# ifdef FEAT_MOUSE_URXVT
|
# ifdef FEAT_MOUSE_URXVT
|
||||||
|| key_name[0] == (int)KS_URXVT_MOUSE
|
|| key_name[0] == (int)KS_URXVT_MOUSE
|
||||||
# endif
|
# endif
|
||||||
#ifdef FEAT_MOUSE_SGR
|
|
||||||
|| key_name[0] == KS_SGR_MOUSE
|
|| key_name[0] == KS_SGR_MOUSE
|
||||||
|| key_name[0] == KS_SGR_MOUSE_RELEASE
|
|| key_name[0] == KS_SGR_MOUSE_RELEASE)
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
# if !defined(MSWIN)
|
# if !defined(MSWIN)
|
||||||
/*
|
/*
|
||||||
|
@@ -426,7 +426,7 @@ static char *(features[]) =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(UNIX) || defined(VMS)
|
#if defined(UNIX) || defined(VMS)
|
||||||
# ifdef FEAT_MOUSE_SGR
|
# ifdef FEAT_MOUSE_XTERM
|
||||||
"+mouse_sgr",
|
"+mouse_sgr",
|
||||||
# else
|
# else
|
||||||
"-mouse_sgr",
|
"-mouse_sgr",
|
||||||
@@ -779,6 +779,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1034,
|
||||||
/**/
|
/**/
|
||||||
1033,
|
1033,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user