Patch 9.0.1432

4 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 31, 2023, 2:33:17 PM3/31/23
to vim...@googlegroups.com

Patch 9.0.1432
Problem: Completion popup in wrong position with virtual text "above".
Solution: Adjust the column. (closes #12210)
Files: src/popupmenu.c, src/testdir/test_ins_complete.vim,
src/testdir/dumps/Test_ins_complete_popup_position_1.dump


*** ../vim-9.0.1431/src/popupmenu.c 2023-03-15 17:08:46.377596515 +0000
--- src/popupmenu.c 2023-03-31 19:31:05.210577198 +0100
***************
*** 238,250 ****
// cmdline completion popup menu
cursor_col = cmdline_compl_startcol();
else
#ifdef FEAT_RIGHTLEFT
! if (right_left)
! cursor_col = curwin->w_wincol + curwin->w_width
! - curwin->w_wcol - 1;
! else
#endif
! cursor_col = curwin->w_wincol + curwin->w_wcol;

// if there are more items than room we need a scrollbar
if (pum_height < size)
--- 238,253 ----
// cmdline completion popup menu
cursor_col = cmdline_compl_startcol();
else
+ {
+ // w_wcol includes virtual text "above"
+ int wcol = curwin->w_wcol % curwin->w_width;
#ifdef FEAT_RIGHTLEFT
! if (right_left)
! cursor_col = curwin->w_wincol + curwin->w_width - wcol - 1;
! else
#endif
! cursor_col = curwin->w_wincol + wcol;
! }

// if there are more items than room we need a scrollbar
if (pum_height < size)
*** ../vim-9.0.1431/src/testdir/test_ins_complete.vim 2023-03-02 17:51:29.524736925 +0000
--- src/testdir/test_ins_complete.vim 2023-03-31 19:29:28.170894446 +0100
***************
*** 2220,2224 ****
--- 2220,2247 ----
bwipe!
endfunc

+ func Test_ins_complete_popup_position()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ set nowrap
+ setline(1, ['one', 'two', 'this is line ', 'four'])
+ prop_type_add('test', {highlight: 'Error'})
+ prop_add(3, 0, {
+ text_align: 'above',
+ text: 'The quick brown fox jumps over the lazy dog',
+ type: 'test'
+ })
+ END
+ call writefile(lines, 'XinsPopup', 'D')
+ let buf = RunVimInTerminal('-S XinsPopup', #{rows: 10})
+
+ call term_sendkeys(buf, "3GA\<C-N>")
+ call VerifyScreenDump(buf, 'Test_ins_complete_popup_position_1', {})
+
+ call StopVimInTerminal(buf)
+ endfunc
+

" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-9.0.1431/src/testdir/dumps/Test_ins_complete_popup_position_1.dump 2023-03-31 19:31:54.778422080 +0100
--- src/testdir/dumps/Test_ins_complete_popup_position_1.dump 2023-03-31 19:29:31.746882406 +0100
***************
*** 0 ****
--- 1,10 ----
+ |o+0&#ffffff0|n|e| @71
+ |t|w|o| @71
+ |T+0#ffffff16#ff404010|h|e| |q|u|i|c|k| |b|r|o|w|n| |f|o|x| |j|u|m|p|s| |o|v|e|r| |t|h|e| |l|a|z|y| |d|o|g| +0#0000000#ffffff0@31
+ |t|h|i|s| |i|s| |l|i|n|e| |f|o|u|r> @57
+ |f|o|u|r| @7| +0#0000001#e0e0e08|f|o|u|r| @10| +0#0000000#0000001| +0&#ffffff0@45
+ |~+0#4040ff13&| @10| +0#0000001#ffd7ff255|o|n|e| @11| +0#0000000#0000001| +0#4040ff13#ffffff0@45
+ |~| @10| +0#0000001#ffd7ff255|t|w|o| @11| +0#0000000#0000001| +0#4040ff13#ffffff0@45
+ |~| @10| +0#0000001#ffd7ff255|t|h|i|s| @10| +0#0000000#0000001| +0#4040ff13#ffffff0@45
+ |~| @10| +0#0000001#ffd7ff255|i|s| @12| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@45
+ |-+2#0000000&@1| |K|e|y|w|o|r|d| |c|o|m|p|l|e|t|i|o|n| |(|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |6| +0#0000000&@33
*** ../vim-9.0.1431/src/version.c 2023-03-30 21:50:31.138608063 +0100
--- src/version.c 2023-03-31 19:23:48.200203725 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1432,
/**/

--
ARTHUR: Be quiet!
DENNIS: --but by a two-thirds majority in the case of more--
ARTHUR: Be quiet! I order you to be quiet!
WOMAN: Order, eh -- who does he think he is?
ARTHUR: I am your king!
The Quest for the Holy Grail (Monty Python)

/// 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