Problem: Completion popup in wrong position with virtual text "above".
Solution: Adjust the column. (closes #12210)
// 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
- - curwin->w_wcol - 1;
- else
+ if (right_left)
+ cursor_col = curwin->w_wincol + curwin->w_width - wcol - 1;
+ else
#endif
- cursor_col = curwin->w_wincol + curwin->w_wcol;
+ cursor_col = curwin->w_wincol + wcol;
+ }
// if there are more items than room we need a scrollbar
if (pum_height < size)
--- /dev/null
+|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
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
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1432,
/**/
1431,
/**/