image.nvim icon indicating copy to clipboard operation
image.nvim copied to clipboard

Flickering in insert mode. (Neorg, Kitty)

Open droshux opened this issue 10 months ago • 2 comments

Images rendered by this plugin in Neorg flicker when the buffer changes. This is not an issue in normal or visual mode but when in insert mode the image flickers with almost every keypress. When editing below an image the lines above jump down and when editing above the image the lines below jump up. This causes significant eyestrain.

This issue does not occur when editing markdown files.

I am using the kitty terminal and the My Config is as follows, with neorg's core.integrations.image enabled with no extra settings. Note: The clear_in_insert_mode option is set to true which could appear to be the culprit but I have tried both with and without this option to no effect.

  {
    "3rd/image.nvim",
    event = "VeryLazy",
    ft = { "md", "norg" },
    config = function()
      require("image").setup({
        processor = "magick_cli",
        integrations = {
          html = { enabled = true },
          neorg = {
            enabled = true,
            clear_in_insert_mode = true,
          }
        }
      })
    end
  },

It's definitely not out of the question that there's a mistake on my end though, especially since I cannot find an existing bug report for this.

droshux avatar Jan 28 '25 17:01 droshux

I myself ported pets.nvim to use Image.nvim and found that the animations flicker rather badly. Tried in kitty, ghostty, and wezterm using the kitty protocol. the animaitons are done via a simple vim.loop.new_timer loop using :start(0, 1000/8) over png frames calling :render({ ... }) and :clear(true) in turn to display a new image

Ryex avatar Mar 29 '25 11:03 Ryex

@droshux can't reproduce, is it something related to completions?

https://github.com/user-attachments/assets/9302e671-99f5-4b5a-926f-278eb2c0824c

@Ryex I implemented streaming for a chromium instance as well with the timer approach and it's not great performance wise (did a nyancat thing as well).

3rd avatar Apr 22 '25 01:04 3rd