[vim/vim] Popup window image still remains after scrolling out of view (Issue #20501)

2 views
Skip to first unread message

Foxe Chen

unread,
Jun 13, 2026, 12:16:08 AM (yesterday) Jun 13
to vim/vim, Subscribed
64-bitman created an issue (vim/vim#20501)

Steps to reproduce

  1. Source this script:
vim9script

prop_type_add('test', {})

def g:Test(r: number, g: number, b: number, z: number): void
    var pixels: blob = repeat([r, g, b], 100 * 100)->list2blob()

    g:test = popup_create('', {
        image: { data: pixels, width: 100, height: 100 },
        line: 'cursor+1', col: 'cursor', zindex: z,
        clipwindow: true, textprop: 'test'
    })
enddef
  1. Run call prop_add(<line number>, 1, #{type: 'test'})
  2. Run call g:Test(0xff, 0, 0, 100)
  3. Scroll to where the image is, then scroll out, a part of the image still remains.

This only happens when using the kitty graphics protocol. I am suspecting issue is due to the fact that images are retained and not cleared when text is written over it.

Demo:

https://github.com/user-attachments/assets/2d344d99-7f9b-4892-bae9-f304ad3a6b6b

Expected behaviour

Image should be fully cleared

Version of Vim

9.2.620

Environment

Terminal: kitty 0.47.1 created by Kovid Goyal

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20501@github.com>

mattn

unread,
11:04 AM (2 hours ago) 11:04 AM
to vim/vim, Subscribed
mattn left a comment (vim/vim#20501)

Can you this patch?

diff --git a/src/popupwin.c b/src/popupwin.c
index ac2158f78b..ec5a027346 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -2965,6 +2965,25 @@ popup_adjust_position(win_T *wp)
     // leaving stray decorations behind.
     if (popup_compute_clipwindow_offsets(wp))
     {
+	if ((wp->w_popup_flags & POPF_HIDDEN) == 0)
+	{
+#ifdef FEAT_IMAGE_KITTY
+	    // delete the kitty placement before hiding, like popup_hide()
+	    popup_image_clear_kitty(wp);
+#endif
+#ifdef FEAT_IMAGE_GDK
+	    if (gui.in_use)
+		gui_gtk4_remove_image(wp);
+#endif
+#ifdef FEAT_IMAGE
+	    if (wp->w_popup_image_data != NULL)
+	    {
+		redraw_all_later(UPD_NOT_VALID);
+		status_redraw_all();
+		popup_mask_refresh = TRUE;
+	    }
+#endif
+	}
 	popup_hide_for_textprop(wp);
 	return;
     }


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20501/4702125843@github.com>

Foxe Chen

unread,
12:31 PM (14 minutes ago) 12:31 PM
to vim/vim, Subscribed
64-bitman left a comment (vim/vim#20501)

Can you this patch?

diff --git a/src/popupwin.c b/src/popupwin.c
index ac2158f78b..ec5a027346 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -2965,6 +2965,25 @@ popup_adjust_position(win_T *wp)
// leaving stray decorations behind.
if (popup_compute_clipwindow_offsets(wp))
{

  • if ((wp->w_popup_flags & POPF_HIDDEN) == 0)
  • {
    +#ifdef FEAT_IMAGE_KITTY
  • // delete the kitty placement before hiding, like popup_hide()
    
  • popup_image_clear_kitty(wp);
    

+#endif
+#ifdef FEAT_IMAGE_GDK

  • if (gui.in_use)
    
  • gui_gtk4_remove_image(wp);
    

+#endif
+#ifdef FEAT_IMAGE

    • if (wp->w_popup_image_data != NULL)
      
    • {
      
    • redraw_all_later(UPD_NOT_VALID);
      
    • status_redraw_all();
      
    • popup_mask_refresh = TRUE;
      
    • }
      

    +#endif

    • }
      popup_hide_for_textprop(wp);
      return;
      }

    Yes this fixes the issue for me


    Reply to this email directly, view it on GitHub, or unsubscribe.
    Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

    You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20501/4702361364@github.com>

    Reply all
    Reply to author
    Forward
    0 new messages