comparison src/popupmnu.c @ 17815:9ec2526c04c5 v8.1.1904

patch 8.1.1904: cannot have an info popup align with the popup menu Commit: https://github.com/vim/vim/commit/258cef59d8c53a5b1c04937c826dc133ad5710e2 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 21 17:29:29 2019 +0200 patch 8.1.1904: cannot have an info popup align with the popup menu Problem: Cannot have an info popup align with the popup menu. Solution: Add the "align" item to 'completepopup'.
author Bram Moolenaar <Bram@vim.org>
date Wed, 21 Aug 2019 17:30:03 +0200
parents 8ca20b0a3dc3
children e8a7029efa40
comparison
equal deleted inserted replaced
17814:f15ace2530db 17815:9ec2526c04c5
743 { 743 {
744 # ifdef FEAT_TEXT_PROP 744 # ifdef FEAT_TEXT_PROP
745 if (use_popup) 745 if (use_popup)
746 { 746 {
747 int col = pum_col + pum_width + 1; 747 int col = pum_col + pum_width + 1;
748 int row = pum_row + pum_selected - pum_first + 1; 748 int row = pum_row;
749 749 int botpos = POPPOS_BOTLEFT;
750
751 curwin->w_popup_pos = POPPOS_TOPLEFT;
750 if (Columns - col < 20 && Columns - col < pum_col) 752 if (Columns - col < 20 && Columns - col < pum_col)
751 { 753 {
752 col = pum_col - 1; 754 col = pum_col - 1;
753 curwin->w_popup_pos = POPPOS_TOPRIGHT; 755 curwin->w_popup_pos = POPPOS_TOPRIGHT;
756 botpos = POPPOS_BOTRIGHT;
754 curwin->w_maxwidth = pum_col - 1; 757 curwin->w_maxwidth = pum_col - 1;
755 } 758 }
756 else 759 else
757 curwin->w_maxwidth = Columns - col + 1; 760 curwin->w_maxwidth = Columns - col + 1;
758 curwin->w_maxwidth -= popup_extra_width(curwin); 761 curwin->w_maxwidth -= popup_extra_width(curwin);
762
759 row -= popup_top_extra(curwin); 763 row -= popup_top_extra(curwin);
764 if (curwin->w_popup_flags & POPF_INFO_MENU)
765 {
766 if (pum_row < pum_win_row)
767 {
768 // menu above cursor line, align with bottom
769 row += pum_height;
770 curwin->w_popup_pos = botpos;
771 }
772 else
773 // menu below cursor line, align with top
774 row += 1;
775 }
776 else
777 // align with the selected item
778 row += pum_selected - pum_first + 1;
779
760 popup_set_wantpos_rowcol(curwin, row, col); 780 popup_set_wantpos_rowcol(curwin, row, col);
761 } 781 }
762 # endif 782 # endif
763 if (!resized 783 if (!resized
764 && curbuf->b_nwindows == 1 784 && curbuf->b_nwindows == 1