From cdfa395ad83a019e27044b1b630aa44b08df6d71 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Tue, 1 Jan 2019 15:14:43 +0100 Subject: popupmenu: fix positioning with vsplits --- src/nvim/popupmnu.c | 2 +- test/functional/ui/popupmenu_spec.lua | 76 +++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c index b5c74b5255..056770f2c0 100644 --- a/src/nvim/popupmnu.c +++ b/src/nvim/popupmnu.c @@ -94,7 +94,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed) if (curwin->w_p_rl) { col = curwin->w_width - curwin->w_wcol - 1; } else { - col = curwin->w_wincol + curwin->w_wcol; + col = curwin->w_wcol; } int grid = (int)curwin->w_grid.handle; diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 606c7c1e26..af9abeba80 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed = helpers.clear, helpers.feed local source = helpers.source +local insert = helpers.insert describe('ui/ext_popupmenu', function() local screen @@ -257,4 +258,79 @@ describe('popup placement', function() {2:-- }{5:match 1 of 10} | ]]) end) + + it('works with vsplits', function() + insert('aaa aab aac\n') + feed(':vsplit') + screen:expect([[ + aaa aab aac {3:│}aaa aab aac| + ^ {3:│} | + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {4:[No Name] [+] }{3:') + screen:expect([[ + aaa aab aac {3:│}aaa aab aac| + bbb aaa^ {3:│}bbb aaa | + {1:~ }{s: aaa }{1: }{3:│}{1:~ }| + {1:~ }{n: aab }{1: }{3:│}{1:~ }| + {1:~ }{n: aac }{1: }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {4:[No Name] [+] }{3:oc a') + screen:expect([[ + aaa aab aac{3:│}aaa aab aac | + bbb aaa {3:│}bbb aaa | + c aaa {3:│}c aaa^ | + {1:~ }{3:│}{1:~}{s: aaa }{1: }| + {1:~ }{3:│}{1:~}{n: aab }{1: }| + {1:~ }{3:│}{1:~}{n: aac }{1: }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {1:~ }{3:│}{1:~ }| + {3: