summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-03-31 19:32:29 +0100
committerBram Moolenaar <Bram@vim.org>2023-03-31 19:32:29 +0100
commit6ac2e4392a9d8b89c8824bf94a9da24a6f07c74f (patch)
tree5d5c874e1708b08e1bc8298d9eaea87e484751a8
parent2d68b722e3bca7532eb0d83ce773934618f12db5 (diff)
patch 9.0.1432: completion popup in wrong position with virtual text "above"v9.0.1432
Problem: Completion popup in wrong position with virtual text "above". Solution: Adjust the column. (closes #12210)
-rw-r--r--src/popupmenu.c13
-rw-r--r--src/testdir/dumps/Test_ins_complete_popup_position_1.dump10
-rw-r--r--src/testdir/test_ins_complete.vim23
-rw-r--r--src/version.c2
4 files changed, 43 insertions, 5 deletions
diff --git a/src/popupmenu.c b/src/popupmenu.c
index ea52d80043..d713ed4283 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -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)
diff --git a/src/testdir/dumps/Test_ins_complete_popup_position_1.dump b/src/testdir/dumps/Test_ins_complete_popup_position_1.dump
new file mode 100644
index 0000000000..6c1439bff8
--- /dev/null
+++ b/src/testdir/dumps/Test_ins_complete_popup_position_1.dump
@@ -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
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index 20dd55676a..cedc09f7ad 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 614bffc55e..1be8fbe774 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1432,
+/**/
1431,
/**/
1430,