]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0087: popup: redrawing can be improved when moving popups v9.2.0087
authorYasuhiro Matsumoto <mattn.jp@gmail.com>
Sun, 1 Mar 2026 17:25:08 +0000 (17:25 +0000)
committerChristian Brabandt <cb@256bit.org>
Sun, 1 Mar 2026 17:25:08 +0000 (17:25 +0000)
Problem:  popup: redrawing can be improved when moving popups
Solution: When a pop-up window moves, only the target window should be
          redrawn (Yasuhiro Matsumoto).

closes: #19536

Signed-off-by: Yasuhiro Matsumoto <mattn.jp@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/popupwin.c
src/version.c

index 1d8356ccf8f04d8148aa43743e92a873ee5b51d8..399ab67ac3c99f19c07d7717ed1bfad65be2019a 100644 (file)
@@ -3299,10 +3299,51 @@ f_popup_move(typval_T *argvars, typval_T *rettv UNUSED)
        clear_cmdline = TRUE;
     popup_adjust_position(wp);
 
-    // Redraw the old position to clear ghost images
+    // Redraw the popup at the new position; for opaque popups, the
+    // diff-based popup mask update in may_update_popup_mask() will handle
+    // redrawing the affected lines in regular windows to clear the old
+    // position.  Transparent popups don't participate in popup_mask, so
+    // we need to manually mark the old area's lines for redraw.
     if (old_winrow != wp->w_winrow || old_wincol != wp->w_wincol
            || old_height != wp->w_height || old_width != wp->w_width)
-       redraw_all_later(UPD_NOT_VALID);
+    {
+       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);
+                       }
+                   }
+               }
+           }
+       }
+    }
 }
 
 /*
index e4cec84002a3adb35f0e1fb191f01c76af2fd8e5..9400e182680938535c5f85eaf948c20f3499a6eb 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    87,
 /**/
     86,
 /**/