Patch 9.0.1480

5 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 23, 2023, 11:27:33 AM4/23/23
to vim...@googlegroups.com

Patch 9.0.1480
Problem: Using popup menu may leave text in the command line.
Solution: Clear the command line if the popup menu covered it. (Luuk van
Baal, closes #12286)
Files: src/popupmenu.c, src/testdir/test_menu.vim,
src/testdir/dumps/Test_popupmenu_cmdline_1.dump


*** ../vim-9.0.1479/src/popupmenu.c 2023-03-31 19:32:13.162365622 +0100
--- src/popupmenu.c 2023-04-23 16:14:44.288966806 +0100
***************
*** 18,23 ****
--- 18,24 ----
static int pum_first = 0; // index of top item

static int call_update_screen = FALSE;
+ static int pum_in_cmdline = FALSE;

static int pum_height; // nr of displayed pum items
static int pum_width; // width of displayed pum items
***************
*** 1067,1072 ****
--- 1068,1078 ----
pum_array = NULL;
redraw_all_later(UPD_NOT_VALID);
redraw_tabline = TRUE;
+ if (pum_in_cmdline)
+ {
+ clear_cmdline = TRUE;
+ pum_in_cmdline = FALSE;
+ }
status_redraw_all();
#if defined(FEAT_PROP_POPUP) && defined(FEAT_QUICKFIX)
// hide any popup info window
***************
*** 1193,1198 ****
--- 1199,1206 ----
pum_row = mouse_row + 1;
if (pum_height > Rows - pum_row)
pum_height = Rows - pum_row;
+ if (pum_row + pum_height > cmdline_row)
+ pum_in_cmdline = TRUE;
}
else
{
*** ../vim-9.0.1479/src/testdir/test_menu.vim 2023-04-14 21:54:21.096430659 +0100
--- src/testdir/test_menu.vim 2023-04-23 16:21:38.233131750 +0100
***************
*** 594,597 ****
--- 594,618 ----
call StopVimInTerminal(buf)
endfunc

+ " Test for opening a menu drawn in the cmdline area
+ func Test_popupmenu_cmdline()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set mousemodel=popup
+ menu PopUp.Test1 :<CR>
+ menu PopUp.Test2 :<CR>
+ menu PopUp.Test3 :<CR>
+ call setline(1, repeat(['abcde'], 5))
+ END
+ call writefile(lines, 'Xpopupcmdline', 'D')
+ let buf = RunVimInTerminal('-S Xpopupcmdline', {'rows': 4})
+
+ " cmdline area should be cleared when popupmenu that covered it is closed
+ call term_sendkeys(buf, "\<RightMouse>\<RightRelease>\<Esc>")
+ call VerifyScreenDump(buf, 'Test_popupmenu_cmdline_1', {})
+
+ call StopVimInTerminal(buf)
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.1479/src/testdir/dumps/Test_popupmenu_cmdline_1.dump 2023-04-23 16:23:41.921181055 +0100
--- src/testdir/dumps/Test_popupmenu_cmdline_1.dump 2023-04-23 16:14:44.288966806 +0100
***************
*** 0 ****
--- 1,4 ----
+ >a+0&#ffffff0|b|c|d|e| @69
+ |a|b|c|d|e| @69
+ |a|b|c|d|e| @69
+ @57|1|,|1| @10|T|o|p|
*** ../vim-9.0.1479/src/version.c 2023-04-22 22:54:28.053802328 +0100
--- src/version.c 2023-04-23 16:21:06.453119086 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1480,
/**/

--
A disclaimer for the disclaimer:
"and before I get a huge amount of complaints , I have no control over the
disclaimer at the end of this mail :-)" (Timothy Aldrich)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages