diff 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
line wrap: on
line diff
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -297,7 +297,7 @@ popup_drag(win_T *wp)
 	return;
     }
 
-    if (!(wp->w_popup_flags & POPF_DRAG))
+    if (!(wp->w_popup_flags & (POPF_DRAG | POPF_DRAGALL)))
 	return;
     wp->w_wantline = drag_start_wantline + (mouse_row - drag_start_row);
     if (wp->w_wantline < 1)
@@ -687,6 +687,14 @@ apply_general_options(win_T *wp, dict_T 
 	else
 	    wp->w_popup_flags &= ~POPF_DRAG;
     }
+    nr = dict_get_bool(dict, (char_u *)"dragall", -1);
+    if (nr != -1)
+    {
+	if (nr)
+	    wp->w_popup_flags |= POPF_DRAGALL;
+	else
+	    wp->w_popup_flags &= ~POPF_DRAGALL;
+    }
 
     nr = dict_get_bool(dict, (char_u *)"posinvert", -1);
     if (nr != -1)
@@ -2358,7 +2366,7 @@ filter_handle_drag(win_T *wp, int c, typ
     int	row = mouse_row;
     int	col = mouse_col;
 
-    if ((wp->w_popup_flags & POPF_DRAG)
+    if ((wp->w_popup_flags & (POPF_DRAG | POPF_DRAGALL))
 	    && is_mouse_key(c)
 	    && (wp == popup_dragwin
 			  || wp == mouse_find_win(&row, &col, FIND_POPUP)))
@@ -3078,6 +3086,8 @@ f_popup_getoptions(typval_T *argvars, ty
 	dict_add_string(dict, "title", wp->w_popup_title);
 	dict_add_number(dict, "wrap", wp->w_p_wrap);
 	dict_add_number(dict, "drag", (wp->w_popup_flags & POPF_DRAG) != 0);
+	dict_add_number(dict, "dragall",
+				      (wp->w_popup_flags & POPF_DRAGALL) != 0);
 	dict_add_number(dict, "mapping",
 				      (wp->w_popup_flags & POPF_MAPPING) != 0);
 	dict_add_number(dict, "resize", (wp->w_popup_flags & POPF_RESIZE) != 0);