comparison src/popupwin.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 cc2c4179427c
children d5e5d0fc3fa8
comparison
equal deleted inserted replaced
17577:bfc0be715b0d 17578:696030820746
303 popup_adjust_position(wp); 303 popup_adjust_position(wp);
304 } 304 }
305 } 305 }
306 306
307 /* 307 /*
308 * Return TRUE if the position is in the popup window scrollbar.
309 */
310 int
311 popup_is_in_scrollbar(win_T *wp, int row, int col)
312 {
313 return wp->w_has_scrollbar
314 && row >= wp->w_popup_border[0]
315 && row < popup_height(wp) - wp->w_popup_border[2]
316 && col == popup_width(wp) - wp->w_popup_border[1] - 1;
317 }
318
319
320 /*
308 * Handle a click in a popup window, if it is in the scrollbar. 321 * Handle a click in a popup window, if it is in the scrollbar.
309 */ 322 */
310 void 323 void
311 popup_handle_scrollbar_click(win_T *wp, int row, int col) 324 popup_handle_scrollbar_click(win_T *wp, int row, int col)
312 { 325 {
313 int height = popup_height(wp); 326 int height = popup_height(wp);
314 int old_topline = wp->w_topline; 327 int old_topline = wp->w_topline;
315 328
316 if (wp->w_has_scrollbar == 0) 329 if (popup_is_in_scrollbar(wp, row, col))
317 return;
318 if (row >= wp->w_popup_border[0]
319 && row < height - wp->w_popup_border[2]
320 && col == popup_width(wp) - wp->w_popup_border[1] - 1)
321 { 330 {
322 if (row >= height / 2) 331 if (row >= height / 2)
323 { 332 {
324 // Click in lower half, scroll down. 333 // Click in lower half, scroll down.
325 if (wp->w_topline < wp->w_buffer->b_ml.ml_line_count) 334 if (wp->w_topline < wp->w_buffer->b_ml.ml_line_count)