mirror of
https://github.com/neovim/neovim.git
synced 2025-10-15 06:16:08 +00:00
vim-patch:9.1.1817: popup: there are some position logic bugs (#36075)
Problem: popup: there are some position logic bugs
Solution: Refactor position logic and fix a few bugs
(Girish Palya).
This change does the following:
- Simplified and rewrote horizontal positioning logic (was overly
complex).
- Split horizontal and vertical positioning into separate functions.
- Fixed missing truncation marker (e.g. `>`) when items were truncated
and `pummaxwidth` was not set.
- Fixed occasional extra space being added to menu items.
- Update tests
closes: vim/vim#18441
e3ed5584ed
Cherry-pick pum_display_{rtl,ltr}_text() changes from patch 9.1.1835.
Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
@@ -333,11 +333,11 @@ describe('vim.ui_attach', function()
|
||||
2 |
|
||||
3 |
|
||||
4 :call bufadd^( |
|
||||
5 {12: bufadd( }{100: } |
|
||||
6 bufexists( {100: } |
|
||||
7 buffer_exists( {12: } |
|
||||
8 buffer_name( {12: } |
|
||||
9 buffer_number( {12: } |
|
||||
5 {12: bufadd( }{100: } |
|
||||
6 bufexists( {100: } |
|
||||
7 buffer_exists( {12: } |
|
||||
8 buffer_name( {12: } |
|
||||
9 buffer_number( {12: } |
|
||||
|
|
||||
]])
|
||||
exec_lua([[
|
||||
@@ -355,39 +355,39 @@ describe('vim.ui_attach', function()
|
||||
2 |
|
||||
3 |
|
||||
4 |
|
||||
5 {12: bufadd( }{100: } |
|
||||
6 bufexists( {100: } |
|
||||
7 buffer_exists( {12: } |
|
||||
8 buffer_name( {12: } |
|
||||
9 buffer_number( {12: } |
|
||||
5 {12: bufadd( }{100: } |
|
||||
6 bufexists( {100: } |
|
||||
7 buffer_exists( {12: } |
|
||||
8 buffer_name( {12: } |
|
||||
9 buffer_number( {12: } |
|
||||
:call bufadd^( |
|
||||
]])
|
||||
feed('<tab>')
|
||||
screen:expect([[
|
||||
1 bufadd( {100: } |
|
||||
2 {12: bufexists( }{100: } |
|
||||
3 buffer_exists( {100: } |
|
||||
4 buffer_name( {100: } |
|
||||
5 buffer_number( {100: } |
|
||||
6 buflisted( {100: } |
|
||||
7 bufload( {12: } |
|
||||
8 bufloaded( {12: } |
|
||||
9 bufname( {12: } |
|
||||
1 bufadd( {100: } |
|
||||
2 {12: bufexists( }{100: } |
|
||||
3 buffer_exists( {100: } |
|
||||
4 buffer_name( {100: } |
|
||||
5 buffer_number( {100: } |
|
||||
6 buflisted( {100: } |
|
||||
7 bufload( {12: } |
|
||||
8 bufloaded( {12: } |
|
||||
9 bufname( {12: } |
|
||||
:call bufexists^( |
|
||||
]])
|
||||
-- Test different offset (e.g. for custom prompt)
|
||||
exec_lua('vim.api.nvim_win_set_config(_G.win, { _cmdline_offset = 9 })')
|
||||
feed('<Esc>:call buf<Tab>')
|
||||
screen:expect([[
|
||||
1 {12: bufadd( }{100: } |
|
||||
2 bufexists( {100: } |
|
||||
3 buffer_exists( {100: } |
|
||||
4 buffer_name( {100: } |
|
||||
5 buffer_number( {100: } |
|
||||
6 buflisted( {100: } |
|
||||
7 bufload( {12: } |
|
||||
8 bufloaded( {12: } |
|
||||
9 bufname( {12: } |
|
||||
1 {12: bufadd( }{100: } |
|
||||
2 bufexists( {100: } |
|
||||
3 buffer_exists( {100: } |
|
||||
4 buffer_name( {100: } |
|
||||
5 buffer_number( {100: } |
|
||||
6 buflisted( {100: } |
|
||||
7 bufload( {12: } |
|
||||
8 bufloaded( {12: } |
|
||||
9 bufname( {12: } |
|
||||
Excommand:call bufadd^( |
|
||||
]])
|
||||
-- No crash after _cmdline_offset window is closed #35584.
|
||||
|
Reference in New Issue
Block a user