comparison src/popupwin.c @ 26332:8b7f01b39d79 v8.2.3697

patch 8.2.3697: cannot drag a popup without a border Commit: https://github.com/vim/vim/commit/0b74d00693f2ff5f45cb5808197df7d1aaa5cb41 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 29 17:38:02 2021 +0000 patch 8.2.3697: cannot drag a popup without a border Problem: Cannot drag a popup without a border. Solution: Add the "dragall" option. (closes https://github.com/vim/vim/issues/9218)
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 Nov 2021 18:45:03 +0100
parents 365e7f083f02
children b18f3b0f317c
comparison
equal deleted inserted replaced
26331:6dd0e218c74e 26332:8b7f01b39d79
295 295
296 popup_adjust_position(wp); 296 popup_adjust_position(wp);
297 return; 297 return;
298 } 298 }
299 299
300 if (!(wp->w_popup_flags & POPF_DRAG)) 300 if (!(wp->w_popup_flags & (POPF_DRAG | POPF_DRAGALL)))
301 return; 301 return;
302 wp->w_wantline = drag_start_wantline + (mouse_row - drag_start_row); 302 wp->w_wantline = drag_start_wantline + (mouse_row - drag_start_row);
303 if (wp->w_wantline < 1) 303 if (wp->w_wantline < 1)
304 wp->w_wantline = 1; 304 wp->w_wantline = 1;
305 if (wp->w_wantline > Rows) 305 if (wp->w_wantline > Rows)
684 { 684 {
685 if (nr) 685 if (nr)
686 wp->w_popup_flags |= POPF_DRAG; 686 wp->w_popup_flags |= POPF_DRAG;
687 else 687 else
688 wp->w_popup_flags &= ~POPF_DRAG; 688 wp->w_popup_flags &= ~POPF_DRAG;
689 }
690 nr = dict_get_bool(dict, (char_u *)"dragall", -1);
691 if (nr != -1)
692 {
693 if (nr)
694 wp->w_popup_flags |= POPF_DRAGALL;
695 else
696 wp->w_popup_flags &= ~POPF_DRAGALL;
689 } 697 }
690 698
691 nr = dict_get_bool(dict, (char_u *)"posinvert", -1); 699 nr = dict_get_bool(dict, (char_u *)"posinvert", -1);
692 if (nr != -1) 700 if (nr != -1)
693 { 701 {
2356 filter_handle_drag(win_T *wp, int c, typval_T *rettv) 2364 filter_handle_drag(win_T *wp, int c, typval_T *rettv)
2357 { 2365 {
2358 int row = mouse_row; 2366 int row = mouse_row;
2359 int col = mouse_col; 2367 int col = mouse_col;
2360 2368
2361 if ((wp->w_popup_flags & POPF_DRAG) 2369 if ((wp->w_popup_flags & (POPF_DRAG | POPF_DRAGALL))
2362 && is_mouse_key(c) 2370 && is_mouse_key(c)
2363 && (wp == popup_dragwin 2371 && (wp == popup_dragwin
2364 || wp == mouse_find_win(&row, &col, FIND_POPUP))) 2372 || wp == mouse_find_win(&row, &col, FIND_POPUP)))
2365 // do not consume the key, allow for dragging the popup 2373 // do not consume the key, allow for dragging the popup
2366 rettv->vval.v_number = 0; 2374 rettv->vval.v_number = 0;
3076 dict_add_number(dict, "textpropid", wp->w_popup_prop_id); 3084 dict_add_number(dict, "textpropid", wp->w_popup_prop_id);
3077 } 3085 }
3078 dict_add_string(dict, "title", wp->w_popup_title); 3086 dict_add_string(dict, "title", wp->w_popup_title);
3079 dict_add_number(dict, "wrap", wp->w_p_wrap); 3087 dict_add_number(dict, "wrap", wp->w_p_wrap);
3080 dict_add_number(dict, "drag", (wp->w_popup_flags & POPF_DRAG) != 0); 3088 dict_add_number(dict, "drag", (wp->w_popup_flags & POPF_DRAG) != 0);
3089 dict_add_number(dict, "dragall",
3090 (wp->w_popup_flags & POPF_DRAGALL) != 0);
3081 dict_add_number(dict, "mapping", 3091 dict_add_number(dict, "mapping",
3082 (wp->w_popup_flags & POPF_MAPPING) != 0); 3092 (wp->w_popup_flags & POPF_MAPPING) != 0);
3083 dict_add_number(dict, "resize", (wp->w_popup_flags & POPF_RESIZE) != 0); 3093 dict_add_number(dict, "resize", (wp->w_popup_flags & POPF_RESIZE) != 0);
3084 dict_add_number(dict, "posinvert", 3094 dict_add_number(dict, "posinvert",
3085 (wp->w_popup_flags & POPF_POSINVERT) != 0); 3095 (wp->w_popup_flags & POPF_POSINVERT) != 0);