To: vim_dev@googlegroups.com Subject: Patch 8.0.0058 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0058 Problem: Positioning of the popup menu is not good. Solution: Position it better. (Hirohito Higashi) Files: src/popupmnu.c *** ../vim-8.0.0057/src/popupmnu.c 2016-10-27 14:49:11.022995393 +0200 --- src/popupmnu.c 2016-11-04 20:03:00.299805506 +0100 *************** *** 54,71 **** int kind_width; int extra_width; int i; - int top_clear; int row; int context_lines; int col; ! int above_row = cmdline_row; int redo_count = 0; redo: def_width = PUM_DEF_WIDTH; max_width = 0; kind_width = 0; extra_width = 0; /* Pretend the pum is already there to avoid that must_redraw is set when * 'cuc' is on. */ --- 54,74 ---- int kind_width; int extra_width; int i; int row; int context_lines; int col; ! int above_row; ! int below_row; int redo_count = 0; + win_T *pvwin; redo: def_width = PUM_DEF_WIDTH; max_width = 0; kind_width = 0; extra_width = 0; + above_row = 0; + below_row = cmdline_row; /* Pretend the pum is already there to avoid that must_redraw is set when * 'cuc' is on. */ *************** *** 76,93 **** row = curwin->w_wrow + W_WINROW(curwin); #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) ! if (firstwin->w_p_pvw) ! top_clear = firstwin->w_height; ! else ! #endif ! top_clear = 0; ! ! #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) ! /* When the preview window is at the bottom stop just above it. Also ! * avoid drawing over the status line so that it's clear there is a window ! * boundary. */ ! if (lastwin->w_p_pvw) ! above_row -= lastwin->w_height + lastwin->w_status_height + 1; #endif /* --- 79,94 ---- row = curwin->w_wrow + W_WINROW(curwin); #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) ! FOR_ALL_WINDOWS(pvwin) ! if (pvwin->w_p_pvw) ! break; ! if (pvwin != NULL) ! { ! if (W_WINROW(pvwin) < W_WINROW(curwin)) ! above_row = W_WINROW(pvwin) + pvwin->w_height; ! else if (W_WINROW(pvwin) > W_WINROW(curwin) + curwin->w_height) ! below_row = W_WINROW(pvwin); ! } #endif /* *************** *** 102,109 **** /* Put the pum below "row" if possible. If there are few lines decide on * where there is more room. */ ! if (row + 2 >= above_row - pum_height ! && row > (above_row - top_clear) / 2) { /* pum above "row" */ --- 103,109 ---- /* Put the pum below "row" if possible. If there are few lines decide on * where there is more room. */ ! if (row - above_row >= below_row - row) { /* pum above "row" */ *************** *** 141,148 **** + curwin->w_cline_height - curwin->w_wrow; pum_row = row + context_lines; ! if (size > above_row - pum_row) ! pum_height = above_row - pum_row; else pum_height = size; if (p_ph > 0 && pum_height > p_ph) --- 141,148 ---- + curwin->w_cline_height - curwin->w_wrow; pum_row = row + context_lines; ! if (size > below_row - pum_row) ! pum_height = below_row - pum_row; else pum_height = size; if (p_ph > 0 && pum_height > p_ph) *************** *** 154,166 **** return; #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) ! /* If there is a preview window at the top avoid drawing over it. */ ! if (firstwin->w_p_pvw ! && pum_row < firstwin->w_height ! && pum_height > firstwin->w_height + 4) { ! pum_row += firstwin->w_height; ! pum_height -= firstwin->w_height; } #endif --- 154,164 ---- return; #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) ! /* If there is a preview window at the above avoid drawing over it. */ ! if (pvwin != NULL && pum_row < above_row && pum_height > above_row) { ! pum_row += above_row; ! pum_height -= above_row; } #endif *** ../vim-8.0.0057/src/version.c 2016-11-04 16:41:16.559153991 +0100 --- src/version.c 2016-11-04 20:03:57.851368163 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 58, /**/ -- Your company is doomed if your primary product is overhead transparencies. (Scott Adams - The Dilbert principle) /// 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 ///