0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.0.1432: completion popup in wrong position with virtual text "above"

Problem:    Completion popup in wrong position with virtual text "above".
Solution:   Adjust the column. (closes #12210)
This commit is contained in:
Bram Moolenaar 2023-03-31 19:32:29 +01:00
parent 2d68b722e3
commit 6ac2e4392a
4 changed files with 43 additions and 5 deletions

View File

@ -238,13 +238,16 @@ pum_display(
// 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)

View File

@ -0,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

View File

@ -2220,5 +2220,28 @@ func Test_tagfunc_wipes_out_buffer()
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

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1432,
/**/
1431,
/**/