Mercurial > vim
comparison src/ui.c @ 17578:696030820746 v8.1.1786
patch 8.1.1786: double click in popup scrollbar starts selection
commit https://github.com/vim/vim/commit/13b11eddcaf5176fb1127c8bc8f4b4f46bd05488
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 1 15:52:45 2019 +0200
patch 8.1.1786: double click in popup scrollbar starts selection
Problem: Double click in popup scrollbar starts selection.
Solution: Ignore the double click.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 01 Aug 2019 16:00:07 +0200 |
parents | 74b6674b99fd |
children | d5e5d0fc3fa8 |
comparison
equal
deleted
inserted
replaced
17577:bfc0be715b0d | 17578:696030820746 |
---|---|
1056 */ | 1056 */ |
1057 void | 1057 void |
1058 clip_start_selection(int col, int row, int repeated_click) | 1058 clip_start_selection(int col, int row, int repeated_click) |
1059 { | 1059 { |
1060 Clipboard_T *cb = &clip_star; | 1060 Clipboard_T *cb = &clip_star; |
1061 #ifdef FEAT_TEXT_PROP | |
1062 win_T *wp; | |
1063 int row_cp = row; | |
1064 int col_cp = col; | |
1065 | |
1066 wp = mouse_find_win(&row_cp, &col_cp, FIND_POPUP); | |
1067 if (wp != NULL && WIN_IS_POPUP(wp) | |
1068 && popup_is_in_scrollbar(wp, row_cp, col_cp)) | |
1069 // click or double click in scrollbar does not start a selection | |
1070 return; | |
1071 #endif | |
1061 | 1072 |
1062 if (cb->state == SELECT_DONE) | 1073 if (cb->state == SELECT_DONE) |
1063 clip_clear_selection(cb); | 1074 clip_clear_selection(cb); |
1064 | 1075 |
1065 row = check_row(row); | 1076 row = check_row(row); |
1070 cb->start.col = col; | 1081 cb->start.col = col; |
1071 cb->end = cb->start; | 1082 cb->end = cb->start; |
1072 cb->origin_row = (short_u)cb->start.lnum; | 1083 cb->origin_row = (short_u)cb->start.lnum; |
1073 cb->state = SELECT_IN_PROGRESS; | 1084 cb->state = SELECT_IN_PROGRESS; |
1074 #ifdef FEAT_TEXT_PROP | 1085 #ifdef FEAT_TEXT_PROP |
1075 { | 1086 if (wp != NULL && WIN_IS_POPUP(wp)) |
1076 win_T *wp; | 1087 { |
1077 int row_cp = row; | 1088 // Click in a popup window restricts selection to that window, |
1078 int col_cp = col; | 1089 // excluding the border. |
1079 | 1090 cb->min_col = wp->w_wincol + wp->w_popup_border[3]; |
1080 wp = mouse_find_win(&row_cp, &col_cp, FIND_POPUP); | 1091 cb->max_col = wp->w_wincol + popup_width(wp) - 1 |
1081 if (wp != NULL && WIN_IS_POPUP(wp)) | 1092 - wp->w_popup_border[1]; |
1082 { | 1093 cb->min_row = wp->w_winrow + wp->w_popup_border[0]; |
1083 // Click in a popup window restricts selection to that window, | 1094 cb->max_row = wp->w_winrow + popup_height(wp) - 1 |
1084 // excluding the border. | 1095 - wp->w_popup_border[2]; |
1085 cb->min_col = wp->w_wincol + wp->w_popup_border[3]; | 1096 } |
1086 cb->max_col = wp->w_wincol + popup_width(wp) - 1 | 1097 else |
1087 - wp->w_popup_border[1]; | 1098 { |
1088 cb->min_row = wp->w_winrow + wp->w_popup_border[0]; | 1099 cb->min_col = 0; |
1089 cb->max_row = wp->w_winrow + popup_height(wp) - 1 | 1100 cb->max_col = screen_Columns; |
1090 - wp->w_popup_border[2]; | 1101 cb->min_row = 0; |
1091 } | 1102 cb->max_row = screen_Rows; |
1092 else | |
1093 { | |
1094 cb->min_col = 0; | |
1095 cb->max_col = screen_Columns; | |
1096 cb->min_row = 0; | |
1097 cb->max_row = screen_Rows; | |
1098 } | |
1099 } | 1103 } |
1100 #endif | 1104 #endif |
1101 | 1105 |
1102 if (repeated_click) | 1106 if (repeated_click) |
1103 { | 1107 { |