3rd / image.nvim

🖼️ Bringing images to Neovim.
MIT License
812 stars 35 forks source link

Images not cleared after switching to another tmux session #88

Closed Bekaboo closed 7 months ago

Bekaboo commented 7 months ago

Images not cleared after switching to another tmux session.

Plugin config:

package.path = table.concat({
  package.path,
  vim.fs.normalize('~/.luarocks/share/lua/5.1/?/init.lua'),
  vim.fs.normalize('~/.luarocks/share/lua/5.1/?.lua'),
}, ';')

require('image').setup({
  backend = 'kitty',
  window_overlap_clear_enabled = true,
  tmux_show_only_in_active_window = true,
  window_overlap_clear_ft_ignore = {},
  max_width_window_percentage = 80,
  max_height_window_percentage = 30,
})

Recording:

https://github.com/3rd/image.nvim/assets/76579810/543b6846-c6ff-4ee3-a7b7-7e04c79b7909

Additional info:

It is noteworthy that this only happens when switching tmux sessions but not when switching tmux windows.

3rd commented 7 months ago

yeah, it's all a big hack with tmux, for clearing we do try to write the control sequence to whichever tty is active, and it's what makes it work for switching panes: https://github.com/3rd/image.nvim/blob/master/lua/image/backends/kitty/init.lua#L156

but for switching sessions I think we hit a weird moment where the tty we're writing to isn't visible, I'd say it's out of scope as it's a hack anyway and there's probably not much we can do, but maybe it can be cleared from outside neovim when switching the session (kitty remote control would work, maybe there's other ways)