summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-10-17 23:00:07 +0200
committerBram Moolenaar <Bram@vim.org>2019-10-17 23:00:07 +0200
commita1cb1d1dce14dd005797590721f1bcd0e7c3b35f (patch)
treebe364e198e623b25d59e58d205e598fd954d3f17
parent0d2c4bf1714a6b286bd7a10061044414e0b17a15 (diff)
patch 8.1.2171: mouse support not always availablev8.1.2171
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).
-rw-r--r--src/edit.c9
-rw-r--r--src/evalfunc.c4
-rw-r--r--src/ex_getln.c15
-rw-r--r--src/feature.h41
-rw-r--r--src/getchar.c12
-rw-r--r--src/globals.h14
-rw-r--r--src/message.c7
-rw-r--r--src/misc1.c4
-rw-r--r--src/mouse.c54
-rw-r--r--src/move.c28
-rw-r--r--src/normal.c16
-rw-r--r--src/ops.c2
-rw-r--r--src/option.c4
-rw-r--r--src/option.h2
-rw-r--r--src/optiondefs.h2
-rw-r--r--src/optionstr.c17
-rw-r--r--src/os_unix.c54
-rw-r--r--src/os_win32.c58
-rw-r--r--src/os_win32.h2
-rw-r--r--src/register.c2
-rw-r--r--src/term.c57
-rw-r--r--src/testing.c2
-rw-r--r--src/version.c18
-rw-r--r--src/vim.h81
-rw-r--r--src/window.c3
25 files changed, 157 insertions, 351 deletions
diff --git a/src/edit.c b/src/edit.c
index 78f5cd74fe..4cbfc773b3 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -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)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 962c6c49bb..c43c8839bd 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -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
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 838bd84045..5816f3f9e7 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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,13 +2206,11 @@ getcmdline_int(
#ifdef FEAT_DIGRAPHS
case Ctrl_K:
-#ifdef FEAT_MOUSE
ignore_drag_release = TRUE;
-#endif
putcmdline('?', TRUE);
-#ifdef USE_ON_FLY_SCROLL
+# ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
-#endif
+# endif
c = get_digraph(TRUE);
extra_char = NUL;
if (c != NUL)
@@ -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 */
diff --git a/src/feature.h b/src/feature.h
index b2ba1623ef..04bb30cc63 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -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
-# define FEAT_MOUSE_XTERM
-# endif
+#if defined(UNIX) || defined(VMS)
+# define FEAT_MOUSE_XTERM
# ifdef FEAT_BIG
# define FEAT_MOUSE_NET
# endif
@@ -979,12 +979,12 @@
# ifdef FEAT_BIG
# define FEAT_MOUSE_URXVT
# endif
-# if defined(FEAT_NORMAL) && defined(MSWIN)
-# define DOS_MOUSE
-# endif
-# if defined(FEAT_NORMAL) && defined(__QNX__)
-# define FEAT_MOUSE_PTERM
-# endif
+#endif
+#if defined(MSWIN)
+# define DOS_MOUSE
+#endif
+#if defined(__QNX__)
+# define FEAT_MOUSE_PTERM
#endif
/*
@@ -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
diff --git a/src/getchar.c b/src/getchar.c
index 475bfca8e1..03a67be34a 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -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;
@@ -2025,11 +2020,11 @@ f_getchar(typval_T *argvars, typval_T *rettv)
if (win == NULL)
return;
(void)mouse_comp_pos(win, &row, &col, &lnum, NULL);
-# ifdef FEAT_TEXT_PROP
+#ifdef FEAT_TEXT_PROP
if (WIN_IS_POPUP(win))
winnr = 0;
else
-# endif
+#endif
for (wp = firstwin; wp != win && wp != NULL;
wp = wp->w_next)
++winnr;
@@ -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
}
/*
diff --git a/src/globals.h b/src/globals.h
index 014fca2ad4..3f883d1cf3 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -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()
*/
@@ -480,15 +479,15 @@ EXTERN int mouse_past_bottom INIT(= FALSE);// mouse below last line
EXTERN int mouse_past_eol INIT(= FALSE); // mouse right of line
EXTERN int mouse_dragging INIT(= 0); // extending Visual area with
// mouse dragging
-# if defined(FEAT_MOUSE_DEC)
+#if defined(FEAT_MOUSE_DEC)
/*
* When the DEC mouse has been pressed but not yet released we enable
* automatic queries for the mouse position.
*/
EXTERN int WantQueryMouse INIT(= FALSE);
-# endif
+#endif
-# ifdef FEAT_GUI
+#ifdef FEAT_GUI
// When the window layout is about to be changed, need_mouse_correct is set,
// so that gui_mouse_correct() is called afterwards, to correct the mouse
// pointer when focus-follow-mouse is being used.
@@ -496,10 +495,10 @@ EXTERN int need_mouse_correct INIT(= FALSE);
// When double clicking, topline must be the same
EXTERN linenr_T gui_prev_topline INIT(= 0);
-# ifdef FEAT_DIFF
+# ifdef FEAT_DIFF
EXTERN int gui_prev_topfill INIT(= 0);
-# endif
# endif
+#endif
# ifdef FEAT_MOUSESHAPE
EXTERN int drag_status_line INIT(= FALSE); // dragging the status line
@@ -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
diff --git a/src/message.c b/src/message.c
index fddb28e2b8..8af5d7b03b 100644
--- a/src/message.c
+++ b/src/message.c
@@ -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. */
diff --git a/src/misc1.c b/src/misc1.c
index d359ffd978..0e182555ac 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -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(':');
diff --git a/src/mouse.c b/src/mouse.c
index 498ff049bf..b71ef37a4c 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -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,20 +1256,17 @@ 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
-# define HMT_JSBTERM 8
-# define HMT_PTERM 16
-# define HMT_URXVT 32
-# define HMT_GPM 64
-# define HMT_SGR 128
-# define HMT_SGR_REL 256
+# define HMT_NORMAL 1
+# define HMT_NETTERM 2
+# define HMT_DEC 4
+# define HMT_JSBTERM 8
+# define HMT_PTERM 16
+# define HMT_URXVT 32
+# define HMT_GPM 64
+# 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
diff --git a/src/move.c b/src/move.c
index 223ed5417e..97f5ac1b7d 100644
--- a/src/move.c
+++ b/src/move.c
@@ -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;
diff --git a/src/normal.c b/src/normal.c
index 50f7b3185d..87754eb40e 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -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,14 +1845,13 @@ add_to_showcmd(int c)
int old_len;
int extra_len;
int overflow;
-#if defined(FEAT_MOUSE)
int i;
static int ignore[] =
{
-# ifdef FEAT_GUI
+#ifdef FEAT_GUI
K_VER_SCROLLBAR, K_HOR_SCROLLBAR,
K_LEFTMOUSE_NM, K_LEFTRELEASE_NM,
-# endif
+#endif
K_IGNORE, K_PS,
K_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE, K_MOUSEMOVE,
K_MIDDLEMOUSE, K_MIDDLEDRAG, K_MIDDLERELEASE,
@@ -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;
diff --git a/src/ops.c b/src/ops.c
index a008a9d48b..6a9fbba816 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -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
diff --git a/src/option.c b/src/option.c
index 898068b416..d27c73c3b4 100644
--- a/src/option.c
+++ b/src/option.c
@@ -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
diff --git a/src/option.h b/src/option.h
index aaa9443776..254ca6a282 100644
--- a/src/option.h
+++ b/src/option.h
@@ -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
diff --git a/src/optiondefs.h b/src/optiondefs.h
index 47f17ed392..b557771cfb 100644
--- a/src/optiondefs.h
+++ b/src/optiondefs.h
@@ -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,
diff --git a/src/optionstr.c b/src/optionstr.c
index a5b5b55a57..7b83aed250 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -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,20 +2384,16 @@ 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)
+ && (get_option_flags(opt_idx) & (P_CURSWANT | P_RALL)) != 0)
curwin->w_set_curswant = TRUE;
#ifdef FEAT_GUI
diff --git a/src/os_unix.c b/src/os_unix.c
index 54989af88d..e518bb91fc 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -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;
/*
@@ -3601,29 +3598,29 @@ static int mouse_ison = FALSE;
void
mch_setmouse(int on)
{
-# ifdef FEAT_BEVAL_TERM
+#ifdef FEAT_BEVAL_TERM
static int bevalterm_ison = FALSE;
-# endif
+#endif
int xterm_mouse_vers;
-# if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
+#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
if (!on)
// Make sure not tracing mouse movements. Important when a button-down
// was received but no release yet.
stop_xterm_trace();
-# endif
+#endif
if (on == mouse_ison
-# ifdef FEAT_BEVAL_TERM
+#ifdef FEAT_BEVAL_TERM
&& p_bevalterm == bevalterm_ison
-# endif
+#endif
)
/* return quickly if nothing to do */
return;
xterm_mouse_vers = use_xterm_mouse();
-# ifdef FEAT_MOUSE_URXVT
+#ifdef FEAT_MOUSE_URXVT
if (ttym_flags == TTYM_URXVT)
{
out_str_nf((char_u *)
@@ -3632,7 +3629,7 @@ mch_setmouse(int on)
: IF_EB("\033[?1015l", ESC_STR "[?1015l")));
mouse_ison = on;