]> granicus.if.org Git - vim/commitdiff
patch 8.1.1537: using "tab" for popup window can be confusing v8.1.1537
authorBram Moolenaar <Bram@vim.org>
Sat, 15 Jun 2019 12:14:31 +0000 (14:14 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 15 Jun 2019 12:14:31 +0000 (14:14 +0200)
Problem:    Using "tab" for popup window can be confusing.
Solution:   Use "tabpage". (Hirohito Higashi, closes #4532)

runtime/doc/popup.txt
src/popupwin.c
src/testdir/test_popupwin.vim
src/version.c

index 7da0d1689605a5a7151f16340a9083d71e31346f..71c7bc0d30ffecdd43dd13347bcf3c6fbfb676e1 100644 (file)
@@ -40,11 +40,12 @@ The default color used is "Pmenu".  If you prefer something else use the
 
 A popup window has a window-ID like other windows, but behaves differently.
 The size can be up to the whole Vim window and it overlaps other windows.
-Popup windows can also overlap each other.
+Popup windows can also overlap each other.  The "zindex" property specifies
+what goes on top of what.
 
 The popup window contains a buffer, and that buffer is always associated with
-the popup window.  The window cannot be used in Normal, Visual or Insert mode,
-it does not get keyboard focus.  You can use functions like `setbufline()` to
+the popup window.  The window cannot be in Normal, Visual or Insert mode, it
+does not get keyboard focus.  You can use functions like `setbufline()` to
 change the text in the buffer.  There are more differences from how this
 window and buffer behave compared to regular windows and buffers, see
 |popup-buffer|.
@@ -85,17 +86,16 @@ that it is in.
 
 
 
-IMPLEMENTATION:
+TODO:
 - Why does 'nrformats' leak from the popup window buffer???
 - Disable commands, feedkeys(), CTRL-W, etc. in a popup window.
   Use NOT_IN_POPUP_WINDOW for more commands.
 - Add 'balloonpopup': instead of showing text, let the callback open a popup
   window and return the window ID.   The popup will then be closed when the
   mouse moves, except when it moves inside the popup.
+- For notifications use the PopupNotification highlight group, fall back to
+  WarningMsg if it isn't defined.
 - For the "moved" property also include mouse movement?
-- When selecting text in the popup with modeless selection, do not select
-  outside of the popup and don't select the border or padding.
-- Add test for dragging the popup window.
 - Make redrawing more efficient and avoid flicker:
     - put popup menu also put in popup_mask?
 - Invoke filter with character before mapping?
@@ -105,7 +105,17 @@ IMPLEMENTATION:
 - When drawing on top half a double-wide character, display ">" or "<" in the
   incomplete cell.
 - Can the buffer be re-used, to avoid using up lots of buffer numbers?
-- Implement all the unimplemented options and features.
+- Implement:
+       popup_dialog({text}, {options})
+       popup_filter_menu({id}, {key})
+       popup_filter_yesno({id}, {key})
+       popup_menu({text}, {options})
+       popup_setoptions({id}, {options})
+       flip option
+       hidden option
+       tabpage option with number
+       title option
+       transparent text property
 
 
 ==============================================================================
@@ -140,7 +150,7 @@ Other:
        |popup_getpos()|        get actual position and size of a popup
 
 
-[functions to be moved to eval.txt later]
+[functions help to be moved to eval.txt later]
 
 popup_atcursor({text}, {options})                       *popup_atcursor()*
                Show the {text} above the cursor, and close it when the cursor
@@ -291,7 +301,7 @@ popup_notification({text}, {options})                        *popup_notification()*
                                \ 'line': 1,
                                \ 'col': 10,
                                \ 'time': 3000,
-                               \ 'tab': -1,
+                               \ 'tabpage': -1,
                                \ 'zindex': 200,
                                \ 'drag': 1,
                                \ 'highlight': 'WarningMsg',
@@ -402,11 +412,11 @@ The second argument of |popup_create()| is a dictionary with options:
        hidden          When TRUE the popup exists but is not displayed; use
                        `popup_show()` to unhide it.
                        {not implemented yet}
-       tab             When -1: display the popup on all tabs.
+       tabpage         When -1: display the popup on all tabs.
                        When 0 (the default): display the popup on the current
-                       tab.
+                       tab page.
                        Otherwise the number of the tab page the popup is
-                       displayed on; when invalid the current tab is used.
+                       displayed on; when invalid the current tab page is used.
                        {only -1 and 0 are implemented}
        title           Text to be displayed above the first item in the
                        popup, on top of any border.  If there is no top
index 5265b4b9b370938f0467882701b0170169a56efd..594fca8a005cbbc0c6e0d39adc3c2e00d6484d00 100644 (file)
@@ -748,8 +748,8 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
     // Avoid that 'buftype' is reset when this buffer is entered.
     buf->b_p_initialized = TRUE;
 
-    if (dict_find(d, (char_u *)"tab", -1) != NULL)
-       nr = (int)dict_get_number(d, (char_u *)"tab");
+    if (dict_find(d, (char_u *)"tabpage", -1) != NULL)
+       nr = (int)dict_get_number(d, (char_u *)"tabpage");
     else if (type == TYPE_NOTIFICATION)
        nr = -1;  // notifications are global by default
     else
@@ -757,7 +757,7 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
 
     if (nr == 0)
     {
-       // popup on current tab
+       // popup on current tab page
        wp->w_next = curtab->tp_first_popupwin;
        curtab->tp_first_popupwin = wp;
     }
@@ -1228,7 +1228,7 @@ not_in_popup_window()
 
 /*
  * Reset all the POPF_HANDLED flags in global popup windows and popup windows
- * in the current tab.
+ * in the current tab page.
  */
     void
 popup_reset_handled()
index be86fdc5466f7c2c993e5ba6d2052d29a0a96287..789c8599f7da153cff6bc00f6d0d6bdca88af304 100644 (file)
@@ -372,7 +372,7 @@ func Test_popup_in_tab()
   call assert_equal(0, bufexists(bufnr))
 
   " global popup is visible in any tab
-  let winid = popup_create("text", {'tab': -1})
+  let winid = popup_create("text", {'tabpage': -1})
   call assert_equal(1, popup_getpos(winid).visible)
   tabnew
   call assert_equal(1, popup_getpos(winid).visible)
index f379701ab0d38a93f379c4c1a44632e6cd53d24f..f36b98689d064dd54ae53f443805e73720a24483 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1537,
 /**/
     1536,
 /**/