0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.2171: mouse support not always available

Problem:    Mouse support not always available.
Solution:   Enable mouse support also in tiny version.  Do not define
            FEAT_MOUSE_XTERM on MS-Windows (didn't really work).
This commit is contained in:
Bram Moolenaar 2019-10-17 23:00:07 +02:00
parent 0d2c4bf171
commit a1cb1d1dce
25 changed files with 157 additions and 351 deletions

View File

@ -235,7 +235,6 @@ edit(
conceal_check_cursor_line();
#endif
#ifdef FEAT_MOUSE
/*
* When doing a paste with the middle mouse button, Insstart is set to
* where the paste started.
@ -243,7 +242,6 @@ edit(
if (where_paste_started.lnum != 0)
Insstart = where_paste_started;
else
#endif
{
Insstart = curwin->w_cursor;
if (startln)
@ -336,7 +334,6 @@ edit(
*/
if (restart_edit != 0 && stuff_empty())
{
#ifdef FEAT_MOUSE
/*
* After a paste we consider text typed to be part of the insert for
* the pasted text. You can backspace over the pasted text too.
@ -344,7 +341,6 @@ edit(
if (where_paste_started.lnum)
arrow_used = FALSE;
else
#endif
arrow_used = TRUE;
restart_edit = 0;
@ -381,9 +377,7 @@ edit(
/* Need to save the line for undo before inserting the first char. */
ins_need_undo = TRUE;
#ifdef FEAT_MOUSE
where_paste_started.lnum = 0;
#endif
#ifdef FEAT_CINDENT
can_cindent = TRUE;
#endif
@ -980,7 +974,6 @@ doESCkey:
inserted_space = FALSE;
break;
#ifdef FEAT_MOUSE
case K_LEFTMOUSE: /* mouse keys */
case K_LEFTMOUSE_NM:
case K_LEFTDRAG:
@ -1017,7 +1010,7 @@ doESCkey:
case K_MOUSERIGHT: /* Scroll wheel right */
ins_mousescroll(MSCR_RIGHT);
break;
#endif
case K_PS:
bracketed_paste(PASTE_INSERT, FALSE, NULL);
if (cmdchar == K_PS)

View File

@ -815,9 +815,7 @@ static funcentry_T global_functions[] =
#ifdef FEAT_GUI
{"test_scrollbar", 3, 3, FEARG_2, f_test_scrollbar},
#endif
#ifdef FEAT_MOUSE
{"test_setmouse", 2, 2, 0, f_test_setmouse},
#endif
{"test_settime", 1, 1, FEARG_1, f_test_settime},
#ifdef FEAT_TIMERS
{"timer_info", 0, 1, FEARG_1, f_timer_info},
@ -3433,9 +3431,7 @@ f_has(typval_T *argvars, typval_T *rettv)
"mksession",
#endif
"modify_fname",
#ifdef FEAT_MOUSE
"mouse",
#endif
#ifdef FEAT_MOUSESHAPE
"mouseshape",
#endif

View File

@ -795,11 +795,9 @@ getcmdline_int(
int save_msg_scroll = msg_scroll;
int save_State = State; /* remember State when called */
int some_key_typed = FALSE; /* one of the keys was typed */
#ifdef FEAT_MOUSE
/* mouse drag and release events are ignored, unless they are
* preceded with a mouse down event */
int ignore_drag_release = TRUE;
#endif
#ifdef FEAT_EVAL
int break_ctrl_c = FALSE;
#endif
@ -1856,7 +1854,6 @@ getcmdline_int(
break;
#endif
#ifdef FEAT_MOUSE
case K_MIDDLEDRAG:
case K_MIDDLERELEASE:
goto cmdline_not_changed; /* Ignore mouse */
@ -1961,8 +1958,6 @@ getcmdline_int(
case K_MOUSEMOVE:
goto cmdline_not_changed;
#endif /* FEAT_MOUSE */
#ifdef FEAT_GUI
case K_LEFTMOUSE_NM: /* mousefocus click, ignored */
case K_LEFTRELEASE_NM:
@ -2195,9 +2190,7 @@ getcmdline_int(
case Ctrl_V:
case Ctrl_Q:
#ifdef FEAT_MOUSE
ignore_drag_release = TRUE;
#endif
putcmdline('^', TRUE);
c = get_literal(); /* get next (two) character(s) */
do_abbr = FALSE; /* don't do abbreviation now */
@ -2213,9 +2206,7 @@ getcmdline_int(
#ifdef FEAT_DIGRAPHS
case Ctrl_K:
#ifdef FEAT_MOUSE
ignore_drag_release = TRUE;
#endif
putcmdline('?', TRUE);
# ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
@ -2227,7 +2218,7 @@ getcmdline_int(
redrawcmd();
goto cmdline_not_changed;
#endif /* FEAT_DIGRAPHS */
#endif // FEAT_DIGRAPHS
#ifdef FEAT_RIGHTLEFT
case Ctrl__: /* CTRL-_: switch language mode */

View File

@ -964,12 +964,12 @@
* console mouse handling.
* +mouse_urxvt Unix only: Include code for for urxvt mosue handling.
* +mouse Any mouse support (any of the above enabled).
* Always included, since either FEAT_MOUSE_XTERM or
* DOS_MOUSE is defined.
*/
/* OS/2 and Amiga console have no mouse support */
#if !defined(AMIGA)
# ifdef FEAT_NORMAL
#if defined(UNIX) || defined(VMS)
# define FEAT_MOUSE_XTERM
# endif
# ifdef FEAT_BIG
# define FEAT_MOUSE_NET
# endif
@ -979,13 +979,13 @@
# ifdef FEAT_BIG
# define FEAT_MOUSE_URXVT
# endif
# if defined(FEAT_NORMAL) && defined(MSWIN)
#endif
#if defined(MSWIN)
# define DOS_MOUSE
#endif
# if defined(FEAT_NORMAL) && defined(__QNX__)
#if defined(__QNX__)
# define FEAT_MOUSE_PTERM
#endif
#endif
/*
* Note: Only one of the following may be defined:
@ -1002,28 +1002,11 @@
# define FEAT_SYSMOUSE
#endif
/* urxvt is a small variation of mouse_xterm, and shares its code */
// urxvt is a small variation of mouse_xterm, and shares its code
#if defined(FEAT_MOUSE_URXVT) && !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_NET) \
|| defined(FEAT_MOUSE_DEC) \
|| defined(DOS_MOUSE) \
|| defined(FEAT_MOUSE_GPM) \
|| defined(FEAT_MOUSE_JSB) \
|| defined(FEAT_MOUSE_PTERM) \
|| defined(FEAT_SYSMOUSE) \
|| 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))
# define FEAT_MOUSE /* include generic mouse support */
#endif
/*
* +clipboard Clipboard support. Always used for the GUI.
* +xterm_clipboard Unix only: Include code for handling the clipboard
@ -1093,7 +1076,7 @@
* to check if mouse dragging can be used and if term
* codes can be obtained.
*/
#if (defined(FEAT_NORMAL) || defined(FEAT_MOUSE)) && defined(HAVE_TGETENT)
#if defined(HAVE_TGETENT)
# define FEAT_TERMRESPONSE
#endif

View File

@ -1325,10 +1325,8 @@ save_typebuf(void)
static int old_char = -1; /* character put back by vungetc() */
static int old_mod_mask; /* mod_mask for ungotten character */
#ifdef FEAT_MOUSE
static int old_mouse_row; /* mouse_row related to old_char */
static int old_mouse_col; /* mouse_col related to old_char */
#endif
/*
* Save all three kinds of typeahead, so that the user must type at a prompt.
@ -1559,10 +1557,8 @@ vgetc(void)
c = old_char;
old_char = -1;
mod_mask = old_mod_mask;
#ifdef FEAT_MOUSE
mouse_row = old_mouse_row;
mouse_col = old_mouse_col;
#endif
}
else
{
@ -2007,7 +2003,6 @@ f_getchar(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave(temp);
#ifdef FEAT_MOUSE
if (is_mouse_key(n))
{
int row = mouse_row;
@ -2039,7 +2034,6 @@ f_getchar(typval_T *argvars, typval_T *rettv)
set_vim_var_nr(VV_MOUSE_COL, col + 1);
}
}
#endif
}
}
@ -2636,10 +2630,8 @@ vungetc(int c)
{
old_char = c;
old_mod_mask = mod_mask;
#ifdef FEAT_MOUSE
old_mouse_row = mouse_row;
old_mouse_col = mouse_col;
#endif
}
/*

View File

@ -470,7 +470,6 @@ EXTERN bufref_T au_new_curbuf INIT(= {NULL COMMA 0 COMMA 0});
EXTERN buf_T *au_pending_free_buf INIT(= NULL);
EXTERN win_T *au_pending_free_win INIT(= NULL);
#ifdef FEAT_MOUSE
/*
* Mouse coordinates, set by check_termcode()
*/
@ -508,7 +507,6 @@ EXTERN int postponed_mouseshape INIT(= FALSE); // postponed updating the
EXTERN int drag_sep_line INIT(= FALSE); // dragging vert separator
# endif
#endif
#ifdef FEAT_DIFF
// Value set from 'diffopt'.
@ -785,13 +783,11 @@ EXTERN int resel_VIsual_mode INIT(= NUL); // 'v', 'V', or Ctrl-V
EXTERN linenr_T resel_VIsual_line_count; // number of lines
EXTERN colnr_T resel_VIsual_vcol; // nr of cols or end col
#ifdef FEAT_MOUSE
/*
* When pasting text with the middle mouse button in visual mode with
* restart_edit set, remember where it started so we can set Insstart.
*/
EXTERN pos_T where_paste_started;
#endif
/*
* This flag is used to make auto-indent work right on lines where only a

View File

@ -1200,7 +1200,6 @@ wait_return(int redraw)
#ifdef FEAT_GUI
|| c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR
#endif
#ifdef FEAT_MOUSE
|| c == K_LEFTDRAG || c == K_LEFTRELEASE
|| c == K_MIDDLEDRAG || c == K_MIDDLERELEASE
|| c == K_RIGHTDRAG || c == K_RIGHTRELEASE
@ -1214,19 +1213,15 @@ wait_return(int redraw)
|| c == K_RIGHTMOUSE
|| c == K_X1MOUSE
|| c == K_X2MOUSE))
#endif
);
ui_breakcheck();
#ifdef FEAT_MOUSE
/*
* Avoid that the mouse-up event causes visual mode to start.
*/
if (c == K_LEFTMOUSE || c == K_MIDDLEMOUSE || c == K_RIGHTMOUSE
|| c == K_X1MOUSE || c == K_X2MOUSE)
(void)jump_to_mouse(MOUSE_SETPOS, NULL, 0);
else
#endif
if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C)
else if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C)
{
/* Put the character back in the typeahead buffer. Don't use the
* stuff buffer, because lmaps wouldn't work. */

View File

@ -847,9 +847,7 @@ get_keystroke(void)
n = TO_SPECIAL(buf[1], buf[2]);
if (buf[1] == KS_MODIFIER
|| n == K_IGNORE
#ifdef FEAT_MOUSE
|| (is_mouse_key(n) && n != K_LEFTMOUSE)
#endif
#ifdef FEAT_GUI
|| n == K_VER_SCROLLBAR
|| n == K_HOR_SCROLLBAR
@ -929,14 +927,12 @@ get_number(
}
n /= 10;
}
#ifdef FEAT_MOUSE
else if (mouse_used != NULL && c == K_LEFTMOUSE)
{
*mouse_used = TRUE;
n = mouse_row + 1;
break;
}
#endif
else if (n == 0 && c == ':' && colon)
{
stuffcharReadbuff(':');

View File

@ -13,8 +13,6 @@
#include "vim.h"
#if defined(FEAT_MOUSE) || defined(PROTO)
/*
* Get class of a character for selection: same class means same word.
* 0: blank
@ -1258,7 +1256,6 @@ get_pseudo_mouse_code(
return (int)KE_IGNORE; // not recognized, ignore it
}
# ifdef FEAT_MOUSE_TTY
# define HMT_NORMAL 1
# define HMT_NETTERM 2
# define HMT_DEC 4
@ -1269,9 +1266,7 @@ get_pseudo_mouse_code(
# define HMT_SGR 128
# define HMT_SGR_REL 256
static int has_mouse_termcode = 0;
# endif
# if (!defined(UNIX) || defined(FEAT_MOUSE_TTY)) || defined(PROTO)
void
set_mouse_termcode(
int n, // KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE
@ -1282,7 +1277,6 @@ set_mouse_termcode(
name[0] = n;
name[1] = KE_FILLER;
add_termcode(name, s, FALSE);
# ifdef FEAT_MOUSE_TTY
# ifdef FEAT_MOUSE_JSB
if (n == KS_JSBTERM_MOUSE)
has_mouse_termcode |= HMT_JSBTERM;
@ -1319,12 +1313,9 @@ set_mouse_termcode(
has_mouse_termcode |= HMT_SGR_REL;
else
has_mouse_termcode |= HMT_NORMAL;
# endif
}
# endif
# if ((defined(UNIX) || defined(VMS)) \
&& defined(FEAT_MOUSE_TTY)) || defined(PROTO)
# if defined(UNIX) || defined(VMS) || defined(PROTO)
void
del_mouse_termcode(
int n) // KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE
@ -1334,7 +1325,6 @@ del_mouse_termcode(
name[0] = n;
name[1] = KE_FILLER;
del_termcode(name);
# ifdef FEAT_MOUSE_TTY
# ifdef FEAT_MOUSE_JSB
if (n == KS_JSBTERM_MOUSE)
has_mouse_termcode &= ~HMT_JSBTERM;
@ -1371,7 +1361,6 @@ del_mouse_termcode(
has_mouse_termcode &= ~HMT_SGR_REL;
else
has_mouse_termcode &= ~HMT_NORMAL;
# endif
}
# endif
@ -1381,15 +1370,13 @@ del_mouse_termcode(
void
setmouse(void)
{
# ifdef FEAT_MOUSE_TTY
int checkfor;
# endif
# ifdef FEAT_MOUSESHAPE
update_mouseshape(-1);
# endif
# ifdef FEAT_MOUSE_TTY // Should be outside proc, but may break MOUSESHAPE
// Should be outside proc, but may break MOUSESHAPE
# ifdef FEAT_GUI
// In the GUI the mouse is always enabled.
if (gui.in_use)
@ -1423,7 +1410,6 @@ setmouse(void)
mch_setmouse(TRUE);
else
mch_setmouse(FALSE);
# endif
}
/*
@ -2289,7 +2275,7 @@ check_termcode_mouse(
# endif
)
{
# if defined(UNIX) && defined(FEAT_MOUSE_TTY)
# if defined(UNIX)
if (use_xterm_mouse() > 1 && mouse_code >= 0x80)
// mouse-move event, using MOUSE_DRAG works
mouse_code = MOUSE_DRAG;
@ -2314,7 +2300,7 @@ check_termcode_mouse(
}
# endif
# if defined(UNIX) && defined(FEAT_MOUSE_TTY)
# if defined(UNIX)
else if (use_xterm_mouse() > 1)
{
if (mouse_code & MOUSE_DRAG_XTERM)
@ -2810,10 +2796,8 @@ check_termcode_mouse(
return 0;
}
#endif // FEAT_MOUSE
// Functions also used for popup windows.
#if defined(FEAT_MOUSE) || defined(FEAT_TEXT_PROP) || defined(PROTO)
/*
* Compute the buffer line position from the screen position "rowp" / "colp" in
@ -3017,15 +3001,3 @@ vcol2col(win_T *wp, linenr_T lnum, int vcol)
return (int)(ptr - line);
}
#endif
#else // FEAT_MOUSE
/*
* Dummy implementation of setmouse() to avoid lots of #ifdefs.
*/
void
setmouse(void)
{
}
#endif // FEAT_MOUSE

View File

@ -190,9 +190,7 @@ update_topline(void)
int check_topline = FALSE;
int check_botline = FALSE;
long *so_ptr = curwin->w_p_so >= 0 ? &curwin->w_p_so : &p_so;
#ifdef FEAT_MOUSE
int save_so = *so_ptr;
#endif
/* If there is no valid screen and when the window height is zero just use
* the cursor line. */
@ -209,11 +207,9 @@ update_topline(void)
if (curwin->w_valid & VALID_TOPLINE)
return;
#ifdef FEAT_MOUSE
/* When dragging with the mouse, don't scroll that quickly */
if (mouse_dragging > 0)
*so_ptr = mouse_dragging - 1;
#endif
old_topline = curwin->w_topline;
#ifdef FEAT_DIFF
@ -418,9 +414,7 @@ update_topline(void)
validate_cursor();
}
#ifdef FEAT_MOUSE
*so_ptr = save_so;
#endif
}
/*
@ -1751,10 +1745,8 @@ scroll_cursor_top(int min_scroll, int always)
linenr_T new_topline;
int off = get_scrolloff_value();
#ifdef FEAT_MOUSE
if (mouse_dragging > 0)
off = mouse_dragging - 1;
#endif
/*
* Decrease topline until:
@ -2004,11 +1996,7 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
/* Stop when scrolled nothing or at least "min_scroll", found "extra"
* context for 'scrolloff' and counted all lines below the window. */
if ((((scrolled <= 0 || scrolled >= min_scroll)
&& extra >= (
#ifdef FEAT_MOUSE
mouse_dragging > 0 ? mouse_dragging - 1 :
#endif
so))
&& extra >= (mouse_dragging > 0 ? mouse_dragging - 1 : so))
|| boff.lnum + 1 > curbuf->b_ml.ml_line_count)
&& loff.lnum <= curwin->w_botline
#ifdef FEAT_DIFF
@ -2050,11 +2038,8 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
used += boff.height;
if (used > curwin->w_height)
break;
if (extra < (
#ifdef FEAT_MOUSE
mouse_dragging > 0 ? mouse_dragging - 1 :
#endif
so) || scrolled < min_scroll)
if (extra < ( mouse_dragging > 0 ? mouse_dragging - 1 : so)
|| scrolled < min_scroll)
{
extra += boff.height;
if (boff.lnum >= curwin->w_botline
@ -2230,13 +2215,11 @@ cursor_correct(void)
*/
above_wanted = so;
below_wanted = so;
#ifdef FEAT_MOUSE
if (mouse_dragging > 0)
{
above_wanted = mouse_dragging - 1;
below_wanted = mouse_dragging - 1;
}
#endif
if (curwin->w_topline == 1)
{
above_wanted = 0;
@ -2246,10 +2229,7 @@ cursor_correct(void)
}
validate_botline();
if (curwin->w_botline == curbuf->b_ml.ml_line_count + 1
#ifdef FEAT_MOUSE
&& mouse_dragging == 0
#endif
)
&& mouse_dragging == 0)
{
below_wanted = 0;
max_off = (curwin->w_height - 1) / 2;

View File

@ -303,7 +303,6 @@ static const struct nv_cmd
/* pound sign */
{POUND, nv_ident, 0, 0},
#ifdef FEAT_MOUSE
{K_MOUSEUP, nv_mousescroll, 0, MSCR_UP},
{K_MOUSEDOWN, nv_mousescroll, 0, MSCR_DOWN},
{K_MOUSELEFT, nv_mousescroll, 0, MSCR_LEFT},
@ -326,7 +325,6 @@ static const struct nv_cmd
{K_X2MOUSE, nv_mouse, 0, 0},
{K_X2DRAG, nv_mouse, 0, 0},
{K_X2RELEASE, nv_mouse, 0, 0},
#endif
{K_IGNORE, nv_ignore, NV_KEEPREG, 0},
{K_NOP, nv_nop, 0, 0},
{K_INS, nv_edit, 0, 0},
@ -1319,10 +1317,8 @@ end_visual_mode(void)
#endif
VIsual_active = FALSE;
#ifdef FEAT_MOUSE
setmouse();
mouse_dragging = 0;
#endif
/* Save the current VIsual area for '< and '> marks, and "gv" */
curbuf->b_visual.vi_mode = VIsual_mode;
@ -1849,7 +1845,6 @@ add_to_showcmd(int c)
int old_len;
int extra_len;
int overflow;
#if defined(FEAT_MOUSE)
int i;
static int ignore[] =
{
@ -1866,7 +1861,6 @@ add_to_showcmd(int c)
K_CURSORHOLD,
0
};
#endif
if (!p_sc || msg_silent != 0)
return FALSE;
@ -1877,13 +1871,11 @@ add_to_showcmd(int c)
showcmd_visual = FALSE;
}
#if defined(FEAT_MOUSE)
/* Ignore keys that are scrollbar updates and mouse clicks */
if (IS_SPECIAL(c))
for (i = 0; ignore[i] != 0; ++i)
if (ignore[i] == c)
return FALSE;
#endif
p = transchar(c);
if (*p == ' ')
@ -4625,7 +4617,6 @@ nv_brackets(cmdarg_T *cap)
nv_cursormark(cap, cap->nchar == '\'', pos);
}
#ifdef FEAT_MOUSE
/*
* [ or ] followed by a middle mouse click: put selected text with
* indent adjustment. Any other button just does as usual.
@ -4636,7 +4627,6 @@ nv_brackets(cmdarg_T *cap)
(cap->cmdchar == ']') ? FORWARD : BACKWARD,
cap->count1, PUT_FIXINDENT);
}
#endif /* FEAT_MOUSE */
#ifdef FEAT_FOLDING
/*
@ -6220,7 +6210,6 @@ nv_g_cmd(cmdarg_T *cap)
nv_gd(oap, cap->nchar, (int)cap->count0);
break;
#ifdef FEAT_MOUSE
/*
* g<*Mouse> : <C-*mouse>
*/
@ -6243,7 +6232,6 @@ nv_g_cmd(cmdarg_T *cap)
mod_mask = MOD_MASK_CTRL;
(void)do_mouse(oap, cap->nchar, BACKWARD, cap->count1, 0);
break;
#endif
case K_IGNORE:
break;

View File

@ -4369,10 +4369,8 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
if (!gui_yank)
{
VIsual_active = FALSE;
#ifdef FEAT_MOUSE
setmouse();
mouse_dragging = 0;
#endif
may_clear_cmdline();
if ((oap->op_type == OP_YANK
|| oap->op_type == OP_COLON

View File

@ -4976,9 +4976,7 @@ clear_termoptions(void)
* outputting a few things that the terminal doesn't understand, but the
* screen will be cleared later, so this is OK.
*/
#ifdef FEAT_MOUSE_TTY
mch_setmouse(FALSE); /* switch mouse off */
#endif
mch_setmouse(FALSE); // switch mouse off
#ifdef FEAT_TITLE
mch_restore_title(SAVE_RESTORE_BOTH); /* restore window titles */
#endif

View File

@ -979,7 +979,7 @@ EXTERN unsigned tbis_flags;
# define TBIS_GIANT 0x20
#endif
EXTERN long p_ttyscroll; // 'ttyscroll'
#if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
#if defined(UNIX) || defined(VMS)
EXTERN char_u *p_ttym; // 'ttymouse'
EXTERN unsigned ttym_flags;
# define TTYM_XTERM 0x01

View File

@ -2655,7 +2655,7 @@ static struct vimoption options[] =
(char_u *)&p_tf, PV_NONE,
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},
{"ttymouse", "ttym", P_STRING|P_NODEFAULT|P_NO_MKRC|P_VI_DEF,
#if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
#if defined(UNIX) || defined(VMS)
(char_u *)&p_ttym, PV_NONE,
#else
(char_u *)NULL, PV_NONE,

View File

@ -47,7 +47,7 @@ static char *(p_toolbar_values[]) = {"text", "icons", "tooltips", "horiz", NULL}
#if defined(FEAT_TOOLBAR) && defined(FEAT_GUI_GTK)
static char *(p_tbis_values[]) = {"tiny", "small", "medium", "large", "huge", "giant", NULL};
#endif
#if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
#if defined(UNIX) || defined(VMS)
static char *(p_ttym_values[]) = {"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", "urxvt", "sgr", NULL};
#endif
static char *(p_ve_values[]) = {"block", "insert", "all", "onemore", NULL};
@ -110,7 +110,7 @@ didset_string_options(void)
(void)opt_strings_flags(p_dy, p_dy_values, &dy_flags, TRUE);
(void)opt_strings_flags(p_tc, p_tc_values, &tc_flags, FALSE);
(void)opt_strings_flags(p_ve, p_ve_values, &ve_flags, TRUE);
#if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
#if defined(UNIX) || defined(VMS)
(void)opt_strings_flags(p_ttym, p_ttym_values, &ttym_flags, FALSE);
#endif
#if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN)
@ -1588,7 +1588,7 @@ did_set_string_option(
}
#endif
#if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
#if defined(UNIX) || defined(VMS)
// 'ttymouse'
else if (varp == &p_ttym)
{
@ -2254,12 +2254,7 @@ did_set_string_option(
#endif
else if (varp == &p_mouse) // 'mouse'
{
#ifdef FEAT_MOUSE
p = (char_u *)MOUSE_ALL;
#else
if (*p_mouse != NUL)
errmsg = N_("E538: No mouse support");
#endif
}
#if defined(FEAT_GUI)
else if (varp == &p_go) // 'guioptions'
@ -2389,17 +2384,13 @@ did_set_string_option(
#endif
}
#ifdef FEAT_MOUSE
if (varp == &p_mouse)
{
# ifdef FEAT_MOUSE_TTY
if (*p_mouse == NUL)
mch_setmouse(FALSE); // switch mouse off
else
# endif
setmouse(); // in case 'mouse' changed
}
#endif
if (curwin->w_curswant != MAXCOL
&& (get_option_flags(opt_idx) & (P_CURSWANT | P_RALL)) != 0)

View File

@ -2282,7 +2282,6 @@ use_xterm_like_mouse(char_u *name)
}
#endif
#if defined(FEAT_MOUSE_TTY) || defined(PROTO)
/*
* Return non-zero when using an xterm mouse, according to 'ttymouse'.
* Return 1 for "xterm".
@ -2303,7 +2302,6 @@ use_xterm_mouse(void)
return 1;
return 0;
}
#endif
int
vim_is_iris(char_u *name)
@ -3592,7 +3590,6 @@ get_tty_info(int fd, ttyinfo_T *info)
#endif /* VMS */
#if defined(FEAT_MOUSE_TTY) || defined(PROTO)
static int mouse_ison = FALSE;
/*
@ -3929,7 +3926,6 @@ check_mouse_termcode(void)
del_mouse_termcode(KS_SGR_MOUSE_RELEASE);
}
}
#endif
/*
* set screen mode, always fails.

View File

@ -1127,8 +1127,6 @@ decode_key_event(
#endif /* FEAT_GUI_MSWIN */
#ifdef FEAT_MOUSE
/*
* For the GUI the mouse handling is in gui_w32.c.
*/
@ -1447,8 +1445,7 @@ decode_mouse_event(
return TRUE;
}
# endif /* FEAT_GUI_MSWIN */
#endif /* FEAT_MOUSE */
#endif // FEAT_GUI_MSWIN
#ifdef MCH_CURSOR_SHAPE
@ -1547,10 +1544,7 @@ WaitForChar(long msec, int ignore_input)
#endif
}
if (0
#ifdef FEAT_MOUSE
|| g_nMouseClick != -1
#endif
if (g_nMouseClick != -1
#ifdef FEAT_CLIENTSERVER
|| (!ignore_input && input_available())
#endif
@ -1683,11 +1677,9 @@ WaitForChar(long msec, int ignore_input)
shell_resized();
}
}
#ifdef FEAT_MOUSE
else if (ir.EventType == MOUSE_EVENT
&& decode_mouse_event(&ir.Event.MouseEvent))
return TRUE;
#endif
}
else if (msec == 0)
break;
@ -1760,10 +1752,8 @@ tgetch(int *pmodifiers, WCHAR *pch2)
(void)WaitForChar(-1L, FALSE);
if (input_available())
return 0;
# ifdef FEAT_MOUSE
if (g_nMouseClick != -1)
return 0;
# endif
#endif
if (read_console_input(g_hConIn, &ir, 1, &cRecords) == 0)
{
@ -1783,13 +1773,11 @@ tgetch(int *pmodifiers, WCHAR *pch2)
handle_focus_event(ir);
else if (ir.EventType == WINDOW_BUFFER_SIZE_EVENT)
shell_resized();
#ifdef FEAT_MOUSE
else if (ir.EventType == MOUSE_EVENT)
{
if (decode_mouse_event(&ir.Event.MouseEvent))
return 0;
}
#endif
}
}
#endif /* !FEAT_GUI_MSWIN */
@ -1879,7 +1867,6 @@ mch_inchar(
typeaheadlen = 0;
break;
}
#ifdef FEAT_MOUSE
if (g_nMouseClick != -1)
{
#ifdef MCH_WRITE_DUMP
@ -1895,7 +1882,6 @@ mch_inchar(
g_nMouseClick = -1;
}
else
#endif
{
WCHAR ch2 = NUL;
int modifiers = 0;
@ -1918,9 +1904,7 @@ mch_inchar(
got_int = TRUE;
}
#ifdef FEAT_MOUSE
if (g_nMouseClick == -1)
#endif
{
int n = 1;
@ -2675,9 +2659,7 @@ mch_init_c(void)
g_fWindInitCalled = TRUE;
#ifdef FEAT_MOUSE
g_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT);
#endif
#ifdef FEAT_CLIPBOARD
win_clip_init();
@ -3609,10 +3591,8 @@ mch_settmode(int tmode)
{
cmodein &= ~(ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT |
ENABLE_ECHO_INPUT);
#ifdef FEAT_MOUSE
if (g_fMouseActive)
cmodein |= ENABLE_MOUSE_INPUT;
#endif
cmodeout &= ~(
#ifdef FEAT_TERMGUICOLORS
/* Do not turn off the ENABLE_PROCESSED_OUTPUT flag when using
@ -5501,12 +5481,10 @@ termcap_mode_start(void)
#endif
GetConsoleMode(g_hConIn, &cmodein);
#ifdef FEAT_MOUSE
if (g_fMouseActive)
cmodein |= ENABLE_MOUSE_INPUT;
else
cmodein &= ~ENABLE_MOUSE_INPUT;
#endif
cmodein |= ENABLE_WINDOW_INPUT;
SetConsoleMode(g_hConIn, cmodein);

View File

@ -62,7 +62,7 @@
#endif
#define USE_FNAME_CASE /* adjust case of file names */
#if !defined(FEAT_CLIPBOARD) && defined(FEAT_MOUSE)
#if !defined(FEAT_CLIPBOARD)
# define FEAT_CLIPBOARD /* include clipboard support */
#endif
#if defined(__DATE__) && defined(__TIME__)

View File

@ -352,7 +352,6 @@ free_register(void *reg)
}
#endif
#if defined(FEAT_MOUSE) || defined(PROTO)
/*
* return TRUE if the current yank register has type MLINE
*/
@ -366,7 +365,6 @@ yank_register_mline(int regname)
get_yank_register(regname, FALSE);
return (y_current->y_type == MLINE);
}
#endif
/*
* Start or stop recording into a yank register.

View File

@ -1962,9 +1962,7 @@ set_termname(char_u *term)
is_mac_terminal = FALSE;
#endif
#ifdef FEAT_MOUSE
#if defined(UNIX) || defined(VMS)
# ifdef FEAT_MOUSE_TTY
/*
* For Unix, set the 'ttymouse' option to the type of mouse to be used.
* The termcode for the mouse is added as a side effect in option.c.
@ -1995,11 +1993,9 @@ set_termname(char_u *term)
)
check_mouse_termcode(); /* set mouse termcode anyway */
}
# endif
#else
set_mouse_termcode(KS_MOUSE, (char_u *)"\233M");
#endif
#endif /* FEAT_MOUSE */
#ifdef USE_TERM_CONSOLE
/* DEFAULT_TERM indicates that it is the machine console. */
@ -2565,8 +2561,6 @@ out_char_nf(unsigned c)
out_flush();
}
#if defined(FEAT_TITLE) || defined(FEAT_MOUSE_TTY) || defined(FEAT_GUI) \
|| defined(FEAT_TERMRESPONSE) || defined(PROTO)
/*
* A never-padding out_str.
* use this whenever you don't want to run the string through tputs.
@ -2590,7 +2584,6 @@ out_str_nf(char_u *s)
if (p_wd)
out_flush();
}
#endif
/*
* A conditional-flushing out_str, mainly for visualbell.
@ -3151,9 +3144,6 @@ get_long_from_buf(char_u *buf, long_u *val)
}
#endif
#if defined(FEAT_GUI) \
|| (defined(FEAT_MOUSE) && (!defined(UNIX) || defined(FEAT_MOUSE_XTERM) \
|| defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE)))
/*
* Read the next num_bytes bytes from buf, and store them in bytes. Assume
* that buf has been through inchar(). Returns the actual number of bytes used
@ -3191,7 +3181,6 @@ get_bytes_from_buf(char_u *buf, char_u *bytes, int num_bytes)
}
return len;
}
#endif
/*
* Check if the new shell size is valid, correct it if it's too small or way
@ -3436,10 +3425,8 @@ settmode(int tmode)
check_for_codes_from_term();
}
#endif
#ifdef FEAT_MOUSE_TTY
if (tmode != TMODE_RAW)
mch_setmouse(FALSE); // switch mouse off
#endif
if (termcap_active)
{
if (tmode != TMODE_RAW)
@ -5084,7 +5071,6 @@ not_enough:
/* We only get here when we have a complete termcode match */
#ifdef FEAT_MOUSE
#ifdef FEAT_GUI
/*
* Only in the GUI: Fetch the pointer coordinates of the scroll event
@ -5139,7 +5125,6 @@ not_enough:
&modifiers) == -1)
return -1;
}
#endif /* FEAT_MOUSE */
#ifdef FEAT_GUI
/*

View File

@ -926,14 +926,12 @@ f_test_scrollbar(typval_T *argvars, typval_T *rettv UNUSED)
}
#endif
#ifdef FEAT_MOUSE
void
f_test_setmouse(typval_T *argvars, typval_T *rettv UNUSED)
{
mouse_row = (time_t)tv_get_number(&argvars[0]) - 1;
mouse_col = (time_t)tv_get_number(&argvars[1]) - 1;
}
#endif
void
f_test_settime(typval_T *argvars, typval_T *rettv UNUSED)

View File

@ -359,16 +359,12 @@ static char *(features[]) =
"-mksession",
#endif
"+modify_fname",
#ifdef FEAT_MOUSE
"+mouse",
#ifdef FEAT_MOUSESHAPE
"+mouseshape",
#else
"-mouseshape",
#endif
# else
"-mouse",
#endif
#if defined(UNIX) || defined(VMS)
# ifdef FEAT_MOUSE_DEC
@ -402,11 +398,7 @@ static char *(features[]) =
#endif
#if defined(UNIX) || defined(VMS)
# ifdef FEAT_MOUSE_XTERM
"+mouse_sgr",
# else
"-mouse_sgr",
# endif
# ifdef FEAT_SYSMOUSE
"+mouse_sysmouse",
# else
@ -417,11 +409,7 @@ static char *(features[]) =
# else
"-mouse_urxvt",
# endif
# ifdef FEAT_MOUSE_XTERM
"+mouse_xterm",
# else
"-mouse_xterm",
# endif
#endif
#ifdef FEAT_MBYTE_IME
@ -753,6 +741,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2171,
/**/
2170,
/**/

View File

@ -151,9 +151,6 @@
# if defined(FEAT_SMALL) && !defined(FEAT_CLIPBOARD)
# define FEAT_CLIPBOARD
# endif
# if defined(FEAT_SMALL) && !defined(FEAT_MOUSE)
# define FEAT_MOUSE
# endif
#endif
// +x11 is only enabled when it's both available and wanted.
@ -1817,7 +1814,6 @@ typedef int sock_T;
#define PROF_YES 1 // profiling busy
#define PROF_PAUSED 2 // profiling paused
#ifdef FEAT_MOUSE
// Codes for mouse button events in lower three bits:
#define MOUSE_LEFT 0x00
@ -1890,7 +1886,6 @@ typedef int sock_T;
# define CHECK_DOUBLE_CLICK 1 // Checking for double clicks ourselves.
#endif
#endif // FEAT_MOUSE
// defines for eval_vars()
#define VALID_PATH 1

View File

@ -5725,8 +5725,6 @@ win_setminwidth(void)
}
}
#if defined(FEAT_MOUSE) || defined(PROTO)
/*
* Status line of dragwin is dragged "offset" lines down (negative is up).
*/
@ -5958,7 +5956,6 @@ win_drag_vsep_line(win_T *dragwin, int offset)
(void)win_comp_pos();
redraw_all_later(NOT_VALID);
}
#endif /* FEAT_MOUSE */
#define FRACTION_MULT 16384L