Patch 8.2.3697
Problem:    Cannot drag a popup without a border.
Solution:   Add the "dragall" option. (closes #9218)
Files:      runtime/doc/popup.txt, src/mouse.c, src/popupwin.c, src/vim.h,
            src/testdir/test_popupwin.vim,
            src/testdir/dumps/Test_popupwin_drag_05.dump,
            src/testdir/dumps/Test_popupwin_drag_06.dump


*** ../vim-8.2.3696/runtime/doc/popup.txt       2021-01-31 16:02:06.258490157 
+0000
--- runtime/doc/popup.txt       2021-11-29 17:16:24.663080902 +0000
***************
*** 669,674 ****
--- 681,689 ----
                        popup does not have a border. As soon as dragging
                        starts and "pos" is "center" it is changed to
                        "topleft".
+       dragall         TRUE to allow the popup to be dragged from every
+                       position.  Makes it very difficult to select text in
+                       the popup.
        resize          TRUE to allow the popup to be resized with the mouse
                        by grabbing at the bottom right corner.  Has no effect
                        if the popup does not have a border.
*** ../vim-8.2.3696/src/mouse.c 2021-11-26 15:57:14.306265440 +0000
--- src/mouse.c 2021-11-29 17:18:50.602826524 +0000
***************
*** 1636,1643 ****
            {
                return IN_UNKNOWN;
            }
!           else if ((wp->w_popup_flags & (POPF_DRAG | POPF_RESIZE))
                                              && popup_on_border(wp, row, col))
            {
                popup_dragwin = wp;
                popup_start_drag(wp, row, col);
--- 1636,1644 ----
            {
                return IN_UNKNOWN;
            }
!           else if (((wp->w_popup_flags & (POPF_DRAG | POPF_RESIZE))
                                              && popup_on_border(wp, row, col))
+                                      || (wp->w_popup_flags & POPF_DRAGALL))
            {
                popup_dragwin = wp;
                popup_start_drag(wp, row, col);
*** ../vim-8.2.3696/src/popupwin.c      2021-11-24 16:19:41.389010087 +0000
--- src/popupwin.c      2021-11-29 17:23:29.826387975 +0000
***************
*** 297,303 ****
        return;
      }
  
!     if (!(wp->w_popup_flags & POPF_DRAG))
        return;
      wp->w_wantline = drag_start_wantline + (mouse_row - drag_start_row);
      if (wp->w_wantline < 1)
--- 297,303 ----
        return;
      }
  
!     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,692 ****
--- 687,700 ----
        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,2364 ****
      int       row = mouse_row;
      int       col = mouse_col;
  
!     if ((wp->w_popup_flags & POPF_DRAG)
            && is_mouse_key(c)
            && (wp == popup_dragwin
                          || wp == mouse_find_win(&row, &col, FIND_POPUP)))
--- 2366,2372 ----
      int       row = mouse_row;
      int       col = mouse_col;
  
!     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,3083 ****
--- 3086,3093 ----
        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);
*** ../vim-8.2.3696/src/vim.h   2021-11-24 16:19:41.389010087 +0000
--- src/vim.h   2021-11-29 17:20:26.870669544 +0000
***************
*** 638,649 ****
  #define POPF_HIDDEN   0x02    // popup is not displayed
  #define POPF_CURSORLINE       0x04    // popup is highlighting at the 
cursorline
  #define POPF_ON_CMDLINE       0x08    // popup overlaps command line
! #define POPF_DRAG     0x10    // popup can be moved by dragging
! #define POPF_RESIZE   0x20    // popup can be resized by dragging
! #define POPF_MAPPING  0x40    // mapping keys
! #define POPF_INFO     0x80    // used for info of popup menu
! #define POPF_INFO_MENU        0x100   // align info popup with popup menu
! #define POPF_POSINVERT        0x200   // vertical position can be inverted
  
  // flags used in w_popup_handled
  #define POPUP_HANDLED_1           0x01    // used by mouse_find_win()
--- 638,650 ----
  #define POPF_HIDDEN   0x02    // popup is not displayed
  #define POPF_CURSORLINE       0x04    // popup is highlighting at the 
cursorline
  #define POPF_ON_CMDLINE       0x08    // popup overlaps command line
! #define POPF_DRAG     0x10    // popup can be moved by dragging border
! #define POPF_DRAGALL  0x20    // popup can be moved by dragging everywhere
! #define POPF_RESIZE   0x40    // popup can be resized by dragging
! #define POPF_MAPPING  0x80    // mapping keys
! #define POPF_INFO     0x100   // used for info of popup menu
! #define POPF_INFO_MENU        0x200   // align info popup with popup menu
! #define POPF_POSINVERT        0x400   // vertical position can be inverted
  
  // flags used in w_popup_handled
  #define POPUP_HANDLED_1           0x01    // used by mouse_find_win()
*** ../vim-8.2.3696/src/testdir/test_popupwin.vim       2021-11-26 
15:57:14.310265430 +0000
--- src/testdir/test_popupwin.vim       2021-11-29 17:34:51.452059151 +0000
***************
*** 565,586 ****
              \ line: &lines - 4,
              \ })
        func Dragit()
          call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt")
        endfunc
-       map <silent> <F3> :call test_setmouse(&lines - 4, &columns / 2)<CR>
-       map <silent> <F4> :call test_setmouse(&lines - 8, &columns / 2 - 20)<CR>
        func Resize()
          call feedkeys("\<F5>\<LeftMouse>\<F6>\<LeftDrag>\<LeftRelease>", "xt")
        endfunc
-       map <silent> <F5> :call test_setmouse(6, 21)<CR>
-       map <silent> <F6> :call test_setmouse(7, 25)<CR>
        func ClickAndDrag()
!         call feedkeys("\<F7>\<LeftMouse>\<LeftRelease>", "xt")
!         call feedkeys("\<F8>\<LeftMouse>\<F9>\<LeftDrag>\<LeftRelease>", "xt")
        endfunc
-       map <silent> <F7> :call test_setmouse(5, 2)<CR>
-       map <silent> <F8> :call test_setmouse(3, 14)<CR>
-       map <silent> <F9> :call test_setmouse(3, 18)<CR>
    END
    call writefile(lines, 'XtestPopupDrag')
    let buf = RunVimInTerminal('-S XtestPopupDrag', #{rows: 10})
--- 565,595 ----
              \ line: &lines - 4,
              \ })
        func Dragit()
+         map <silent> <F3> :call test_setmouse(&lines - 4, &columns / 2)<CR>
+         map <silent> <F4> :call test_setmouse(&lines - 8, &columns / 2 - 
20)<CR>
          call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt")
        endfunc
        func Resize()
+         map <silent> <F5> :call test_setmouse(6, 21)<CR>
+         map <silent> <F6> :call test_setmouse(7, 25)<CR>
          call feedkeys("\<F5>\<LeftMouse>\<F6>\<LeftDrag>\<LeftRelease>", "xt")
        endfunc
        func ClickAndDrag()
!         map <silent> <F3> :call test_setmouse(5, 2)<CR>
!         map <silent> <F4> :call test_setmouse(3, 14)<CR>
!         map <silent> <F5> :call test_setmouse(3, 18)<CR>
!         call feedkeys("\<F3>\<LeftMouse>\<LeftRelease>", "xt")
!         call feedkeys("\<F4>\<LeftMouse>\<F5>\<LeftDrag>\<LeftRelease>", "xt")
!       endfunc
!       func DragAllStart()
!         call popup_clear()
!         call popup_create('hello', #{line: 3, col: 5, dragall: 1})
!       endfunc
!       func DragAllDrag()
!         map <silent> <F3> :call test_setmouse(3, 5)<CR>
!         map <silent> <F4> :call test_setmouse(5, 36)<CR>
!         call feedkeys("\<F3>\<LeftMouse>\<F4>\<LeftDrag>\<LeftRelease>", "xt")
        endfunc
    END
    call writefile(lines, 'XtestPopupDrag')
    let buf = RunVimInTerminal('-S XtestPopupDrag', #{rows: 10})
***************
*** 596,601 ****
--- 605,616 ----
    call term_sendkeys(buf, ":call ClickAndDrag()\<CR>")
    call VerifyScreenDump(buf, 'Test_popupwin_drag_04', {})
  
+   " dragging without border
+   call term_sendkeys(buf, ":call DragAllStart()\<CR>")
+   call VerifyScreenDump(buf, 'Test_popupwin_drag_05', {})
+   call term_sendkeys(buf, ":call DragAllDrag()\<CR>")
+   call VerifyScreenDump(buf, 'Test_popupwin_drag_06', {})
+ 
    " clean up
    call StopVimInTerminal(buf)
    call delete('XtestPopupDrag')
*** ../vim-8.2.3696/src/testdir/dumps/Test_popupwin_drag_05.dump        
2021-11-29 17:37:02.355424067 +0000
--- src/testdir/dumps/Test_popupwin_drag_05.dump        2021-11-29 
17:34:54.340044146 +0000
***************
*** 0 ****
--- 1,10 ----
+ >1+0&#ffffff0| @35||+1&&|1+0&&| @35
+ |2| @35||+1&&|2+0&&| @35
+ |3| @2|h+0#0000001#ffd7ff255|e|l@1|o| +0#0000000#ffffff0@27||+1&&|3+0&&| @35
+ |4| @35||+1&&|4+0&&| @35
+ |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p| |[+1&&|N|o| |N|a|m|e|]| 
|[|+|]| @5|1|,|1| @11|T|o|p
+ |1+0&&| @35||+1&&|1+0&&| @35
+ |2| @35||+1&&|2+0&&| @35
+ |3| @35||+1&&|3+0&&| @35
+ |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p| |[|N|o| |N|a|m|e|]| 
|[|+|]| @5|1|,|1| @11|T|o|p
+ |:+0&&|c|a|l@1| |D|r|a|g|A|l@1|S|t|a|r|t|(|)| @54
*** ../vim-8.2.3696/src/testdir/dumps/Test_popupwin_drag_06.dump        
2021-11-29 17:37:02.359424049 +0000
--- src/testdir/dumps/Test_popupwin_drag_06.dump        2021-11-29 
17:34:55.396038670 +0000
***************
*** 0 ****
--- 1,10 ----
+ >1+0&#ffffff0| @35||+1&&|1+0&&| @35
+ |2| @35||+1&&|2+0&&| @35
+ |3| @35||+1&&|3+0&&| @35
+ |4| @35||+1&&|4+0&&| @35
+ |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| 
@11|T|h+0#0000001#ffd7ff255|e|l@1|o|o+1#0000000#ffffff0| |N|a|m|e|]| |[|+|]| 
@5|1|,|1| @11|T|o|p
+ |1+0&&| @35||+1&&|1+0&&| @35
+ |2| @35||+1&&|2+0&&| @35
+ |3| @35||+1&&|3+0&&| @35
+ |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @5|1|,|1| @11|T|o|p| |[|N|o| |N|a|m|e|]| 
|[|+|]| @5|1|,|1| @11|T|o|p
+ |:+0&&|c|a|l@1| |D|r|a|g|A|l@1|D|r|a|g|(|)| @55
*** ../vim-8.2.3696/src/version.c       2021-11-29 16:01:45.384711994 +0000
--- src/version.c       2021-11-29 17:36:18.483627190 +0000
***************
*** 759,760 ****
--- 759,762 ----
  {   /* Add new patch number below this line */
+ /**/
+     3697,
  /**/

-- 
SOLDIER: What? A swallow carrying a coconut?
ARTHUR:  It could grip it by the husk ...
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211129173838.092481C4F5E%40moolenaar.net.

Raspunde prin e-mail lui