-*insert.txt* For Vim version 9.1. Last change: 2025 Jul 05
+*insert.txt* For Vim version 9.1. Last change: 2025 Jul 17
VIM REFERENCE MANUAL by Bram Moolenaar
Example: >
:set completepopup=height:10,width:60,highlight:InfoPopup
-When the "align" value is "item" then the popup is positioned close to the
-selected item. Changing the selection will also move the popup. When "align"
-is "menu" then the popup is aligned with the top of the menu if the menu is
-below the text, and the bottom of the menu otherwise.
+When `"align"` is set to `"item"`, the popup is positioned near the selected
+item, and moves as the selection changes.
+When set to `"menu"`, the popup aligns with the top of the menu (if the menu
+appears below the text), or with the bottom (if the menu appears above).
-After the info popup is created it can be found with |popup_findinfo()| and
-properties can be changed with |popup_setoptions()|.
+If the 'mouse' is enabled, a close button and resize handle will appear on the
+popup border.
+
+After creation, the info popup can be located with |popup_findinfo()| and
+modified using |popup_setoptions()|.
*complete-popuphidden*
If the information for the popup is obtained asynchronously, use "popuphidden"
-*tabpage.txt* For Vim version 9.1. Last change: 2025 Jul 01
+*tabpage.txt* For Vim version 9.1. Last change: 2025 Jul 17
VIM REFERENCE MANUAL by Bram Moolenaar
windows in a tabpage is also shown. Thus "3+" means three windows and one of
them has a modified buffer.
+An "X" (close button) will appear in the last column when multiple tabs are
+open, but only if the 'mouse' is enabled.
+
The 'tabline' option allows you to define your preferred way to tab pages
labels. This isn't easy, thus an example will be given here.
- the configure script will favor using GTK3 over GTK2 when auto-detecting the
gui toolkit
- |gv| works in operator pending mode and does not abort
+- The close button shown in the non-GUI 'tabline' will only be visible if the
+ 'mouse' option contains either "a" or any of the flags "n", "v", or "i".
*added-9.2*
Added ~
did_set_mouse(optset_T *args)
{
char_u **varp = (char_u **)args->os_varp;
+ char *retval;
- return did_set_option_listflag(*varp, (char_u *)MOUSE_ALL, args->os_errbuf,
+ retval = did_set_option_listflag(*varp, (char_u *)MOUSE_ALL, args->os_errbuf,
args->os_errbuflen);
+ if (retval == NULL)
+ {
+ redraw_tabline = TRUE;
+ if (tabline_height() > 0)
+ update_screen(UPD_VALID);
+#if (defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)) || defined(PROTO)
+ popup_close_info(); // Close info popup to apply new properties
+#endif
+ }
+ return retval;
}
int
if (type == TYPE_INFO)
{
wp->w_popup_pos = POPPOS_TOPLEFT;
- wp->w_popup_flags |= POPF_DRAG | POPF_RESIZE;
- wp->w_popup_close = POPCLOSE_BUTTON;
+ if (mouse_has(MOUSE_INSERT))
+ {
+ wp->w_popup_flags |= POPF_DRAG | POPF_RESIZE;
+ wp->w_popup_close = POPCLOSE_BUTTON;
+ }
add_border_left_right_padding(wp);
parse_completepopup(wp);
}
msg_puts_attr(s, attr);
}
+/*
+ * Return TRUE if mouse is enabled.
+ */
+ static int
+mouse_has_any(void)
+{
+ return mouse_has(MOUSE_NORMAL) || mouse_has(MOUSE_INSERT)
+ || mouse_has(MOUSE_VISUAL);
+}
+
/*
* Draw the tab pages line at the top of the Vim window.
*/
}
// Put an "X" for closing the current tab if there are several.
- if (tabcount > 1)
+ if (tabcount > 1 && mouse_has_any())
{
screen_putchar('X', 0, (int)Columns - 1, attr_nosel);
TabPageIdxs[Columns - 1] = -999;
--- /dev/null
+|t+0&#ffffff0|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| @40
+@75
+|a|w|o|r|d> @15|╔+0#0000001#e0e0e08|═@15|X| +0#0000000#ffffff0@35
+|w+0#0000001#e0e0e08|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| |║| |w|o|r|d|s| |a|r|e| |c|o@1|l| |║| +0#4040ff13#ffffff0@35
+|a+0#0000001#ffd7ff255|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |╚+0&#e0e0e08|═@15|⇲| +0#4040ff13#ffffff0@35
+|n+0#0000001#ffd7ff255|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@53
+|t+0#0000001#ffd7ff255|h|a|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@53
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |U|s|e|r| |d|e|f|i|n|e|d| |c|o|m|p|l|e|t|i|o|n| |(|^|U|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |4| +0#0000000&@26
--- /dev/null
+|t+0&#ffffff0|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| @40
+|a|w|o|r|d> @15|╔+0#0000001#e0e0e08|═@15|╗| +0#0000000#ffffff0@35
+|w+0#0000001#e0e0e08|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| |║| |w|o|r|d|s| |a|r|e| |c|o@1|l| |║| +0#4040ff13#ffffff0@35
+|a+0#0000001#ffd7ff255|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |╚+0&#e0e0e08|═@15|╝| +0#4040ff13#ffffff0@35
+|n+0#0000001#ffd7ff255|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@53
+|t+0#0000001#ffd7ff255|h|a|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@53
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|-+2#0000000&@1| |U|s|e|r| |d|e|f|i|n|e|d| |c|o|m|p|l|e|t|i|o|n| |(|^|U|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |4| +0#0000000&@26
call StopVimInTerminal(buf)
endfunc
+" Info popup should not have close (X) and resize buttons when mouse is
+" disabled.
+func Test_popupmenu_info_border_mouse()
+ CheckScreendump
+ CheckFeature quickfix
+
+ let lines = Get_popupmenu_lines()
+ call writefile(lines, 'XtestInfoPopup', 'D')
+
+ let buf = RunVimInTerminal('-S XtestInfoPopup', #{rows: 14})
+ call TermWait(buf, 25)
+
+ call term_sendkeys(buf, "Go\<CR>\<C-X>\<C-U>")
+ call TermWait(buf, 25)
+ call VerifyScreenDump(buf, 'Test_popupwin_info_border_mouse_1', {})
+
+ call term_sendkeys(buf, "\<ESC>u:set mouse=\<CR>")
+ call term_sendkeys(buf, "o\<C-X>\<C-U>")
+ call TermWait(buf, 25)
+ call VerifyScreenDump(buf, 'Test_popupwin_info_border_mouse_2', {})
+
+ call term_sendkeys(buf, "\<Esc>")
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_popupmenu_info_align_menu()
CheckScreendump
CheckFeature quickfix
set tabline=
endfunc
+" Test that 'X' is removed when mouse is disabled.
+func Test_tabline_mouse_enable()
+ tabnew
+ for val in ['n', 'i', 'v', 'a']
+ set mouse=
+ redraw
+ call assert_notmatch('X$', Screenline(1))
+ execute $'set mouse={val}'
+ redraw
+ call assert_match('X$', Screenline(1))
+ endfor
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1562,
/**/
1561,
/**/