forked from aniani/vim
patch 8.1.1884: cannot use mouse scroll wheel in popup in Insert mode
Problem: Cannot use mouse scroll wheel in popup in Insert mode. Mouse clicks in popup close the popup menu. Solution: Check if the mouse is in a popup window. Do not let mouse events close the popup menu. (closes #4544)
This commit is contained in:
@@ -5267,7 +5267,7 @@ ins_mousescroll(int dir)
|
|||||||
col = mouse_col;
|
col = mouse_col;
|
||||||
|
|
||||||
/* find the window at the pointer coordinates */
|
/* find the window at the pointer coordinates */
|
||||||
wp = mouse_find_win(&row, &col, FAIL_POPUP);
|
wp = mouse_find_win(&row, &col, FIND_POPUP);
|
||||||
if (wp == NULL)
|
if (wp == NULL)
|
||||||
return;
|
return;
|
||||||
curwin = wp;
|
curwin = wp;
|
||||||
@@ -5288,6 +5288,10 @@ ins_mousescroll(int dir)
|
|||||||
(long)(curwin->w_botline - curwin->w_topline));
|
(long)(curwin->w_botline - curwin->w_topline));
|
||||||
else
|
else
|
||||||
scroll_redraw(dir, 3L);
|
scroll_redraw(dir, 3L);
|
||||||
|
# ifdef FEAT_TEXT_PROP
|
||||||
|
if (WIN_IS_POPUP(curwin))
|
||||||
|
popup_set_firstline(curwin);
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
else
|
else
|
||||||
|
@@ -1943,6 +1943,36 @@ ins_compl_prep(int c)
|
|||||||
|| c == K_MOUSELEFT || c == K_MOUSERIGHT)
|
|| c == K_MOUSELEFT || c == K_MOUSERIGHT)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
|
#ifdef FEAT_TEXT_PROP
|
||||||
|
// Ignore mouse events in a popup window
|
||||||
|
if (is_mouse_key(c))
|
||||||
|
{
|
||||||
|
// Ignore drag and release events, the position does not need to be in
|
||||||
|
// the popup and it may have just closed.
|
||||||
|
if (c == K_LEFTRELEASE
|
||||||
|
|| c == K_LEFTRELEASE_NM
|
||||||
|
|| c == K_MIDDLERELEASE
|
||||||
|
|| c == K_RIGHTRELEASE
|
||||||
|
|| c == K_X1RELEASE
|
||||||
|
|| c == K_X2RELEASE
|
||||||
|
|| c == K_LEFTDRAG
|
||||||
|
|| c == K_MIDDLEDRAG
|
||||||
|
|| c == K_RIGHTDRAG
|
||||||
|
|| c == K_X1DRAG
|
||||||
|
|| c == K_X2DRAG)
|
||||||
|
return retval;
|
||||||
|
if (popup_visible)
|
||||||
|
{
|
||||||
|
int row = mouse_row;
|
||||||
|
int col = mouse_col;
|
||||||
|
win_T *wp = mouse_find_win(&row, &col, FIND_POPUP);
|
||||||
|
|
||||||
|
if (wp != NULL && WIN_IS_POPUP(wp))
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set "compl_get_longest" when finding the first matches.
|
// Set "compl_get_longest" when finding the first matches.
|
||||||
if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET
|
if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET
|
||||||
|| (ctrl_x_mode == CTRL_X_NORMAL && !compl_started))
|
|| (ctrl_x_mode == CTRL_X_NORMAL && !compl_started))
|
||||||
|
@@ -638,6 +638,7 @@ pum_set_selected(int n, int repeat)
|
|||||||
{
|
{
|
||||||
int resized = FALSE;
|
int resized = FALSE;
|
||||||
int context = pum_height / 2;
|
int context = pum_height / 2;
|
||||||
|
int prev_selected = pum_selected;
|
||||||
#ifdef FEAT_TEXT_PROP
|
#ifdef FEAT_TEXT_PROP
|
||||||
int has_info = FALSE;
|
int has_info = FALSE;
|
||||||
#endif
|
#endif
|
||||||
@@ -826,7 +827,16 @@ pum_set_selected(int n, int repeat)
|
|||||||
|
|
||||||
curbuf->b_changed = 0;
|
curbuf->b_changed = 0;
|
||||||
curbuf->b_p_ma = FALSE;
|
curbuf->b_p_ma = FALSE;
|
||||||
curwin->w_cursor.lnum = 1;
|
if (pum_selected != prev_selected)
|
||||||
|
{
|
||||||
|
# ifdef FEAT_TEXT_PROP
|
||||||
|
curwin->w_firstline = 1;
|
||||||
|
# endif
|
||||||
|
curwin->w_topline = 1;
|
||||||
|
}
|
||||||
|
else if (curwin->w_topline > curbuf->b_ml.ml_line_count)
|
||||||
|
curwin->w_topline = curbuf->b_ml.ml_line_count;
|
||||||
|
curwin->w_cursor.lnum = curwin->w_topline;
|
||||||
curwin->w_cursor.col = 0;
|
curwin->w_cursor.col = 0;
|
||||||
if (use_popup && win_valid(curwin_save))
|
if (use_popup && win_valid(curwin_save))
|
||||||
redraw_win_later(curwin_save, SOME_VALID);
|
redraw_win_later(curwin_save, SOME_VALID);
|
||||||
|
@@ -769,6 +769,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 */
|
||||||
|
/**/
|
||||||
|
1884,
|
||||||
/**/
|
/**/
|
||||||
1883,
|
1883,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user