mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #13137 from erw7/fix-pum-pos
Fix popupmenu position issue
This commit is contained in:
commit
e37651deb7
@ -301,49 +301,49 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed,
|
|||||||
if (pum_width < p_pw) {
|
if (pum_width < p_pw) {
|
||||||
pum_width = (int)p_pw;
|
pum_width = (int)p_pw;
|
||||||
}
|
}
|
||||||
}
|
} else if (((cursor_col > p_pw || cursor_col > max_width) && !pum_rl)
|
||||||
} else if (((cursor_col > p_pw || cursor_col > max_width) && !pum_rl)
|
|| (pum_rl && (cursor_col < Columns - p_pw
|
||||||
|| (pum_rl && (cursor_col < Columns - p_pw
|
|| cursor_col < Columns - max_width))) {
|
||||||
|| cursor_col < Columns - max_width))) {
|
// align pum edge with "cursor_col"
|
||||||
// align pum edge with "cursor_col"
|
if (pum_rl && W_ENDCOL(curwin) < max_width + pum_scrollbar + 1) {
|
||||||
if (pum_rl && W_ENDCOL(curwin) < max_width + pum_scrollbar + 1) {
|
pum_col = cursor_col + max_width + pum_scrollbar + 1;
|
||||||
pum_col = cursor_col + max_width + pum_scrollbar + 1;
|
if (pum_col >= Columns) {
|
||||||
if (pum_col >= Columns) {
|
pum_col = Columns - 1;
|
||||||
pum_col = Columns - 1;
|
}
|
||||||
}
|
} else if (!pum_rl) {
|
||||||
} else if (!pum_rl) {
|
if (curwin->w_wincol > Columns - max_width - pum_scrollbar
|
||||||
if (curwin->w_wincol > Columns - max_width - pum_scrollbar
|
&& max_width <= p_pw) {
|
||||||
&& max_width <= p_pw) {
|
// use full width to end of the screen
|
||||||
// use full width to end of the screen
|
pum_col = Columns - max_width - pum_scrollbar;
|
||||||
pum_col = cursor_col - max_width - pum_scrollbar;
|
if (pum_col < 0) {
|
||||||
if (pum_col < 0) {
|
pum_col = 0;
|
||||||
pum_col = 0;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (pum_rl) {
|
|
||||||
pum_width = pum_col - pum_scrollbar + 1;
|
|
||||||
} else {
|
|
||||||
pum_width = Columns - pum_col - pum_scrollbar;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pum_width < p_pw) {
|
|
||||||
pum_width = (int)p_pw;
|
|
||||||
if (pum_rl) {
|
if (pum_rl) {
|
||||||
if (pum_width > pum_col) {
|
pum_width = pum_col - pum_scrollbar + 1;
|
||||||
pum_width = pum_col;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (pum_width >= Columns - pum_col) {
|
pum_width = Columns - pum_col - pum_scrollbar;
|
||||||
pum_width = Columns - pum_col - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (pum_width > max_width + pum_kind_width + pum_extra_width + 1
|
|
||||||
&& pum_width > p_pw) {
|
|
||||||
pum_width = max_width + pum_kind_width + pum_extra_width + 1;
|
|
||||||
if (pum_width < p_pw) {
|
if (pum_width < p_pw) {
|
||||||
pum_width = (int)p_pw;
|
pum_width = (int)p_pw;
|
||||||
|
if (pum_rl) {
|
||||||
|
if (pum_width > pum_col) {
|
||||||
|
pum_width = pum_col;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (pum_width >= Columns - pum_col) {
|
||||||
|
pum_width = Columns - pum_col - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (pum_width > max_width + pum_kind_width + pum_extra_width + 1
|
||||||
|
&& pum_width > p_pw) {
|
||||||
|
pum_width = max_width + pum_kind_width + pum_extra_width + 1;
|
||||||
|
if (pum_width < p_pw) {
|
||||||
|
pum_width = (int)p_pw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Columns < def_width) {
|
} else if (Columns < def_width) {
|
||||||
|
@ -1213,10 +1213,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 ^ |
|
||||||
{n:word }{1: }|
|
{1:~ }{n: word }|
|
||||||
{n:choice }{1: }|
|
{1:~ }{n: choice}|
|
||||||
{n:text }{1: }|
|
{1:~ }{n: text }|
|
||||||
{n:thing }{1: }|
|
{1:~ }{n: thing }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1261,10 +1261,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|
|
||||||
{n:^word }{1: }|
|
{1:^~ }{n: word }|
|
||||||
{n:choice }{1: }|
|
{1:~ }{n: choice}|
|
||||||
{s:text }{1: }|
|
{1:~ }{s: text }|
|
||||||
{n:thing }{1: }|
|
{1:~ }{n: thing }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -1341,10 +1341,10 @@ describe('builtin popupmenu', function()
|
|||||||
screen:expect([[
|
screen:expect([[
|
||||||
some long prefix |
|
some long prefix |
|
||||||
before the text^ |
|
before the text^ |
|
||||||
{1:~ }{n: word }|
|
{1:~ }{n: word }{1: }|
|
||||||
{1:~ }{n: choice }|
|
{1:~ }{n: choice }{1: }|
|
||||||
{1:~ }{s: text }|
|
{1:~ }{s: text }{1: }|
|
||||||
{1:~ }{n: thing }|
|
{1:~ }{n: thing }{1: }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{2:-- INSERT --} |
|
{2:-- INSERT --} |
|
||||||
]])
|
]])
|
||||||
@ -1358,10 +1358,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 ^ |
|
||||||
{n:word }{1: }|
|
{1:~ }{n: word }|
|
||||||
{n:choice }{1: }|
|
{1:~ }{n: choice}|
|
||||||
{n:text }{1: }|
|
{1:~ }{n: text }|
|
||||||
{n:thing }{1: }|
|
{1:~ }{n: thing }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -2168,8 +2168,8 @@ 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 ^ |
|
||||||
{n:word }{c: }{1: }|
|
{1:~ }{n: word }{c: }|
|
||||||
{n:choice }{s: }{1: }|
|
{1:~ }{n: choice}{s: }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
@ -2187,10 +2187,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 ^ |
|
||||||
{n:word }{1: }|
|
{1:~ }{n: word }|
|
||||||
{n:choice }{1: }|
|
{1:~ }{n: choice}|
|
||||||
{n:text }{1: }|
|
{1:~ }{n: text }|
|
||||||
{n:thing }{1: }|
|
{1:~ }{n: thing }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{2:-- INSERT --} |
|
{2:-- INSERT --} |
|
||||||
|
Loading…
Reference in New Issue
Block a user