static int popup_on_cmdline = FALSE;
static void popup_adjust_position(win_T *wp);
+static void redraw_under_popup_area(int winrow, int wincol, int height,
+ int width, int leftoff);
/*
* Get option value for "key", which is "line" or "col".
{
int id;
win_T *wp;
+#ifdef FEAT_PROP_POPUP
+ int old_popup_active;
+#endif
+ int old_winrow;
+ int old_wincol;
+ int old_popup_height;
+ int old_popup_width;
+ int old_popup_leftoff;
if (in_vim9script()
&& (check_for_number_arg(argvars, 0) == FAIL
if (wp == NULL)
return;
+#ifdef FEAT_PROP_POPUP
+ old_popup_active = (wp->w_popup_flags & POPF_OPACITY)
+ && wp->w_popup_blend > 0;
+#endif
+ old_winrow = wp->w_winrow;
+ old_wincol = wp->w_wincol;
+ old_popup_height = popup_height(wp);
+ old_popup_width = popup_width(wp);
+ old_popup_leftoff = wp->w_popup_leftoff;
+
if (check_for_string_or_list_arg(argvars, 1) == FAIL)
return;
if (must_redraw < UPD_VALID)
must_redraw = UPD_VALID;
popup_adjust_position(wp);
+
+#ifdef FEAT_PROP_POPUP
+ if (old_popup_active
+ && (old_winrow != wp->w_winrow
+ || old_wincol != wp->w_wincol
+ || old_popup_height != popup_height(wp)
+ || old_popup_width != popup_width(wp)
+ || old_popup_leftoff != wp->w_popup_leftoff))
+ redraw_under_popup_area(old_winrow, old_wincol,
+ old_popup_height, old_popup_width, old_popup_leftoff);
+#endif
}
/*
return;
}
+/*
+ * Force windows under a popup area to redraw.
+ */
+ static void
+redraw_under_popup_area(int winrow, int wincol, int height, int width, int leftoff)
+{
+ int r;
+
+ for (r = winrow; r < winrow + height && r < screen_Rows; ++r)
+ {
+ int c;
+ win_T *prev_twp = NULL;
+
+ if (r >= cmdline_row)
+ {
+ clear_cmdline = TRUE;
+ continue;
+ }
+
+ for (c = wincol; c < wincol + width - leftoff && c < screen_Columns; ++c)
+ {
+ int line_cp = r;
+ int col_cp = c;
+ win_T *twp;
+
+ twp = mouse_find_win(&line_cp, &col_cp, IGNORE_POPUP);
+ if (twp != NULL && twp != prev_twp)
+ {
+ prev_twp = twp;
+ if (line_cp < twp->w_height)
+ {
+ linenr_T lnum;
+
+ (void)mouse_comp_pos(twp, &line_cp, &col_cp, &lnum, NULL);
+ redrawWinline(twp, lnum);
+ }
+ else if (line_cp == twp->w_height)
+ twp->w_redr_status = TRUE;
+ }
+ }
+ }
+}
+
/*
* popup_move({id}, {options})
*/
int old_wincol;
int old_height;
int old_width;
+ int old_popup_height;
+ int old_popup_width;
+ int old_popup_leftoff;
if (in_vim9script()
&& (check_for_number_arg(argvars, 0) == FAIL
old_wincol = wp->w_wincol;
old_height = wp->w_height;
old_width = wp->w_width;
+ old_popup_height = popup_height(wp);
+ old_popup_width = popup_width(wp);
+ old_popup_leftoff = wp->w_popup_leftoff;
apply_move_options(wp, dict);
redraw_win_later(wp, UPD_NOT_VALID);
if ((wp->w_popup_flags & POPF_OPACITY) && wp->w_popup_blend > 0)
- {
- int total_h = old_height + popup_top_extra(wp)
- + wp->w_popup_border[2] + wp->w_popup_padding[2];
- int row;
-
- for (row = old_winrow;
- row < old_winrow + total_h && row < screen_Rows; ++row)
- {
- if (row >= cmdline_row)
- clear_cmdline = TRUE;
- else
- {
- int line_cp = row;
- int col_cp = old_wincol;
- win_T *twp;
-
- twp = mouse_find_win(&line_cp, &col_cp, IGNORE_POPUP);
- if (twp != NULL)
- {
- if (line_cp >= twp->w_height)
- twp->w_redr_status = TRUE;
- else
- {
- linenr_T lnum;
-
- (void)mouse_comp_pos(twp, &line_cp, &col_cp,
- &lnum, NULL);
- redrawWinline(twp, lnum);
- }
- }
- }
- }
- }
+ redraw_under_popup_area(old_winrow, old_wincol,
+ old_popup_height, old_popup_width, old_popup_leftoff);
}
}
linenr_T old_firstline;
#ifdef FEAT_PROP_POPUP
int old_blend;
+ int old_popup_active;
#endif
+ int old_winrow;
+ int old_wincol;
+ int old_popup_height;
+ int old_popup_width;
+ int old_popup_leftoff;
int old_zindex;
int old_popup_flags;
char_u *old_scrollbar_highlight;
old_firstline = wp->w_firstline;
#ifdef FEAT_PROP_POPUP
old_blend = wp->w_popup_blend;
+ old_popup_active = (wp->w_popup_flags & POPF_OPACITY)
+ && wp->w_popup_blend > 0;
#endif
+ old_winrow = wp->w_winrow;
+ old_wincol = wp->w_wincol;
+ old_popup_height = popup_height(wp);
+ old_popup_width = popup_width(wp);
+ old_popup_leftoff = wp->w_popup_leftoff;
old_zindex = wp->w_zindex;
old_popup_flags = wp->w_popup_flags;
old_scrollbar_highlight = wp->w_scrollbar_highlight;
// popup_adjust_position() only sets popup_mask_refresh when the
// position or size actually changed.
popup_adjust_position(wp);
+
+#ifdef FEAT_PROP_POPUP
+ if (old_popup_active
+ && (old_winrow != wp->w_winrow
+ || old_wincol != wp->w_wincol
+ || old_popup_height != popup_height(wp)
+ || old_popup_width != popup_width(wp)
+ || old_popup_leftoff != wp->w_popup_leftoff))
+ redraw_under_popup_area(old_winrow, old_wincol,
+ old_popup_height, old_popup_width, old_popup_leftoff);
+#endif
}
/*
&& utf_char2cells(ScreenLinesUC[base_off]) == 2)
{
// The left half still has the wide char on screen.
- // Clear it to a space.
+ // Clear it to an unblended space: only the right half is
+ // covered by the popup background.
ScreenLines[base_off] = ' ';
ScreenLinesUC[base_off] = 0;
ScreenAttrs[base_off] = saved_screenattrs[base_save_off];
+ popup_set_base_screen_cell(row, base_col,
+ ScreenLines[base_off],
+ ScreenAttrs[base_off],
+ ScreenLinesUC[base_off]);
screen_char(base_off, row, base_col);
// Draw padding in the right half.
return;
}
- // screen_line() already cleared the base cell (popup
- // content was a space). Restore the full wide char from
- // saved background so it shows through with opacity.
- if (base_save_off >= 0
- && saved_screenlinesuc != NULL
- && saved_screenlinesuc[base_save_off] != 0
- && utf_char2cells(
- saved_screenlinesuc[base_save_off]) == 2)
- {
- ScreenLines[base_off] =
- saved_screenlines[base_save_off];
- ScreenLinesUC[base_off] =
- saved_screenlinesuc[base_save_off];
- ScreenLines[off] = saved_screenlines[save_off];
- ScreenLinesUC[off] = saved_screenlinesuc[save_off];
- ScreenAttrs[base_off] =
- saved_screenattrs[base_save_off];
- ScreenAttrs[off] = saved_screenattrs[save_off];
-
- int popup_attr_val =
- get_win_attr(screen_opacity_popup);
- int blend = screen_opacity_popup->w_popup_blend;
- ScreenAttrs[base_off] = hl_blend_attr(
- ScreenAttrs[base_off],
- popup_attr_val, blend, TRUE);
- ScreenAttrs[off] = ScreenAttrs[base_off];
- popup_set_base_screen_cell(row, base_col,
- ScreenLines[base_off],
- ScreenAttrs[base_off],
- ScreenLinesUC[base_off]);
- popup_set_base_screen_cell(row, col,
- ScreenLines[off], ScreenAttrs[off],
- ScreenLinesUC[off]);
- screen_char(base_off, row, base_col);
- return;
- }
-
// Draw padding in the right half.
ScreenLines[off] = ' ';
ScreenAttrs[off] = saved_screenattrs[save_off];