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).
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.
if (where_paste_started.lnum != 0)
Insstart = where_paste_started;
else
-#endif
{
Insstart = curwin->w_cursor;
if (startln)
*/
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.
if (where_paste_started.lnum)
arrow_used = FALSE;
else
-#endif
arrow_used = TRUE;
restart_edit = 0;
/* 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
inserted_space = FALSE;
break;
-#ifdef FEAT_MOUSE
case K_LEFTMOUSE: /* mouse keys */
case K_LEFTMOUSE_NM:
case K_LEFTDRAG:
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)
#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},
"mksession",
#endif
"modify_fname",
-#ifdef FEAT_MOUSE
"mouse",
-#endif
#ifdef FEAT_MOUSESHAPE
"mouseshape",
#endif
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
break;
#endif
-#ifdef FEAT_MOUSE
case K_MIDDLEDRAG:
case K_MIDDLERELEASE:
goto cmdline_not_changed; /* Ignore mouse */
case K_MOUSEMOVE:
goto cmdline_not_changed;
-#endif /* FEAT_MOUSE */
-
#ifdef FEAT_GUI
case K_LEFTMOUSE_NM: /* mousefocus click, ignored */
case K_LEFTRELEASE_NM:
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 */
#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)
redrawcmd();
goto cmdline_not_changed;
-#endif /* FEAT_DIGRAPHS */
+#endif // FEAT_DIGRAPHS
#ifdef FEAT_RIGHTLEFT
case Ctrl__: /* CTRL-_: switch language mode */
* 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
# 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
/*
# 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
* 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
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.
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
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave(temp);
-#ifdef FEAT_MOUSE
if (is_mouse_key(n))
{
int row = mouse_row;
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;
set_vim_var_nr(VV_MOUSE_COL, col + 1);
}
}
-#endif
}
}
{
old_char = c;
old_mod_mask = mod_mask;
-#ifdef FEAT_MOUSE
old_mouse_row = mouse_row;
old_mouse_col = mouse_col;
-#endif
}
/*
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()
*/
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.
// 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
EXTERN int drag_sep_line INIT(= FALSE); // dragging vert separator
# endif
-#endif
#ifdef FEAT_DIFF
// Value set from 'diffopt'.
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
#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
|| 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. */
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
}
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(':');
#include "vim.h"
-#if defined(FEAT_MOUSE) || defined(PROTO)
-
/*
* Get class of a character for selection: same class means same word.
* 0: blank
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
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;
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
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;
has_mouse_termcode &= ~HMT_SGR_REL;
else
has_mouse_termcode &= ~HMT_NORMAL;
-# endif
}
# endif
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)
mch_setmouse(TRUE);
else
mch_setmouse(FALSE);
-# endif
}
/*
# 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;
}
# endif
-# if defined(UNIX) && defined(FEAT_MOUSE_TTY)
+# if defined(UNIX)
else if (use_xterm_mouse() > 1)
{
if (mouse_code & MOUSE_DRAG_XTERM)
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
return (int)(ptr - line);
}
#endif
-
-#else // FEAT_MOUSE
-
-/*
- * Dummy implementation of setmouse() to avoid lots of #ifdefs.
- */
- void
-setmouse(void)
-{
-}
-
-#endif // FEAT_MOUSE
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. */
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
validate_cursor();
}
-#ifdef FEAT_MOUSE
*so_ptr = save_so;
-#endif
}
/*
linenr_T new_topline;
int off = get_scrolloff_value();
-#ifdef FEAT_MOUSE
if (mouse_dragging > 0)
off = mouse_dragging - 1;
-#endif
/*
* Decrease topline until:
/* 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
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
*/
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;
}
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;
/* 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},
{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},
#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;
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,
K_CURSORHOLD,
0
};
-#endif
if (!p_sc || msg_silent != 0)
return FALSE;
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 == ' ')
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.
(cap->cmdchar == ']') ? FORWARD : BACKWARD,
cap->count1, PUT_FIXINDENT);
}
-#endif /* FEAT_MOUSE */
#ifdef FEAT_FOLDING
/*
nv_gd(oap, cap->nchar, (int)cap->count0);
break;
-#ifdef FEAT_MOUSE
/*
* g<*Mouse> : <C-*mouse>
*/
mod_mask = MOD_MASK_CTRL;
(void)do_mouse(oap, cap->nchar, BACKWARD, cap->count1, 0);
break;
-#endif
case K_IGNORE:
break;
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
* 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
# 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
(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,
#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};
(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)
}
#endif
-#if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
+#if defined(UNIX) || defined(VMS)
// 'ttymouse'
else if (varp == &p_ttym)
{
#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'
#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
}
#endif
-#if defined(FEAT_MOUSE_TTY) || defined(PROTO)
/*
* Return non-zero when using an xterm mouse, according to 'ttymouse'.
* Return 1 for "xterm".
return 1;
return 0;
}
-#endif
int
vim_is_iris(char_u *name)
#endif /* VMS */
-#if defined(FEAT_MOUSE_TTY) || defined(PROTO)
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 *)
: IF_EB("\033[?1015l", ESC_STR "[?1015l")));
mouse_ison = on;
}
-# endif
+#endif
if (ttym_flags == TTYM_SGR)
{
mouse_ison = on;
}
-# ifdef FEAT_BEVAL_TERM
+#ifdef FEAT_BEVAL_TERM
if (bevalterm_ison != (p_bevalterm && on))
{
bevalterm_ison = (p_bevalterm && on);
out_str_nf((char_u *)
(IF_EB("\033[?1003l", ESC_STR "[?1003l")));
}
-# endif
+#endif
if (xterm_mouse_vers > 0)
{
out_str_nf((char_u *)
(xterm_mouse_vers > 1
? (
-# ifdef FEAT_BEVAL_TERM
+#ifdef FEAT_BEVAL_TERM
bevalterm_ison
? IF_EB("\033[?1003h", ESC_STR "[?1003h") :
-# endif
+#endif
IF_EB("\033[?1002h", ESC_STR "[?1002h"))
: IF_EB("\033[?1000h", ESC_STR "[?1000h")));
else /* disable mouse events, could probably always send the same */
mouse_ison = on;
}
-# ifdef FEAT_MOUSE_DEC
+#ifdef FEAT_MOUSE_DEC
else if (ttym_flags == TTYM_DEC)
{
if (on) /* enable mouse events */
out_str_nf((char_u *)"\033['z");
mouse_ison = on;
}
-# endif
+#endif
-# ifdef FEAT_MOUSE_GPM
+#ifdef FEAT_MOUSE_GPM
else
{
if (on)
mouse_ison = FALSE;
}
}
-# endif
+#endif
-# ifdef FEAT_SYSMOUSE
+#ifdef FEAT_SYSMOUSE
else
{
if (on)
mouse_ison = FALSE;
}
}
-# endif
+#endif
-# ifdef FEAT_MOUSE_JSB
+#ifdef FEAT_MOUSE_JSB
else
{
if (on)
* 4 = Windows Cross Hair
* 5 = Windows UP Arrow
*/
-# ifdef JSBTERM_MOUSE_NONADVANCED
+# ifdef JSBTERM_MOUSE_NONADVANCED
/* Disables full feedback of pointer movements */
out_str_nf((char_u *)IF_EB("\033[0~ZwLMRK1Q\033\\",
ESC_STR "[0~ZwLMRK1Q" ESC_STR "\\"));
-# else
+# else
out_str_nf((char_u *)IF_EB("\033[0~ZwLMRK+1Q\033\\",
ESC_STR "[0~ZwLMRK+1Q" ESC_STR "\\"));
-# endif
+# endif
mouse_ison = TRUE;
}
else
mouse_ison = FALSE;
}
}
-# endif
-# ifdef FEAT_MOUSE_PTERM
+#endif
+#ifdef FEAT_MOUSE_PTERM
else
{
/* 1 = button press, 6 = release, 7 = drag, 1h...9l = right button */
out_str_nf("\033[>1l\033[>6l\033[>7l\033[>1l\033[>9h");
mouse_ison = on;
}
-# endif
+#endif
}
#if defined(FEAT_BEVAL_TERM) || defined(PROTO)
del_mouse_termcode(KS_SGR_MOUSE_RELEASE);
}
}
-#endif
/*
* set screen mode, always fails.
#endif /* FEAT_GUI_MSWIN */
-#ifdef FEAT_MOUSE
-
/*
* For the GUI the mouse handling is in gui_w32.c.
*/
-# if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL)
+#if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL)
void
mch_setmouse(int on UNUSED)
{
}
-# else
+#else
static int g_fMouseAvail = FALSE; /* mouse present */
static int g_fMouseActive = FALSE; /* mouse enabled */
static int g_nMouseClick = -1; /* mouse status */
{
DWORD cmodein;
-# ifdef VIMDLL
+# ifdef VIMDLL
if (gui.in_use)
return;
-# endif
+# endif
if (!g_fMouseAvail)
return;
}
-#if defined(FEAT_BEVAL_TERM) || defined(PROTO)
+# if defined(FEAT_BEVAL_TERM) || defined(PROTO)
/*
* Called when 'balloonevalterm' changed.
*/
{
mch_setmouse(g_fMouseActive);
}
-#endif
+# endif
/*
* Decode a MOUSE_EVENT. If it's a valid event, return MOUSE_LEFT,
static int s_xOldMouse = -1;
static int s_yOldMouse = -1;
static linenr_T s_old_topline = 0;
-#ifdef FEAT_DIFF
+# ifdef FEAT_DIFF
static int s_old_topfill = 0;
-#endif
+# endif
static int s_cClicks = 1;
static BOOL s_fReleased = TRUE;
static DWORD s_dwLastClickTime = 0;
/* If the last thing returned was MOUSE_RELEASE, ignore this */
if (s_fReleased)
{
-#ifdef FEAT_BEVAL_TERM
+# ifdef FEAT_BEVAL_TERM
/* do return mouse move events when we want them */
if (p_bevalterm)
nButton = MOUSE_DRAG;
else
-#endif
+# endif
return FALSE;
}
|| s_yOldMouse != g_yMouse
|| s_nOldButton != nButton
|| s_old_topline != curwin->w_topline
-#ifdef FEAT_DIFF
+# ifdef FEAT_DIFF
|| s_old_topfill != curwin->w_topfill
-#endif
+# endif
|| (int)(dwCurrentTime - s_dwLastClickTime) > p_mouset)
{
s_cClicks = 1;
s_xOldMouse = g_xMouse;
s_yOldMouse = g_yMouse;
s_old_topline = curwin->w_topline;
-#ifdef FEAT_DIFF
+# ifdef FEAT_DIFF
s_old_topfill = curwin->w_topfill;
-#endif
+# endif
s_nOldMouseClick = g_nMouseClick;
return TRUE;
}
-# endif /* FEAT_GUI_MSWIN */
-#endif /* FEAT_MOUSE */
+#endif // FEAT_GUI_MSWIN
#ifdef MCH_CURSOR_SHAPE
#endif
}
- if (0
-#ifdef FEAT_MOUSE
- || g_nMouseClick != -1
-#endif
+ if (g_nMouseClick != -1
#ifdef FEAT_CLIENTSERVER
|| (!ignore_input && input_available())
#endif
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;
(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)
{
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 */
typeaheadlen = 0;
break;
}
-#ifdef FEAT_MOUSE
if (g_nMouseClick != -1)
{
-# ifdef MCH_WRITE_DUMP
+#ifdef MCH_WRITE_DUMP
if (fdDump)
fprintf(fdDump, "{%02x @ %d, %d}",
g_nMouseClick, g_xMouse, g_yMouse);
-# endif
+#endif
typeahead[typeaheadlen++] = ESC + 128;
typeahead[typeaheadlen++] = 'M';
typeahead[typeaheadlen++] = g_nMouseClick;
g_nMouseClick = -1;
}
else
-#endif
{
WCHAR ch2 = NUL;
int modifiers = 0;
got_int = TRUE;
}
-#ifdef FEAT_MOUSE
if (g_nMouseClick == -1)
-#endif
{
int n = 1;
g_fWindInitCalled = TRUE;
-#ifdef FEAT_MOUSE
g_fMouseAvail = GetSystemMetrics(SM_MOUSEPRESENT);
-#endif
#ifdef FEAT_CLIPBOARD
win_clip_init();
{
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
#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);
#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__)
}
#endif
-#if defined(FEAT_MOUSE) || defined(PROTO)
/*
* return TRUE if the current yank register has type MLINE
*/
get_yank_register(regname, FALSE);
return (y_current->y_type == MLINE);
}
-#endif
/*
* Start or stop recording into a yank register.
is_mac_terminal = FALSE;
#endif
-#ifdef FEAT_MOUSE
-# if defined(UNIX) || defined(VMS)
-# ifdef FEAT_MOUSE_TTY
+#if defined(UNIX) || defined(VMS)
/*
* 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.
{
char_u *p = (char_u *)"";
-# ifdef FEAT_MOUSE_XTERM
+# ifdef FEAT_MOUSE_XTERM
if (use_xterm_like_mouse(term))
{
if (use_xterm_mouse())
else
p = (char_u *)"xterm";
}
-# endif
+# endif
if (p != NULL)
{
set_option_value((char_u *)"ttym", 0L, p, 0);
reset_option_was_set((char_u *)"ttym");
}
if (p == NULL
-# ifdef FEAT_GUI
+# ifdef FEAT_GUI
|| gui.in_use
-# endif
+# endif
)
check_mouse_termcode(); /* set mouse termcode anyway */
}
-# endif
-# else
+#else
set_mouse_termcode(KS_MOUSE, (char_u *)"\233M");
-# endif
-#endif /* FEAT_MOUSE */
+#endif
#ifdef USE_TERM_CONSOLE
/* DEFAULT_TERM indicates that it is the machine console. */
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.
if (p_wd)
out_flush();
}
-#endif
/*
* A conditional-flushing out_str, mainly for visualbell.
}
#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
}
return len;
}
-#endif
/*
* Check if the new shell size is valid, correct it if it's too small or way
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)
/* We only get here when we have a complete termcode match */
-#ifdef FEAT_MOUSE
-# ifdef FEAT_GUI
+#ifdef FEAT_GUI
/*
* Only in the GUI: Fetch the pointer coordinates of the scroll event
* so that we know which window to scroll later.
slen += num_bytes;
}
else
-# endif
+#endif
/*
* If it is a mouse click, get the coordinates.
*/
if (key_name[0] == KS_MOUSE
-# ifdef FEAT_MOUSE_GPM
+#ifdef FEAT_MOUSE_GPM
|| key_name[0] == KS_GPM_MOUSE
-# endif
-# ifdef FEAT_MOUSE_JSB
+#endif
+#ifdef FEAT_MOUSE_JSB
|| key_name[0] == KS_JSBTERM_MOUSE
-# endif
-# ifdef FEAT_MOUSE_NET
+#endif
+#ifdef FEAT_MOUSE_NET
|| key_name[0] == KS_NETTERM_MOUSE
-# endif
-# ifdef FEAT_MOUSE_DEC
+#endif
+#ifdef FEAT_MOUSE_DEC
|| key_name[0] == KS_DEC_MOUSE
-# endif
-# ifdef FEAT_MOUSE_PTERM
+#endif
+#ifdef FEAT_MOUSE_PTERM
|| key_name[0] == KS_PTERM_MOUSE
-# endif
-# ifdef FEAT_MOUSE_URXVT
+#endif
+#ifdef FEAT_MOUSE_URXVT
|| key_name[0] == KS_URXVT_MOUSE
-# endif
+#endif
|| key_name[0] == KS_SGR_MOUSE
|| key_name[0] == KS_SGR_MOUSE_RELEASE)
{
&modifiers) == -1)
return -1;
}
-#endif /* FEAT_MOUSE */
#ifdef FEAT_GUI
/*
}
#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)
"-mksession",
#endif
"+modify_fname",
-#ifdef FEAT_MOUSE
"+mouse",
-# ifdef FEAT_MOUSESHAPE
+#ifdef FEAT_MOUSESHAPE
"+mouseshape",
-# else
+#else
"-mouseshape",
-# endif
-# else
- "-mouse",
#endif
#if defined(UNIX) || defined(VMS)
#endif
#if defined(UNIX) || defined(VMS)
-# ifdef FEAT_MOUSE_XTERM
"+mouse_sgr",
-# else
- "-mouse_sgr",
-# endif
# ifdef FEAT_SYSMOUSE
"+mouse_sysmouse",
# else
# else
"-mouse_urxvt",
# endif
-# ifdef FEAT_MOUSE_XTERM
"+mouse_xterm",
-# else
- "-mouse_xterm",
-# endif
#endif
#ifdef FEAT_MBYTE_IME
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2171,
/**/
2170,
/**/
# 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.
#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
-# define MOUSE_MIDDLE 0x01
-# define MOUSE_RIGHT 0x02
-# define MOUSE_RELEASE 0x03
+#define MOUSE_LEFT 0x00
+#define MOUSE_MIDDLE 0x01
+#define MOUSE_RIGHT 0x02
+#define MOUSE_RELEASE 0x03
// bit masks for modifiers:
-# define MOUSE_SHIFT 0x04
-# define MOUSE_ALT 0x08
-# define MOUSE_CTRL 0x10
+#define MOUSE_SHIFT 0x04
+#define MOUSE_ALT 0x08
+#define MOUSE_CTRL 0x10
// mouse buttons that are handled like a key press (GUI only)
// Note that the scroll wheel keys are inverted: MOUSE_5 scrolls lines up but
// the result of this is that the window moves down, similarly MOUSE_6 scrolls
// columns left but the window moves right.
-# define MOUSE_4 0x100 // scroll wheel down
-# define MOUSE_5 0x200 // scroll wheel up
+#define MOUSE_4 0x100 // scroll wheel down
+#define MOUSE_5 0x200 // scroll wheel up
-# define MOUSE_X1 0x300 // Mouse-button X1 (6th)
-# define MOUSE_X2 0x400 // Mouse-button X2
+#define MOUSE_X1 0x300 // Mouse-button X1 (6th)
+#define MOUSE_X2 0x400 // Mouse-button X2
-# define MOUSE_6 0x500 // scroll wheel left
-# define MOUSE_7 0x600 // scroll wheel right
+#define MOUSE_6 0x500 // scroll wheel left
+#define MOUSE_7 0x600 // scroll wheel right
// 0x20 is reserved by xterm
-# define MOUSE_DRAG_XTERM 0x40
+#define MOUSE_DRAG_XTERM 0x40
-# define MOUSE_DRAG (0x40 | MOUSE_RELEASE)
+#define MOUSE_DRAG (0x40 | MOUSE_RELEASE)
// Lowest button code for using the mouse wheel (xterm only)
-# define MOUSEWHEEL_LOW 0x60
+#define MOUSEWHEEL_LOW 0x60
-# define MOUSE_CLICK_MASK 0x03
+#define MOUSE_CLICK_MASK 0x03
-# define NUM_MOUSE_CLICKS(code) \
+#define NUM_MOUSE_CLICKS(code) \
(((unsigned)((code) & 0xC0) >> 6) + 1)
-# define SET_NUM_MOUSE_CLICKS(code, num) \
+#define SET_NUM_MOUSE_CLICKS(code, num) \
(code) = ((code) & 0x3f) | ((((num) - 1) & 3) << 6)
// Added to mouse column for GUI when 'mousefocus' wants to give focus to a
// window by simulating a click on its status line. We could use up to 128 *
// 128 = 16384 columns, now it's reduced to 10000.
-# define MOUSE_COLOFF 10000
+#define MOUSE_COLOFF 10000
/*
* jump_to_mouse() returns one of first four these values, possibly with
* some of the other three added.
*/
-# define IN_UNKNOWN 0
-# define IN_BUFFER 1
-# define IN_STATUS_LINE 2 // on status or command line
-# define IN_SEP_LINE 4 // on vertical separator line
-# define IN_OTHER_WIN 8 // in other window but can't go there
-# define CURSOR_MOVED 0x100
-# define MOUSE_FOLD_CLOSE 0x200 // clicked on '-' in fold column
-# define MOUSE_FOLD_OPEN 0x400 // clicked on '+' in fold column
-# define MOUSE_WINBAR 0x800 // in window toolbar
+#define IN_UNKNOWN 0
+#define IN_BUFFER 1
+#define IN_STATUS_LINE 2 // on status or command line
+#define IN_SEP_LINE 4 // on vertical separator line
+#define IN_OTHER_WIN 8 // in other window but can't go there
+#define CURSOR_MOVED 0x100
+#define MOUSE_FOLD_CLOSE 0x200 // clicked on '-' in fold column
+#define MOUSE_FOLD_OPEN 0x400 // clicked on '+' in fold column
+#define MOUSE_WINBAR 0x800 // in window toolbar
// flags for jump_to_mouse()
-# define MOUSE_FOCUS 0x01 // need to stay in this window
-# define MOUSE_MAY_VIS 0x02 // may start Visual mode
-# define MOUSE_DID_MOVE 0x04 // only act when mouse has moved
-# define MOUSE_SETPOS 0x08 // only set current mouse position
-# define MOUSE_MAY_STOP_VIS 0x10 // may stop Visual mode
-# define MOUSE_RELEASED 0x20 // button was released
+#define MOUSE_FOCUS 0x01 // need to stay in this window
+#define MOUSE_MAY_VIS 0x02 // may start Visual mode
+#define MOUSE_DID_MOVE 0x04 // only act when mouse has moved
+#define MOUSE_SETPOS 0x08 // only set current mouse position
+#define MOUSE_MAY_STOP_VIS 0x10 // may stop Visual mode
+#define MOUSE_RELEASED 0x20 // button was released
-# if defined(UNIX) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
-# define CHECK_DOUBLE_CLICK 1 // Checking for double clicks ourselves.
-# endif
+#if defined(UNIX) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
+# define CHECK_DOUBLE_CLICK 1 // Checking for double clicks ourselves.
+#endif
-#endif // FEAT_MOUSE
// defines for eval_vars()
#define VALID_PATH 1
}
}
-#if defined(FEAT_MOUSE) || defined(PROTO)
-
/*
* Status line of dragwin is dragged "offset" lines down (negative is up).
*/
(void)win_comp_pos();
redraw_all_later(NOT_VALID);
}
-#endif /* FEAT_MOUSE */
#define FRACTION_MULT 16384L