vim-patch:9.1.0488: Wrong padding for pum "kind" with 'rightleft' (#29352)

Problem:  Wrong padding for pum "kind" with 'rightleft'.
Solution: Fix off-by-one error (zeertzjq).

The screen_fill() above is end-exclusive, and
- With 'rightleft' it fills `pum_col - pum_base_width - n + 1` to `col`,
  so the next `col` should be `pum_col - pum_base_width - n`.
- With 'norightleft' it fills `col` to `pum_col - pum_base_width + n - 1`,
  so the next `col` should be `pum_col - pum_base_width + n`.

closes: vim/vim#15004

a2324373eb
This commit is contained in:
zeertzjq
2024-06-15 21:39:56 +08:00
committed by GitHub
parent bb487ea12e
commit fd2ef4edf9
2 changed files with 9 additions and 9 deletions

View File

@@ -713,7 +713,7 @@ void pum_redraw(void)
if (pum_rl) { if (pum_rl) {
grid_line_fill(col_off - pum_base_width - n + 1, grid_col + 1, schar_from_ascii(' '), attr); grid_line_fill(col_off - pum_base_width - n + 1, grid_col + 1, schar_from_ascii(' '), attr);
grid_col = col_off - pum_base_width - n + 1; grid_col = col_off - pum_base_width - n;
} else { } else {
grid_line_fill(grid_col, col_off + pum_base_width + n, schar_from_ascii(' '), attr); grid_line_fill(grid_col, col_off + pum_base_width + n, schar_from_ascii(' '), attr);
grid_col = col_off + pum_base_width + n; grid_col = col_off + pum_base_width + n;

View File

@@ -4664,10 +4664,10 @@ describe('builtin popupmenu', function()
feed('S<C-X><C-O>') feed('S<C-X><C-O>')
screen:expect([[ screen:expect([[
^ | ^ |
{1: }{s: dnikoof oof}| {1: }{s: dnikoof oof}|
{1: }{n: dnikoof raboof}| {1: }{n: dnikoof raboof}|
{1: }{n: dnikoof zaBoof}| {1: }{n: dnikoof zaBoof}|
{1: }{n: dnikoof alaboof}| {1: }{n: dnikoof alaboof}|
{1: }{n: 好你}| {1: }{n: 好你}|
{1: }{n: 吗好你}| {1: }{n: 吗好你}|
{1: }{n: 吗好不你}| {1: }{n: 吗好不你}|
@@ -4678,10 +4678,10 @@ describe('builtin popupmenu', function()
feed('fo') feed('fo')
screen:expect([[ screen:expect([[
^ of| ^ of|
{1: }{s: dnikoof o}{ms:of}| {1: }{s: dnikoof o}{ms:of}|
{1: }{n: dnikoof rabo}{mn:of}| {1: }{n: dnikoof rabo}{mn:of}|
{1: }{n: dnikoof zaBo}{mn:of}| {1: }{n: dnikoof zaBo}{mn:of}|
{1: }{n: dnikoofalabo}{mn:of}| {1: }{n: dnikoof alabo}{mn:of}|
{1: ~}|*14 {1: ~}|*14
{2:-- }{5:match 1 of 8} | {2:-- }{5:match 1 of 8} |
]]) ]])