fix(pum): fix missing scrollbar with 'rightleft' (#23448)

This commit is contained in:
zeertzjq 2023-05-03 01:13:03 +08:00 committed by GitHub
parent bff3f4fa8b
commit 8bc973c6f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 59 deletions

View File

@ -452,6 +452,9 @@ void pum_redraw(void)
} }
if (pum_scrollbar > 0) { if (pum_scrollbar > 0) {
grid_width++; grid_width++;
if (pum_rl) {
col_off++;
}
} }
grid_assign_handle(&pum_grid); grid_assign_handle(&pum_grid);

View File

@ -2658,10 +2658,11 @@ describe('builtin popupmenu', function()
end end
it('with rightleft vsplits', function() it('with rightleft vsplits', function()
screen:try_resize(40, 8) screen:try_resize(40, 6)
command('set rightleft') command('set rightleft')
command('rightbelow vsplit') command('rightbelow vsplit')
command("set completeopt+=noinsert,noselect") command('set completeopt+=noinsert,noselect')
command('set pumheight=2')
feed('isome rightleft ') feed('isome rightleft ')
funcs.complete(16, {'word', 'choice', 'text', 'thing'}) funcs.complete(16, {'word', 'choice', 'text', 'thing'})
if multigrid then if multigrid then
@ -2671,8 +2672,6 @@ describe('builtin popupmenu', function()
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
{3:[No Name] [+] }{4:[No Name] [+] }| {3:[No Name] [+] }{4:[No Name] [+] }|
[3:----------------------------------------]| [3:----------------------------------------]|
## grid 2 ## grid 2
@ -2680,8 +2679,6 @@ describe('builtin popupmenu', function()
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}|
{1: ~}|
## grid 3 ## grid 3
{2:-- INSERT --} | {2:-- INSERT --} |
## grid 4 ## grid 4
@ -2689,23 +2686,17 @@ describe('builtin popupmenu', function()
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}|
{1: ~}|
## grid 5 ## grid 5
{n: drow }| {c: }{n: drow }|
{n: eciohc }| {s: }{n: eciohc }|
{n: txet }|
{n: gniht }|
]], float_pos={ ]], float_pos={
[5] = {{id = -1}, "NW", 4, 1, -10, false, 100}; [5] = {{id = -1}, "NW", 4, 1, -11, false, 100};
}} }}
else else
screen:expect([[ screen:expect([[
tfelthgir emos ^ tfelthgir emos| tfelthgir emos ^ tfelthgir emos|
{1: }{n: drow }{1: ~}| {1: }{c: }{n: drow }{1: ~}|
{1: }{n: eciohc }{1: ~}| {1: }{s: }{n: eciohc }{1: ~}|
{1: }{n: txet }{1: ~}|
{1: }{n: gniht }{1: ~}|
{1: ~}{1: ~}| {1: ~}{1: ~}|
{3:[No Name] [+] }{4:[No Name] [+] }| {3:[No Name] [+] }{4:[No Name] [+] }|
{2:-- INSERT --} | {2:-- INSERT --} |
@ -2720,8 +2711,6 @@ describe('builtin popupmenu', function()
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
{3:[No Name] [+] }{4:[No Name] [+] }| {3:[No Name] [+] }{4:[No Name] [+] }|
[3:----------------------------------------]| [3:----------------------------------------]|
## grid 2 ## grid 2
@ -2729,8 +2718,6 @@ describe('builtin popupmenu', function()
| |
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}|
{1: ~}|
## grid 3 ## grid 3
{2:-- INSERT --} | {2:-- INSERT --} |
## grid 4 ## grid 4
@ -2738,24 +2725,18 @@ describe('builtin popupmenu', function()
^ | ^ |
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}|
{1: ~}|
## grid 5 ## grid 5
{n: drow}| {c: }{n: drow}|
{n: eciohc}| {s: }{n: eciohc}|
{n: txet}|
{n: gniht}|
]], float_pos={ ]], float_pos={
[5] = {{id = -1}, "NW", 4, 2, 5, false, 100}; [5] = {{id = -1}, "NW", 4, 2, 4, false, 100};
}} }}
else else
screen:expect([[ screen:expect([[
tfelthgir emos tfelthgir emos| tfelthgir emos tfelthgir emos|
^ | ^ |
{1: ~}{1: }{n: drow}| {1: ~}{1: }{c: }{n: drow}|
{1: ~}{1: }{n: eciohc}| {1: ~}{1: }{s: }{n: eciohc}|
{1: ~}{1: }{n: txet}|
{1: ~}{1: }{n: gniht}|
{3:[No Name] [+] }{4:[No Name] [+] }| {3:[No Name] [+] }{4:[No Name] [+] }|
{2:-- INSERT --} | {2:-- INSERT --} |
]]) ]])
@ -2769,8 +2750,6 @@ describe('builtin popupmenu', function()
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
{3:[No Name] [+] }{4:[No Name] [+] }| {3:[No Name] [+] }{4:[No Name] [+] }|
[3:----------------------------------------]| [3:----------------------------------------]|
## grid 2 ## grid 2
@ -2778,8 +2757,6 @@ describe('builtin popupmenu', function()
| |
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}|
{1: ~}|
## grid 3 ## grid 3
^ | ^ |
## grid 4 ## grid 4
@ -2787,8 +2764,6 @@ describe('builtin popupmenu', function()
| |
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}|
{1: ~}|
]]} ]]}
else else
screen:expect([[ screen:expect([[
@ -2796,8 +2771,6 @@ describe('builtin popupmenu', function()
| |
{1: ~}{1: ~}| {1: ~}{1: ~}|
{1: ~}{1: ~}| {1: ~}{1: ~}|
{1: ~}{1: ~}|
{1: ~}{1: ~}|
{3:[No Name] [+] }{4:[No Name] [+] }| {3:[No Name] [+] }{4:[No Name] [+] }|
^ | ^ |
]]) ]])
@ -2811,8 +2784,6 @@ describe('builtin popupmenu', function()
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]| [2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
[2:-------------------]│[4:--------------------]|
{3:[No Name] [+] }{4:[No Name] [+] }| {3:[No Name] [+] }{4:[No Name] [+] }|
[3:----------------------------------------]| [3:----------------------------------------]|
## grid 2 ## grid 2
@ -2820,8 +2791,6 @@ describe('builtin popupmenu', function()
| |
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}|
{1: ~}|
## grid 3 ## grid 3
define^ | define^ |
## grid 4 ## grid 4
@ -2829,27 +2798,19 @@ describe('builtin popupmenu', function()
| |
{1: ~}| {1: ~}|
{1: ~}| {1: ~}|
{1: ~}|
{1: ~}|
## grid 5 ## grid 5
{s:define }| {s:define }{c: }|
{n:jump }| {n:jump }{s: }|
{n:list }|
{n:place }|
{n:undefine }|
{n:unplace }|
]], float_pos={ ]], float_pos={
[5] = {{id = -1}, "SW", 1, 7, 0, false, 250}; [5] = {{id = -1}, "SW", 1, 5, 0, false, 250};
}} }}
else else
screen:expect([[ screen:expect([[
tfelthgir emos tfelthgir emos| tfelthgir emos tfelthgir emos|
{s:define } | |
{n:jump }{1: ~}{1: ~}| {1: ~}{1: ~}|
{n:list }{1: ~}{1: ~}| {s:define }{c: }{1: ~}{1: ~}|
{n:place }{1: ~}{1: ~}| {n:jump }{s: }{3: }{4:[No Name] [+] }|
{n:undefine }{1: ~}{1: ~}|
{n:unplace }{3: }{4:[No Name] [+] }|
define^ | define^ |
]]) ]])
end end