mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.1.1786: double click in popup scrollbar starts selection
Problem: Double click in popup scrollbar starts selection. Solution: Ignore the double click.
This commit is contained in:
@@ -304,6 +304,19 @@ popup_set_firstline(win_T *wp)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if the position is in the popup window scrollbar.
|
||||
*/
|
||||
int
|
||||
popup_is_in_scrollbar(win_T *wp, int row, int col)
|
||||
{
|
||||
return wp->w_has_scrollbar
|
||||
&& row >= wp->w_popup_border[0]
|
||||
&& row < popup_height(wp) - wp->w_popup_border[2]
|
||||
&& col == popup_width(wp) - wp->w_popup_border[1] - 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle a click in a popup window, if it is in the scrollbar.
|
||||
*/
|
||||
@@ -313,11 +326,7 @@ popup_handle_scrollbar_click(win_T *wp, int row, int col)
|
||||
int height = popup_height(wp);
|
||||
int old_topline = wp->w_topline;
|
||||
|
||||
if (wp->w_has_scrollbar == 0)
|
||||
return;
|
||||
if (row >= wp->w_popup_border[0]
|
||||
&& row < height - wp->w_popup_border[2]
|
||||
&& col == popup_width(wp) - wp->w_popup_border[1] - 1)
|
||||
if (popup_is_in_scrollbar(wp, row, col))
|
||||
{
|
||||
if (row >= height / 2)
|
||||
{
|
||||
|
@@ -4,6 +4,7 @@ int popup_on_X_button(win_T *wp, int row, int col);
|
||||
void popup_start_drag(win_T *wp);
|
||||
void popup_drag(win_T *wp);
|
||||
void popup_set_firstline(win_T *wp);
|
||||
int popup_is_in_scrollbar(win_T *wp, int row, int col);
|
||||
void popup_handle_scrollbar_click(win_T *wp, int row, int col);
|
||||
int popup_height(win_T *wp);
|
||||
int popup_width(win_T *wp);
|
||||
|
18
src/ui.c
18
src/ui.c
@@ -1058,6 +1058,17 @@ clip_compare_pos(
|
||||
clip_start_selection(int col, int row, int repeated_click)
|
||||
{
|
||||
Clipboard_T *cb = &clip_star;
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
win_T *wp;
|
||||
int row_cp = row;
|
||||
int col_cp = col;
|
||||
|
||||
wp = mouse_find_win(&row_cp, &col_cp, FIND_POPUP);
|
||||
if (wp != NULL && WIN_IS_POPUP(wp)
|
||||
&& popup_is_in_scrollbar(wp, row_cp, col_cp))
|
||||
// click or double click in scrollbar does not start a selection
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (cb->state == SELECT_DONE)
|
||||
clip_clear_selection(cb);
|
||||
@@ -1072,12 +1083,6 @@ clip_start_selection(int col, int row, int repeated_click)
|
||||
cb->origin_row = (short_u)cb->start.lnum;
|
||||
cb->state = SELECT_IN_PROGRESS;
|
||||
#ifdef FEAT_TEXT_PROP
|
||||
{
|
||||
win_T *wp;
|
||||
int row_cp = row;
|
||||
int col_cp = col;
|
||||
|
||||
wp = mouse_find_win(&row_cp, &col_cp, FIND_POPUP);
|
||||
if (wp != NULL && WIN_IS_POPUP(wp))
|
||||
{
|
||||
// Click in a popup window restricts selection to that window,
|
||||
@@ -1096,7 +1101,6 @@ clip_start_selection(int col, int row, int repeated_click)
|
||||
cb->min_row = 0;
|
||||
cb->max_row = screen_Rows;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (repeated_click)
|
||||
|
@@ -773,6 +773,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1786,
|
||||
/**/
|
||||
1785,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user