To: vim_dev@googlegroups.com Subject: Patch 8.1.1906 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1906 Problem: Info popup size is sometimes incorrect. Solution: Compute the position and size after setting the content. Files: src/popupmnu.c *** ../vim-8.1.1905/src/popupmnu.c 2019-08-21 18:30:58.882719474 +0200 --- src/popupmnu.c 2019-08-21 19:29:52.557146710 +0200 *************** *** 621,626 **** --- 621,667 ---- #endif } + #if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX) + static void + pum_position_info_popup(void) + { + int col = pum_col + pum_width + 1; + int row = pum_row; + int botpos = POPPOS_BOTLEFT; + + curwin->w_popup_pos = POPPOS_TOPLEFT; + if (Columns - col < 20 && Columns - col < pum_col) + { + col = pum_col - 1; + curwin->w_popup_pos = POPPOS_TOPRIGHT; + botpos = POPPOS_BOTRIGHT; + curwin->w_maxwidth = pum_col - 1; + } + else + curwin->w_maxwidth = Columns - col + 1; + curwin->w_maxwidth -= popup_extra_width(curwin); + + row -= popup_top_extra(curwin); + if (curwin->w_popup_flags & POPF_INFO_MENU) + { + if (pum_row < pum_win_row) + { + // menu above cursor line, align with bottom + row += pum_height; + curwin->w_popup_pos = botpos; + } + else + // menu below cursor line, align with top + row += 1; + } + else + // align with the selected item + row += pum_selected - pum_first + 1; + + popup_set_wantpos_rowcol(curwin, row, col); + } + #endif + /* * Set the index of the currently selected item. The menu will scroll when * necessary. When "n" is out of range don't scroll. *************** *** 741,785 **** # endif ) { - # ifdef FEAT_TEXT_PROP - if (use_popup) - { - int col = pum_col + pum_width + 1; - int row = pum_row; - int botpos = POPPOS_BOTLEFT; - - curwin->w_popup_pos = POPPOS_TOPLEFT; - if (Columns - col < 20 && Columns - col < pum_col) - { - col = pum_col - 1; - curwin->w_popup_pos = POPPOS_TOPRIGHT; - botpos = POPPOS_BOTRIGHT; - curwin->w_maxwidth = pum_col - 1; - } - else - curwin->w_maxwidth = Columns - col + 1; - curwin->w_maxwidth -= popup_extra_width(curwin); - - row -= popup_top_extra(curwin); - if (curwin->w_popup_flags & POPF_INFO_MENU) - { - if (pum_row < pum_win_row) - { - // menu above cursor line, align with bottom - row += pum_height; - curwin->w_popup_pos = botpos; - } - else - // menu below cursor line, align with top - row += 1; - } - else - // align with the selected item - row += pum_selected - pum_first + 1; - - popup_set_wantpos_rowcol(curwin, row, col); - } - # endif if (!resized && curbuf->b_nwindows == 1 && curbuf->b_fname == NULL --- 782,787 ---- *************** *** 859,867 **** curwin->w_topline = curbuf->b_ml.ml_line_count; curwin->w_cursor.lnum = curwin->w_topline; curwin->w_cursor.col = 0; ! if (use_popup && win_valid(curwin_save)) ! redraw_win_later(curwin_save, SOME_VALID); ! if ((curwin != curwin_save && win_valid(curwin_save)) || (curtab != curtab_save && valid_tabpage(curtab_save))) --- 861,874 ---- curwin->w_topline = curbuf->b_ml.ml_line_count; curwin->w_cursor.lnum = curwin->w_topline; curwin->w_cursor.col = 0; ! # ifdef FEAT_TEXT_PROP ! if (use_popup) ! { ! pum_position_info_popup(); ! if (win_valid(curwin_save)) ! redraw_win_later(curwin_save, SOME_VALID); ! } ! # endif if ((curwin != curwin_save && win_valid(curwin_save)) || (curtab != curtab_save && valid_tabpage(curtab_save))) *** ../vim-8.1.1905/src/version.c 2019-08-21 18:30:58.882719474 +0200 --- src/version.c 2019-08-21 19:32:55.084460788 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1906, /**/ -- I AM THANKFUL... ...for the piles of laundry and ironing because it means I have plenty of clothes to wear. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///