mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 9.0.0902: some mouse scroll code is not in a good place
Problem: Some mouse scroll code is not in a good place. Solution: Refactor the code. (Christopher Plewright, closes #11561)
This commit is contained in:
committed by
Bram Moolenaar
parent
0c34d56264
commit
696d0a8625
244
src/mouse.c
244
src/mouse.c
@@ -576,7 +576,7 @@ do_mouse(
|
|||||||
// Ignore right button release events, only shows the popup
|
// Ignore right button release events, only shows the popup
|
||||||
// menu on the button down event.
|
// menu on the button down event.
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
jump_flags = 0;
|
jump_flags = 0;
|
||||||
if (STRCMP(p_mousem, "popup_setpos") == 0)
|
if (STRCMP(p_mousem, "popup_setpos") == 0)
|
||||||
@@ -1063,10 +1063,10 @@ ins_mouse(int c)
|
|||||||
pos_T tpos;
|
pos_T tpos;
|
||||||
win_T *old_curwin = curwin;
|
win_T *old_curwin = curwin;
|
||||||
|
|
||||||
# ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
// When GUI is active, also move/paste when 'mouse' is empty
|
// When GUI is active, also move/paste when 'mouse' is empty
|
||||||
if (!gui.in_use)
|
if (!gui.in_use)
|
||||||
# endif
|
#endif
|
||||||
if (!mouse_has(MOUSE_INSERT))
|
if (!mouse_has(MOUSE_INSERT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1102,20 +1102,19 @@ ins_mouse(int c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Implementation for scrolling in direction "dir", which is one of the MSCR_
|
* Implementation for scrolling in Insert mode in direction "dir", which is one
|
||||||
* values.
|
* of the MSCR_ values.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ins_mousescroll(int dir)
|
ins_mousescroll(int dir)
|
||||||
{
|
{
|
||||||
cmdarg_T cap;
|
cmdarg_T cap;
|
||||||
CLEAR_FIELD(cap);
|
|
||||||
|
|
||||||
oparg_T oa;
|
oparg_T oa;
|
||||||
|
CLEAR_FIELD(cap);
|
||||||
clear_oparg(&oa);
|
clear_oparg(&oa);
|
||||||
cap.oap = &oa;
|
cap.oap = &oa;
|
||||||
|
|
||||||
cap.arg = dir;
|
cap.arg = dir;
|
||||||
|
|
||||||
switch (dir)
|
switch (dir)
|
||||||
{
|
{
|
||||||
case MSCR_UP:
|
case MSCR_UP:
|
||||||
@@ -1133,7 +1132,50 @@ ins_mousescroll(int dir)
|
|||||||
default:
|
default:
|
||||||
siemsg("Invalid ins_mousescroll() argument: %d", dir);
|
siemsg("Invalid ins_mousescroll() argument: %d", dir);
|
||||||
}
|
}
|
||||||
do_mousescroll(MODE_INSERT, &cap);
|
|
||||||
|
win_T *wp = curwin;
|
||||||
|
if (mouse_row >= 0 && mouse_col >= 0)
|
||||||
|
{
|
||||||
|
// Find the window at the mouse pointer coordinates.
|
||||||
|
int row = mouse_row;
|
||||||
|
int col = mouse_col;
|
||||||
|
wp = mouse_find_win(&row, &col, FIND_POPUP);
|
||||||
|
if (wp == NULL)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wp == curwin)
|
||||||
|
{
|
||||||
|
// Don't scroll the current window if the popup menu is visible.
|
||||||
|
if (pum_visible())
|
||||||
|
return;
|
||||||
|
|
||||||
|
undisplay_dollar();
|
||||||
|
}
|
||||||
|
|
||||||
|
linenr_T orig_topline = wp->w_topline;
|
||||||
|
colnr_T orig_leftcol = wp->w_leftcol;
|
||||||
|
pos_T orig_cursor = curwin->w_cursor;
|
||||||
|
|
||||||
|
// The scrolling works almost the same way as in Normal mode.
|
||||||
|
nv_mousescroll(&cap);
|
||||||
|
|
||||||
|
// If the window actually scrolled and the popup menu may overlay the
|
||||||
|
// window, need to redraw it.
|
||||||
|
if ((orig_topline != wp->w_topline || orig_leftcol != wp->w_leftcol)
|
||||||
|
&& pum_visible())
|
||||||
|
{
|
||||||
|
// TODO: Would be more efficient to only redraw the windows that are
|
||||||
|
// overlapped by the popup menu.
|
||||||
|
redraw_all_later(UPD_NOT_VALID);
|
||||||
|
ins_compl_show_pum();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!EQUAL_POS(curwin->w_cursor, orig_cursor))
|
||||||
|
{
|
||||||
|
start_arrow(&orig_cursor);
|
||||||
|
set_can_cindent(TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1281,36 +1323,36 @@ set_mouse_termcode(
|
|||||||
name[0] = n;
|
name[0] = n;
|
||||||
name[1] = KE_FILLER;
|
name[1] = KE_FILLER;
|
||||||
add_termcode(name, s, FALSE);
|
add_termcode(name, s, FALSE);
|
||||||
# ifdef FEAT_MOUSE_JSB
|
#ifdef FEAT_MOUSE_JSB
|
||||||
if (n == KS_JSBTERM_MOUSE)
|
if (n == KS_JSBTERM_MOUSE)
|
||||||
has_mouse_termcode |= HMT_JSBTERM;
|
has_mouse_termcode |= HMT_JSBTERM;
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
# ifdef FEAT_MOUSE_NET
|
#ifdef FEAT_MOUSE_NET
|
||||||
if (n == KS_NETTERM_MOUSE)
|
if (n == KS_NETTERM_MOUSE)
|
||||||
has_mouse_termcode |= HMT_NETTERM;
|
has_mouse_termcode |= HMT_NETTERM;
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
# ifdef FEAT_MOUSE_DEC
|
#ifdef FEAT_MOUSE_DEC
|
||||||
if (n == KS_DEC_MOUSE)
|
if (n == KS_DEC_MOUSE)
|
||||||
has_mouse_termcode |= HMT_DEC;
|
has_mouse_termcode |= HMT_DEC;
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
# ifdef FEAT_MOUSE_PTERM
|
#ifdef FEAT_MOUSE_PTERM
|
||||||
if (n == KS_PTERM_MOUSE)
|
if (n == KS_PTERM_MOUSE)
|
||||||
has_mouse_termcode |= HMT_PTERM;
|
has_mouse_termcode |= HMT_PTERM;
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
# ifdef FEAT_MOUSE_URXVT
|
#ifdef FEAT_MOUSE_URXVT
|
||||||
if (n == KS_URXVT_MOUSE)
|
if (n == KS_URXVT_MOUSE)
|
||||||
has_mouse_termcode |= HMT_URXVT;
|
has_mouse_termcode |= HMT_URXVT;
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
# ifdef FEAT_MOUSE_GPM
|
#ifdef FEAT_MOUSE_GPM
|
||||||
if (n == KS_GPM_MOUSE)
|
if (n == KS_GPM_MOUSE)
|
||||||
has_mouse_termcode |= HMT_GPM;
|
has_mouse_termcode |= HMT_GPM;
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
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)
|
||||||
@@ -1319,7 +1361,7 @@ set_mouse_termcode(
|
|||||||
has_mouse_termcode |= HMT_NORMAL;
|
has_mouse_termcode |= HMT_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(UNIX) || defined(VMS) || defined(PROTO)
|
#if defined(UNIX) || defined(VMS) || defined(PROTO)
|
||||||
void
|
void
|
||||||
del_mouse_termcode(
|
del_mouse_termcode(
|
||||||
int n) // KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE
|
int n) // KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE
|
||||||
@@ -1366,7 +1408,7 @@ del_mouse_termcode(
|
|||||||
else
|
else
|
||||||
has_mouse_termcode &= ~HMT_NORMAL;
|
has_mouse_termcode &= ~HMT_NORMAL;
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* setmouse() - switch mouse on/off depending on current mode and 'mouse'
|
* setmouse() - switch mouse on/off depending on current mode and 'mouse'
|
||||||
@@ -1376,16 +1418,16 @@ setmouse(void)
|
|||||||
{
|
{
|
||||||
int checkfor;
|
int checkfor;
|
||||||
|
|
||||||
# ifdef FEAT_MOUSESHAPE
|
#ifdef FEAT_MOUSESHAPE
|
||||||
update_mouseshape(-1);
|
update_mouseshape(-1);
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
// Should be outside proc, but may break MOUSESHAPE
|
// Should be outside proc, but may break MOUSESHAPE
|
||||||
# ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
// In the GUI the mouse is always enabled.
|
// In the GUI the mouse is always enabled.
|
||||||
if (gui.in_use)
|
if (gui.in_use)
|
||||||
return;
|
return;
|
||||||
# endif
|
#endif
|
||||||
// be quick when mouse is off
|
// be quick when mouse is off
|
||||||
if (*p_mouse == NUL || has_mouse_termcode == 0)
|
if (*p_mouse == NUL || has_mouse_termcode == 0)
|
||||||
return;
|
return;
|
||||||
@@ -1713,15 +1755,15 @@ retnomove:
|
|||||||
// A click outside the command-line window: Use modeless
|
// A click outside the command-line window: Use modeless
|
||||||
// selection if possible. Allow dragging the status lines.
|
// selection if possible. Allow dragging the status lines.
|
||||||
on_sep_line = 0;
|
on_sep_line = 0;
|
||||||
# ifdef FEAT_CLIPBOARD
|
#ifdef FEAT_CLIPBOARD
|
||||||
if (on_status_line)
|
if (on_status_line)
|
||||||
return IN_STATUS_LINE;
|
return IN_STATUS_LINE;
|
||||||
return IN_OTHER_WIN;
|
return IN_OTHER_WIN;
|
||||||
# else
|
#else
|
||||||
row = 0;
|
row = 0;
|
||||||
col += wp->w_wincol;
|
col += wp->w_wincol;
|
||||||
wp = curwin;
|
wp = curwin;
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
#if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL)
|
#if defined(FEAT_PROP_POPUP) && defined(FEAT_TERMINAL)
|
||||||
if (popup_is_popup(curwin) && curbuf->b_term != NULL)
|
if (popup_is_popup(curwin) && curbuf->b_term != NULL)
|
||||||
@@ -2012,12 +2054,12 @@ retnomove:
|
|||||||
|| curwin->w_cursor.col != old_cursor.col)
|
|| curwin->w_cursor.col != old_cursor.col)
|
||||||
count |= CURSOR_MOVED; // Cursor has moved
|
count |= CURSOR_MOVED; // Cursor has moved
|
||||||
|
|
||||||
# ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
if (mouse_char == curwin->w_fill_chars.foldclosed)
|
if (mouse_char == curwin->w_fill_chars.foldclosed)
|
||||||
count |= MOUSE_FOLD_OPEN;
|
count |= MOUSE_FOLD_OPEN;
|
||||||
else if (mouse_char != ' ')
|
else if (mouse_char != ' ')
|
||||||
count |= MOUSE_FOLD_CLOSE;
|
count |= MOUSE_FOLD_CLOSE;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -2062,69 +2104,54 @@ do_mousescroll_horiz(long_u leftcol)
|
|||||||
* K_MOUSERIGHT - MSCR_RIGHT
|
* K_MOUSERIGHT - MSCR_RIGHT
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
do_mousescroll(int mode, cmdarg_T *cap)
|
nv_mousescroll(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
win_T *old_curwin = curwin, *wp;
|
win_T *old_curwin = curwin;
|
||||||
int did_ins_scroll = FALSE;
|
|
||||||
pos_T tpos = curwin->w_cursor;
|
|
||||||
|
|
||||||
if (mouse_row >= 0 && mouse_col >= 0)
|
if (mouse_row >= 0 && mouse_col >= 0)
|
||||||
{
|
{
|
||||||
int row, col;
|
// Find the window at the mouse pointer coordinates.
|
||||||
|
int row = mouse_row;
|
||||||
row = mouse_row;
|
int col = mouse_col;
|
||||||
col = mouse_col;
|
win_T *wp = mouse_find_win(&row, &col, FIND_POPUP);
|
||||||
|
|
||||||
// find the window at the pointer coordinates
|
|
||||||
wp = mouse_find_win(&row, &col, FIND_POPUP);
|
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return;
|
return;
|
||||||
#ifdef FEAT_PROP_POPUP
|
#ifdef FEAT_PROP_POPUP
|
||||||
if (WIN_IS_POPUP(wp) && !wp->w_has_scrollbar)
|
if (WIN_IS_POPUP(wp) && !wp->w_has_scrollbar)
|
||||||
|
// cannot scroll this popup window
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
// NOTE: Must restore "curwin" to "old_curwin" before returning!
|
||||||
curwin = wp;
|
curwin = wp;
|
||||||
curbuf = curwin->w_buffer;
|
curbuf = curwin->w_buffer;
|
||||||
}
|
}
|
||||||
if (mode == MODE_INSERT && curwin == old_curwin)
|
|
||||||
undisplay_dollar();
|
|
||||||
|
|
||||||
# ifdef FEAT_TERMINAL
|
int shift_or_ctrl = mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL);
|
||||||
|
|
||||||
|
#ifdef FEAT_TERMINAL
|
||||||
if (term_use_loop())
|
if (term_use_loop())
|
||||||
// This window is a terminal window, send the mouse event there.
|
// This window is a terminal window, send the mouse event there.
|
||||||
// Set "typed" to FALSE to avoid an endless loop.
|
// Set "typed" to FALSE to avoid an endless loop.
|
||||||
send_keys_to_term(curbuf->b_term, cap->cmdchar, mod_mask, FALSE);
|
send_keys_to_term(curbuf->b_term, cap->cmdchar, mod_mask, FALSE);
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
// For Insert mode, don't scroll the window in which completion is being
|
|
||||||
// done.
|
|
||||||
if (mode == MODE_NORMAL || !pum_visible() || curwin != old_curwin)
|
|
||||||
{
|
|
||||||
if (cap->arg == MSCR_UP || cap->arg == MSCR_DOWN)
|
if (cap->arg == MSCR_UP || cap->arg == MSCR_DOWN)
|
||||||
{
|
{
|
||||||
if (mouse_vert_step < 0
|
// Vertical scrolling
|
||||||
|| mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL))
|
if (!(State & MODE_INSERT) && (mouse_vert_step < 0 || shift_or_ctrl))
|
||||||
{
|
{
|
||||||
if (mode == MODE_INSERT)
|
// whole page up or down
|
||||||
{
|
onepage(cap->arg == MSCR_UP ? FORWARD : BACKWARD, 1L);
|
||||||
long step = (long)(curwin->w_botline - curwin->w_topline);
|
|
||||||
scroll_redraw(cap->arg, step);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
did_ins_scroll = onepage(cap->arg ? FORWARD : BACKWARD, 1L);
|
if (mouse_vert_step < 0 || shift_or_ctrl)
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (mode == MODE_INSERT)
|
// whole page up or down
|
||||||
{
|
cap->count1 = (long)(curwin->w_botline - curwin->w_topline);
|
||||||
scroll_redraw(cap->arg, mouse_vert_step);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Don't scroll more than half the window height.
|
// Don't scroll more than half the window height.
|
||||||
if (curwin->w_height < mouse_vert_step * 2)
|
else if (curwin->w_height < mouse_vert_step * 2)
|
||||||
{
|
{
|
||||||
cap->count1 = curwin->w_height / 2;
|
cap->count1 = curwin->w_height / 2;
|
||||||
if (cap->count1 == 0)
|
if (cap->count1 == 0)
|
||||||
@@ -2137,7 +2164,6 @@ do_mousescroll(int mode, cmdarg_T *cap)
|
|||||||
cap->count0 = cap->count1;
|
cap->count0 = cap->count1;
|
||||||
nv_scroll_line(cap);
|
nv_scroll_line(cap);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FEAT_PROP_POPUP
|
#ifdef FEAT_PROP_POPUP
|
||||||
if (WIN_IS_POPUP(curwin))
|
if (WIN_IS_POPUP(curwin))
|
||||||
@@ -2146,51 +2172,26 @@ do_mousescroll(int mode, cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
long step = (mouse_hor_step < 0
|
// Horizontal scrolling
|
||||||
|| (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)))
|
long step = (mouse_hor_step < 0 || shift_or_ctrl)
|
||||||
? curwin->w_width : mouse_hor_step;
|
? curwin->w_width : mouse_hor_step;
|
||||||
long leftcol = curwin->w_leftcol
|
long leftcol = curwin->w_leftcol
|
||||||
+ (cap->arg == MSCR_RIGHT ? -step : step);
|
+ (cap->arg == MSCR_RIGHT ? -step : step);
|
||||||
if (leftcol < 0)
|
if (leftcol < 0)
|
||||||
leftcol = 0;
|
leftcol = 0;
|
||||||
|
do_mousescroll_horiz((long_u)leftcol);
|
||||||
did_ins_scroll = do_mousescroll_horiz((long_u)leftcol);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
if (mode == MODE_NORMAL && curwin != old_curwin && curwin->w_p_cul)
|
if (curwin != old_curwin && curwin->w_p_cul)
|
||||||
redraw_for_cursorline(curwin);
|
redraw_for_cursorline(curwin);
|
||||||
# endif
|
#endif
|
||||||
may_trigger_winscrolled();
|
may_trigger_winscrolled();
|
||||||
|
|
||||||
curwin->w_redr_status = TRUE;
|
curwin->w_redr_status = TRUE;
|
||||||
|
|
||||||
curwin = old_curwin;
|
curwin = old_curwin;
|
||||||
curbuf = curwin->w_buffer;
|
curbuf = curwin->w_buffer;
|
||||||
|
|
||||||
if (mode == MODE_INSERT)
|
|
||||||
{
|
|
||||||
// The popup menu may overlay the window, need to redraw it.
|
|
||||||
// TODO: Would be more efficient to only redraw the windows that are
|
|
||||||
// overlapped by the popup menu.
|
|
||||||
if (pum_visible() && did_ins_scroll)
|
|
||||||
{
|
|
||||||
redraw_all_later(UPD_NOT_VALID);
|
|
||||||
ins_compl_show_pum();
|
|
||||||
}
|
|
||||||
if (!EQUAL_POS(curwin->w_cursor, tpos))
|
|
||||||
{
|
|
||||||
start_arrow(&tpos);
|
|
||||||
set_can_cindent(TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nv_mousescroll(cmdarg_T *cap)
|
|
||||||
{
|
|
||||||
do_mousescroll(MODE_NORMAL, cap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2225,11 +2226,11 @@ check_termcode_mouse(
|
|||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
# if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \
|
#if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \
|
||||||
|| defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE)
|
|| defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE)
|
||||||
char_u bytes[6];
|
char_u bytes[6];
|
||||||
int num_bytes;
|
int num_bytes;
|
||||||
# endif
|
#endif
|
||||||
int mouse_code = 0; // init for GCC
|
int mouse_code = 0; // init for GCC
|
||||||
int is_click, is_drag;
|
int is_click, is_drag;
|
||||||
int is_release, release_is_ambiguous;
|
int is_release, release_is_ambiguous;
|
||||||
@@ -2237,18 +2238,18 @@ check_termcode_mouse(
|
|||||||
int current_button;
|
int current_button;
|
||||||
static int orig_num_clicks = 1;
|
static int orig_num_clicks = 1;
|
||||||
static int orig_mouse_code = 0x0;
|
static int orig_mouse_code = 0x0;
|
||||||
# ifdef CHECK_DOUBLE_CLICK
|
#ifdef CHECK_DOUBLE_CLICK
|
||||||
static int orig_mouse_col = 0;
|
static int orig_mouse_col = 0;
|
||||||
static int orig_mouse_row = 0;
|
static int orig_mouse_row = 0;
|
||||||
static struct timeval orig_mouse_time = {0, 0};
|
static struct timeval orig_mouse_time = {0, 0};
|
||||||
// time of previous mouse click
|
// time of previous mouse click
|
||||||
struct timeval mouse_time; // time of current mouse click
|
struct timeval mouse_time; // time of current mouse click
|
||||||
long timediff; // elapsed time in msec
|
long timediff; // elapsed time in msec
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
is_click = is_drag = is_release = release_is_ambiguous = FALSE;
|
is_click = is_drag = is_release = release_is_ambiguous = FALSE;
|
||||||
|
|
||||||
# if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \
|
#if !defined(UNIX) || defined(FEAT_MOUSE_XTERM) || defined(FEAT_GUI) \
|
||||||
|| defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE)
|
|| defined(FEAT_MOUSE_GPM) || defined(FEAT_SYSMOUSE)
|
||||||
if (key_name[0] == KS_MOUSE
|
if (key_name[0] == KS_MOUSE
|
||||||
# ifdef FEAT_MOUSE_GPM
|
# ifdef FEAT_MOUSE_GPM
|
||||||
@@ -2465,8 +2466,8 @@ check_termcode_mouse(
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
# endif // !UNIX || FEAT_MOUSE_XTERM
|
#endif // !UNIX || FEAT_MOUSE_XTERM
|
||||||
# ifdef FEAT_MOUSE_NET
|
#ifdef FEAT_MOUSE_NET
|
||||||
if (key_name[0] == KS_NETTERM_MOUSE)
|
if (key_name[0] == KS_NETTERM_MOUSE)
|
||||||
{
|
{
|
||||||
int mc, mr;
|
int mc, mr;
|
||||||
@@ -2487,8 +2488,8 @@ check_termcode_mouse(
|
|||||||
mouse_code = MOUSE_LEFT;
|
mouse_code = MOUSE_LEFT;
|
||||||
*slen += (int)(p - (tp + *slen));
|
*slen += (int)(p - (tp + *slen));
|
||||||
}
|
}
|
||||||
# endif // FEAT_MOUSE_NET
|
#endif // FEAT_MOUSE_NET
|
||||||
# ifdef FEAT_MOUSE_JSB
|
#ifdef FEAT_MOUSE_JSB
|
||||||
if (key_name[0] == KS_JSBTERM_MOUSE)
|
if (key_name[0] == KS_JSBTERM_MOUSE)
|
||||||
{
|
{
|
||||||
int mult, val, iter, button, status;
|
int mult, val, iter, button, status;
|
||||||
@@ -2612,8 +2613,8 @@ check_termcode_mouse(
|
|||||||
|
|
||||||
*slen += (p - (tp + *slen));
|
*slen += (p - (tp + *slen));
|
||||||
}
|
}
|
||||||
# endif // FEAT_MOUSE_JSB
|
#endif // FEAT_MOUSE_JSB
|
||||||
# ifdef FEAT_MOUSE_DEC
|
#ifdef FEAT_MOUSE_DEC
|
||||||
if (key_name[0] == KS_DEC_MOUSE)
|
if (key_name[0] == KS_DEC_MOUSE)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -2747,8 +2748,8 @@ check_termcode_mouse(
|
|||||||
|
|
||||||
*slen += (int)(p - (tp + *slen));
|
*slen += (int)(p - (tp + *slen));
|
||||||
}
|
}
|
||||||
# endif // FEAT_MOUSE_DEC
|
#endif // FEAT_MOUSE_DEC
|
||||||
# ifdef FEAT_MOUSE_PTERM
|
#ifdef FEAT_MOUSE_PTERM
|
||||||
if (key_name[0] == KS_PTERM_MOUSE)
|
if (key_name[0] == KS_PTERM_MOUSE)
|
||||||
{
|
{
|
||||||
int button, num_clicks, action;
|
int button, num_clicks, action;
|
||||||
@@ -2804,7 +2805,7 @@ check_termcode_mouse(
|
|||||||
|
|
||||||
*slen += (p - (tp + *slen));
|
*slen += (p - (tp + *slen));
|
||||||
}
|
}
|
||||||
# endif // FEAT_MOUSE_PTERM
|
#endif // FEAT_MOUSE_PTERM
|
||||||
|
|
||||||
// Interpret the mouse code
|
// Interpret the mouse code
|
||||||
current_button = (mouse_code & MOUSE_CLICK_MASK);
|
current_button = (mouse_code & MOUSE_CLICK_MASK);
|
||||||
@@ -2812,9 +2813,9 @@ check_termcode_mouse(
|
|||||||
current_button |= MOUSE_RELEASE;
|
current_button |= MOUSE_RELEASE;
|
||||||
|
|
||||||
if (current_button == MOUSE_RELEASE
|
if (current_button == MOUSE_RELEASE
|
||||||
# ifdef FEAT_MOUSE_XTERM
|
#ifdef FEAT_MOUSE_XTERM
|
||||||
&& wheel_code == 0
|
&& wheel_code == 0
|
||||||
# endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -2832,7 +2833,7 @@ check_termcode_mouse(
|
|||||||
{
|
{
|
||||||
if (wheel_code == 0)
|
if (wheel_code == 0)
|
||||||
{
|
{
|
||||||
# ifdef CHECK_DOUBLE_CLICK
|
#ifdef CHECK_DOUBLE_CLICK
|
||||||
# ifdef FEAT_MOUSE_GPM
|
# ifdef FEAT_MOUSE_GPM
|
||||||
/*
|
/*
|
||||||
* Only for Unix, when GUI not active, we handle multi-clicks here, but
|
* Only for Unix, when GUI not active, we handle multi-clicks here, but
|
||||||
@@ -2887,9 +2888,9 @@ check_termcode_mouse(
|
|||||||
else
|
else
|
||||||
orig_num_clicks = NUM_MOUSE_CLICKS(mouse_code);
|
orig_num_clicks = NUM_MOUSE_CLICKS(mouse_code);
|
||||||
# endif
|
# endif
|
||||||
# else
|
#else
|
||||||
orig_num_clicks = NUM_MOUSE_CLICKS(mouse_code);
|
orig_num_clicks = NUM_MOUSE_CLICKS(mouse_code);
|
||||||
# endif
|
#endif
|
||||||
is_click = TRUE;
|
is_click = TRUE;
|
||||||
}
|
}
|
||||||
orig_mouse_code = mouse_code;
|
orig_mouse_code = mouse_code;
|
||||||
@@ -3162,6 +3163,9 @@ vcol2col(win_T *wp, linenr_T lnum, int vcol)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||||
|
/*
|
||||||
|
* "getmousepos()" function.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
f_getmousepos(typval_T *argvars UNUSED, typval_T *rettv)
|
f_getmousepos(typval_T *argvars UNUSED, typval_T *rettv)
|
||||||
{
|
{
|
||||||
@@ -3189,14 +3193,14 @@ f_getmousepos(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
int left_off = 0;
|
int left_off = 0;
|
||||||
int height = wp->w_height + wp->w_status_height;
|
int height = wp->w_height + wp->w_status_height;
|
||||||
|
|
||||||
#ifdef FEAT_PROP_POPUP
|
# ifdef FEAT_PROP_POPUP
|
||||||
if (WIN_IS_POPUP(wp))
|
if (WIN_IS_POPUP(wp))
|
||||||
{
|
{
|
||||||
top_off = popup_top_extra(wp);
|
top_off = popup_top_extra(wp);
|
||||||
left_off = popup_left_extra(wp);
|
left_off = popup_left_extra(wp);
|
||||||
height = popup_height(wp);
|
height = popup_height(wp);
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
if (row < height)
|
if (row < height)
|
||||||
{
|
{
|
||||||
winid = wp->w_id;
|
winid = wp->w_id;
|
||||||
|
@@ -15,7 +15,6 @@ int mouse_model_popup(void);
|
|||||||
void reset_dragwin(void);
|
void reset_dragwin(void);
|
||||||
int jump_to_mouse(int flags, int *inclusive, int which_button);
|
int jump_to_mouse(int flags, int *inclusive, int which_button);
|
||||||
int do_mousescroll_horiz(long_u leftcol);
|
int do_mousescroll_horiz(long_u leftcol);
|
||||||
void do_mousescroll(int mode, cmdarg_T *cap);
|
|
||||||
void nv_mousescroll(cmdarg_T *cap);
|
void nv_mousescroll(cmdarg_T *cap);
|
||||||
void nv_mouse(cmdarg_T *cap);
|
void nv_mouse(cmdarg_T *cap);
|
||||||
void reset_held_button(void);
|
void reset_held_button(void);
|
||||||
|
@@ -695,6 +695,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 */
|
||||||
|
/**/
|
||||||
|
902,
|
||||||
/**/
|
/**/
|
||||||
901,
|
901,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user