patch 9.0.0638: popup menu highlight wrong on top of preview popup
Problem: Popup menu highlight wrong on top of preview popup. (Yegappan
Lakshmanan)
Solution: Also check for the popup menu in screen_line().
diff --git a/src/screen.c b/src/screen.c
index f5dfa05..ffea593 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -420,6 +420,27 @@
}
/*
+ * Return TRUE if the character at "row" / "col" is under the popup menu and it
+ * will be redrawn soon or it is under another popup.
+ */
+ static int
+skip_for_popup(int row, int col)
+{
+ // Popup windows with zindex higher than POPUPMENU_ZINDEX go on top.
+ if (pum_under_menu(row, col, TRUE)
+#ifdef FEAT_PROP_POPUP
+ && screen_zindex <= POPUPMENU_ZINDEX
+#endif
+ )
+ return TRUE;
+#ifdef FEAT_PROP_POPUP
+ if (blocked_by_popup(row, col))
+ return TRUE;
+#endif
+ return FALSE;
+}
+
+/*
* Move one "cooked" screen line to the screen, but only the characters that
* have actually changed. Handle insert/delete character.
* "coloff" gives the first column on the screen for this line.
@@ -538,10 +559,10 @@
redraw_this = TRUE;
}
#endif
-#ifdef FEAT_PROP_POPUP
- if (blocked_by_popup(row, col + coloff))
+ // Do not redraw if under the popup menu.
+ if (redraw_this && skip_for_popup(row, col + coloff))
redraw_this = FALSE;
-#endif
+
if (redraw_this)
{
/*
@@ -669,15 +690,11 @@
}
#endif
ScreenAttrs[off_to] = ScreenAttrs[off_from];
- ScreenCols[off_to] = ScreenCols[off_from];
// For simplicity set the attributes of second half of a
// double-wide character equal to the first half.
if (char_cells == 2)
- {
ScreenAttrs[off_to + 1] = ScreenAttrs[off_from];
- ScreenCols[off_to + 1] = ScreenCols[off_from + 1];
- }
if (enc_dbcs != 0 && char_cells == 2)
screen_char_2(off_to, row, col + coloff);
@@ -2165,17 +2182,8 @@
return;
// Skip if under the popup menu.
- // Popup windows with zindex higher than POPUPMENU_ZINDEX go on top.
- if (pum_under_menu(row, col, TRUE)
-#ifdef FEAT_PROP_POPUP
- && screen_zindex <= POPUPMENU_ZINDEX
-#endif
- )
+ if (skip_for_popup(row, col))
return;
-#ifdef FEAT_PROP_POPUP
- if (blocked_by_popup(row, col))
- return;
-#endif
// Outputting a character in the last cell on the screen may scroll the
// screen up. Only do it when the "xn" termcap property is set, otherwise