From 8bc973c6f59c6b90917dafc025303e69835167a3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 3 May 2023 01:13:03 +0800 Subject: [PATCH] fix(pum): fix missing scrollbar with 'rightleft' (#23448) --- src/nvim/popupmenu.c | 3 + test/functional/ui/popupmenu_spec.lua | 79 +++++++-------------------- 2 files changed, 23 insertions(+), 59 deletions(-) diff --git a/src/nvim/popupmenu.c b/src/nvim/popupmenu.c index e3166b0c02..ed16112d57 100644 --- a/src/nvim/popupmenu.c +++ b/src/nvim/popupmenu.c @@ -452,6 +452,9 @@ void pum_redraw(void) } if (pum_scrollbar > 0) { grid_width++; + if (pum_rl) { + col_off++; + } } grid_assign_handle(&pum_grid); diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 4c0ecd9c4e..61b815dbf6 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -2658,10 +2658,11 @@ describe('builtin popupmenu', function() end it('with rightleft vsplits', function() - screen:try_resize(40, 8) + screen:try_resize(40, 6) command('set rightleft') command('rightbelow vsplit') - command("set completeopt+=noinsert,noselect") + command('set completeopt+=noinsert,noselect') + command('set pumheight=2') feed('isome rightleft ') funcs.complete(16, {'word', 'choice', 'text', 'thing'}) if multigrid then @@ -2671,8 +2672,6 @@ describe('builtin popupmenu', function() [2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]| - [2:-------------------]│[4:--------------------]| - [2:-------------------]│[4:--------------------]| {3:[No Name] [+] }{4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -2680,8 +2679,6 @@ describe('builtin popupmenu', function() {1: ~}| {1: ~}| {1: ~}| - {1: ~}| - {1: ~}| ## grid 3 {2:-- INSERT --} | ## grid 4 @@ -2689,23 +2686,17 @@ describe('builtin popupmenu', function() {1: ~}| {1: ~}| {1: ~}| - {1: ~}| - {1: ~}| ## grid 5 - {n: drow }| - {n: eciohc }| - {n: txet }| - {n: gniht }| + {c: }{n: drow }| + {s: }{n: eciohc }| ]], float_pos={ - [5] = {{id = -1}, "NW", 4, 1, -10, false, 100}; + [5] = {{id = -1}, "NW", 4, 1, -11, false, 100}; }} else screen:expect([[ tfelthgir emos│ ^ tfelthgir emos| - {1: }{n: drow }{1: ~}| - {1: }{n: eciohc }{1: ~}| - {1: }{n: txet }{1: ~}| - {1: }{n: gniht }{1: ~}| + {1: }{c: }{n: drow }{1: ~}| + {1: }{s: }{n: eciohc }{1: ~}| {1: ~}│{1: ~}| {3:[No Name] [+] }{4:[No Name] [+] }| {2:-- INSERT --} | @@ -2720,8 +2711,6 @@ describe('builtin popupmenu', function() [2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]| - [2:-------------------]│[4:--------------------]| - [2:-------------------]│[4:--------------------]| {3:[No Name] [+] }{4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -2729,8 +2718,6 @@ describe('builtin popupmenu', function() | {1: ~}| {1: ~}| - {1: ~}| - {1: ~}| ## grid 3 {2:-- INSERT --} | ## grid 4 @@ -2738,24 +2725,18 @@ describe('builtin popupmenu', function() ^ | {1: ~}| {1: ~}| - {1: ~}| - {1: ~}| ## grid 5 - {n: drow}| - {n: eciohc}| - {n: txet}| - {n: gniht}| + {c: }{n: drow}| + {s: }{n: eciohc}| ]], float_pos={ - [5] = {{id = -1}, "NW", 4, 2, 5, false, 100}; + [5] = {{id = -1}, "NW", 4, 2, 4, false, 100}; }} else screen:expect([[ tfelthgir emos│ tfelthgir emos| │ ^ | - {1: ~}│{1: }{n: drow}| - {1: ~}│{1: }{n: eciohc}| - {1: ~}│{1: }{n: txet}| - {1: ~}│{1: }{n: gniht}| + {1: ~}│{1: }{c: }{n: drow}| + {1: ~}│{1: }{s: }{n: eciohc}| {3:[No Name] [+] }{4:[No Name] [+] }| {2:-- INSERT --} | ]]) @@ -2769,8 +2750,6 @@ describe('builtin popupmenu', function() [2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]| - [2:-------------------]│[4:--------------------]| - [2:-------------------]│[4:--------------------]| {3:[No Name] [+] }{4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -2778,8 +2757,6 @@ describe('builtin popupmenu', function() | {1: ~}| {1: ~}| - {1: ~}| - {1: ~}| ## grid 3 ^ | ## grid 4 @@ -2787,8 +2764,6 @@ describe('builtin popupmenu', function() | {1: ~}| {1: ~}| - {1: ~}| - {1: ~}| ]]} else screen:expect([[ @@ -2796,8 +2771,6 @@ describe('builtin popupmenu', function() │ | {1: ~}│{1: ~}| {1: ~}│{1: ~}| - {1: ~}│{1: ~}| - {1: ~}│{1: ~}| {3:[No Name] [+] }{4:[No Name] [+] }| ^ | ]]) @@ -2811,8 +2784,6 @@ describe('builtin popupmenu', function() [2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]| - [2:-------------------]│[4:--------------------]| - [2:-------------------]│[4:--------------------]| {3:[No Name] [+] }{4:[No Name] [+] }| [3:----------------------------------------]| ## grid 2 @@ -2820,8 +2791,6 @@ describe('builtin popupmenu', function() | {1: ~}| {1: ~}| - {1: ~}| - {1: ~}| ## grid 3 define^ | ## grid 4 @@ -2829,27 +2798,19 @@ describe('builtin popupmenu', function() | {1: ~}| {1: ~}| - {1: ~}| - {1: ~}| ## grid 5 - {s:define }| - {n:jump }| - {n:list }| - {n:place }| - {n:undefine }| - {n:unplace }| + {s:define }{c: }| + {n:jump }{s: }| ]], float_pos={ - [5] = {{id = -1}, "SW", 1, 7, 0, false, 250}; + [5] = {{id = -1}, "SW", 1, 5, 0, false, 250}; }} else screen:expect([[ tfelthgir emos│ tfelthgir emos| - {s:define } │ | - {n:jump }{1: ~}│{1: ~}| - {n:list }{1: ~}│{1: ~}| - {n:place }{1: ~}│{1: ~}| - {n:undefine }{1: ~}│{1: ~}| - {n:unplace }{3: }{4:[No Name] [+] }| + │ | + {1: ~}│{1: ~}| + {s:define }{c: }{1: ~}│{1: ~}| + {n:jump }{s: }{3: }{4:[No Name] [+] }| define^ | ]]) end