mirror of
https://github.com/vim/vim.git
synced 2025-12-13 20:36:39 +01:00
patch 9.1.1960: Wrong position of info popup
Problem: When the popup menu is displayed above the cursor and the
selected item has no room below for the info popup,
popup_adjust_position() places the popup in the available
space above. The calculation added some extra lines, causing
the popup to be misaligned.
Solution: For info popups, undo that extra spacing so the popup stays
aligned with the selected item (glepnir)
closes: #18860
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
826d10296f
commit
7a0d0a022a
@@ -1647,6 +1647,8 @@ popup_adjust_position(win_T *wp)
|
||||
// make bottom aligned and recompute the height
|
||||
wp->w_height = w_height_before_limit;
|
||||
wp->w_winrow = wantline - 2 - wp->w_height - extra_height;
|
||||
if (wp->w_popup_flags & POPF_INFO)
|
||||
wp->w_winrow += extra_height + 2;
|
||||
if (wp->w_winrow < 0)
|
||||
{
|
||||
wp->w_height += wp->w_winrow;
|
||||
|
||||
15
src/testdir/dumps/Test_popupwin_infopopup_align_item_01.dump
Normal file
15
src/testdir/dumps/Test_popupwin_infopopup_align_item_01.dump
Normal file
@@ -0,0 +1,15 @@
|
||||
| +0#af5f00255#ffffff0@1|1| | +0#0000000&@70
|
||||
| +0#af5f00255&@1|2| | +0#0000000&@70
|
||||
| +0#af5f00255&@1|3| | +0#0000000&@70
|
||||
| +0#af5f00255&@1|4| | +0#0000000&@70
|
||||
| +0#af5f00255&@1|5| | +0#0000000&@70
|
||||
| +0#af5f00255&@1|6| | +0#0000000&@70
|
||||
| +0#af5f00255&@1|7| | +0#0000000&@70
|
||||
| +0#af5f00255&@1|8| | +0#0000000&@14|╔+0#0000001#e0e0e08|═@7|X| +0#0000000#ffffff0@45
|
||||
| +0#af5f00255&@1|9| | +0#0000000&@14|║+0#0000001#e0e0e08| |N|i|n|e| @2|║| +0#0000000#ffffff0@45
|
||||
| +0#af5f00255&|1|0| +0#0000001#ffd7ff255|c|p|_|m|a|t|c|h|_|a|r@1|a|y| |║+0&#e0e0e08| |T|e|n| @3|║| +0#0000000#ffffff0@45
|
||||
| +0#af5f00255&|1@1| +0#0000001#ffd7ff255|c|p|_|s|t|r| @8|║+0&#e0e0e08| |E|l|e|v|e|n| |║| +0#0000000#ffffff0@45
|
||||
| +0#af5f00255&|1|2| +0#0000001#e0e0e08|c|p|_|s|c|o|r|e| @6|║| |T|w|e|l|v|e| |║| +0#0000000#ffffff0@45
|
||||
| +0#af5f00255&|1|3| |c+0#0000000&|p|_|s|c|o|r|e> @6|╚+0#0000001#e0e0e08|═@7|⇲| +0#0000000#ffffff0@45
|
||||
|~+0#4040ff13&| @73
|
||||
|-+2#0000000&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |3| |o|f| |3| +0#0000000&@34
|
||||
@@ -3783,6 +3783,38 @@ func Test_popupmenu_info_align_menu()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_popupmenu_info_align_item()
|
||||
CheckScreendump
|
||||
let lines =<< trim END
|
||||
func Omni_test(findstart, base)
|
||||
if a:findstart
|
||||
return col(".")
|
||||
endif
|
||||
return [
|
||||
\ #{word: "cp_match_array", info: "One\nTwo\nThree\nFour"},
|
||||
\ #{word: "cp_str", info: "Five\nSix\nSeven\nEight"},
|
||||
\ #{word: "cp_score", info: "Nine\nTen\nEleven\nTwelve"},
|
||||
\ ]
|
||||
endfunc
|
||||
set completepopup=border:on,align:item
|
||||
set cot=menu,menuone,popup,
|
||||
set omnifunc=Omni_test
|
||||
set number
|
||||
END
|
||||
call writefile(lines, 'XtestInfoPopupPos', 'D')
|
||||
let buf = RunVimInTerminal('-S XtestInfoPopupPos', #{rows: 15})
|
||||
call TermWait(buf, 25)
|
||||
|
||||
call term_sendkeys(buf, "A"..repeat("\<CR>", 12))
|
||||
call TermWait(buf, 25)
|
||||
call term_sendkeys(buf, "\<C-X>\<C-O>\<C-N>\<C-N>")
|
||||
call TermWait(buf, 25)
|
||||
call VerifyScreenDump(buf, 'Test_popupwin_infopopup_align_item_01', {})
|
||||
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_popupmenu_info_hidden()
|
||||
CheckScreendump
|
||||
CheckFeature quickfix
|
||||
|
||||
@@ -729,6 +729,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1960,
|
||||
/**/
|
||||
1959,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user