vim-patch:8.0.1538: popupmenu is too far left when completion is long

Problem:    Popupmenu is too far left when completion is long. (Linwei)
Solution:   Adjust column computations. (Hirohito Higashi, closes vim/vim#2661)
bb008dd323
This commit is contained in:
Jan Edmund Lazo 2019-09-10 20:53:13 -04:00
parent d56f36f46c
commit 51c9e3c4d1
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15
2 changed files with 14 additions and 14 deletions

View File

@ -306,13 +306,13 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
|| col < Columns - max_width))) { || col < Columns - max_width))) {
// align right pum edge with "col" // align right pum edge with "col"
if (curwin->w_p_rl if (curwin->w_p_rl
&& col < max_width + pum_scrollbar + 1) { && W_ENDCOL(curwin) < max_width + pum_scrollbar + 1) {
pum_col = col + max_width + pum_scrollbar + 1; pum_col = col + max_width + pum_scrollbar + 1;
if (pum_col >= Columns) { if (pum_col >= Columns) {
pum_col = Columns - 1; pum_col = Columns - 1;
} }
} else if (!curwin->w_p_rl) { } else if (!curwin->w_p_rl) {
if (col > Columns - max_width - pum_scrollbar) { if (curwin->w_wincol > Columns - max_width - pum_scrollbar) {
pum_col = col - max_width - pum_scrollbar; pum_col = col - max_width - pum_scrollbar;
if (pum_col < 0) { if (pum_col < 0) {
pum_col = 0; pum_col = 0;

View File

@ -1156,10 +1156,10 @@ describe('builtin popupmenu', function()
funcs.complete(29, {'word', 'choice', 'text', 'thing'}) funcs.complete(29, {'word', 'choice', 'text', 'thing'})
screen:expect([[ screen:expect([[
some long prefix before the ^ | some long prefix before the ^ |
{1:~ }{n: word }| {n:word }{1: }|
{1:~ }{n: choice }| {n:choice }{1: }|
{1:~ }{n: text }| {n:text }{1: }|
{1:~ }{n: thing }| {n:thing }{1: }|
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
@ -1204,10 +1204,10 @@ describe('builtin popupmenu', function()
feed('<c-p>') feed('<c-p>')
screen:expect([[ screen:expect([[
some long prefix before the text| some long prefix before the text|
{1:^~ }{n: word }| {n:^word }{1: }|
{1:~ }{n: choice }| {n:choice }{1: }|
{1:~ }{s: text }| {s:text }{1: }|
{1:~ }{n: thing }| {n:thing }{1: }|
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
@ -1301,10 +1301,10 @@ describe('builtin popupmenu', function()
funcs.complete(29, {'word', 'choice', 'text', 'thing'}) funcs.complete(29, {'word', 'choice', 'text', 'thing'})
screen:expect([[ screen:expect([[
some long prefix before the ^ | some long prefix before the ^ |
{1:~ }{n: word }| {n:word }{1: }|
{1:~ }{n: choice }| {n:choice }{1: }|
{1:~ }{n: text }| {n:text }{1: }|
{1:~ }{n: thing }| {n:thing }{1: }|
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|
{1:~ }| {1:~ }|