diff src/screen.c @ 14089:ae53a9274f50 v8.1.0062

patch 8.1.0062: popup menu broken if a callback changes the window layout commit https://github.com/vim/vim/commit/491ac28d5f91505519c623ebc1a9ab08834bf367 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 17 14:47:55 2018 +0200 patch 8.1.0062: popup menu broken if a callback changes the window layout Problem: Popup menu broken if a callback changes the window layout. (Qiming Zhao) Solution: Recompute the popup menu position if needed. Redraw the ruler even when the popup menu is displayed.
author Christian Brabandt <cb@256bit.org>
date Sun, 17 Jun 2018 15:00:05 +0200
parents 45c595c0ddaf
children a9d94f10ecef
line wrap: on
line diff
--- a/src/screen.c
+++ b/src/screen.c
@@ -171,7 +171,7 @@ static void redraw_win_toolbar(win_T *wp
 static void win_redr_custom(win_T *wp, int draw_ruler);
 #endif
 #ifdef FEAT_CMDL_INFO
-static void win_redr_ruler(win_T *wp, int always);
+static void win_redr_ruler(win_T *wp, int always, int ignore_pum);
 #endif
 
 /* Ugly global: overrule attribute used by screen_char() */
@@ -783,8 +783,7 @@ update_screen(int type_arg)
 #endif
 #ifdef FEAT_INS_EXPAND
     /* May need to redraw the popup menu. */
-    if (pum_visible())
-	pum_redraw();
+    pum_may_redraw();
 #endif
 
     /* Reset b_mod_set flags.  Going through all windows is probably faster
@@ -7002,7 +7001,7 @@ win_redr_status(win_T *wp, int ignore_pu
 						   - 1 + wp->w_wincol), attr);
 
 #ifdef FEAT_CMDL_INFO
-	win_redr_ruler(wp, TRUE);
+	win_redr_ruler(wp, TRUE, ignore_pum);
 #endif
     }
 
@@ -10455,7 +10454,7 @@ showmode(void)
     /* If the last window has no status line, the ruler is after the mode
      * message and must be redrawn */
     if (redrawing() && lastwin->w_status_height == 0)
-	win_redr_ruler(lastwin, TRUE);
+	win_redr_ruler(lastwin, TRUE, FALSE);
 #endif
     redraw_cmdline = FALSE;
     clear_cmdline = FALSE;
@@ -10874,6 +10873,7 @@ redraw_win_toolbar(win_T *wp)
 						     (int)wp->w_width, FALSE);
 }
 #endif
+
 /*
  * Show current status info in ruler and various other places
  * If always is FALSE, only show ruler if position has changed.
@@ -10899,7 +10899,7 @@ showruler(int always)
     else
 #endif
 #ifdef FEAT_CMDL_INFO
-	win_redr_ruler(curwin, always);
+	win_redr_ruler(curwin, always, FALSE);
 #endif
 
 #ifdef FEAT_TITLE
@@ -10918,7 +10918,7 @@ showruler(int always)
 
 #ifdef FEAT_CMDL_INFO
     static void
-win_redr_ruler(win_T *wp, int always)
+win_redr_ruler(win_T *wp, int always, int ignore_pum)
 {
 #define RULER_BUF_LEN 70
     char_u	buffer[RULER_BUF_LEN];
@@ -10951,8 +10951,9 @@ win_redr_ruler(win_T *wp, int always)
     if (wp == lastwin && lastwin->w_status_height == 0)
 	if (edit_submode != NULL)
 	    return;
-    /* Don't draw the ruler when the popup menu is visible, it may overlap. */
-    if (pum_visible())
+    // Don't draw the ruler when the popup menu is visible, it may overlap.
+    // Except when the popup menu will be redrawn anyway.
+    if (!ignore_pum && pum_visible())
 	return;
 #endif