3rd / image.nvim

🖼️ Bringing images to Neovim.
MIT License
1.02k stars 42 forks source link

Image overlaps statusline when laststatus=2 #179

Closed vurentjie closed 3 months ago

vurentjie commented 3 months ago

I noticed when each window has it's own statusline then the images overlap the statusline.

Repro steps:

  1. Use the provided code below, save as image-test.lua
  2. Run nvim --clean -u image-test.lua
  3. Open a separate split window with :new
  4. Open a image with :edit /path/to/image.png
  5. Resize the split so that the statusline coincides with the image.

Screencast demo: Screencast 2024-06-14 10:10:42.webm

Lua code:

--save this as image-test.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"

if not vim.uv.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable",
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

local lazy = require("lazy") --[[@as Lazy]]

vim.api.nvim_set_hl(0, "TabLine", { fg = "#ffffff", bg = "#770000" })
vim.api.nvim_set_hl(0, "StatusLine", { fg = "#ffffff", bg = "#777700" })
vim.api.nvim_set_hl(0, "StatusLineNC", { fg = "#ffffff", bg = "#777700" })
vim.api.nvim_set_hl(0, "Winbar", { fg = "#ffffff", bg = "#000077" })
vim.api.nvim_set_hl(0, "WinbarNC", { fg = "#ffffff", bg = "#000077" })

vim.opt.mouse = 'a'
vim.opt.showtabline = 2
vim.opt.laststatus = 2
vim.opt.tabline = "Tabline text goes here"
vim.opt.statusline = "Statusline text goes here"
vim.opt.winbar = "Winbar text goes here"

lazy.setup({
  {
    "vhyrro/luarocks.nvim",
    priority = 1001,
    opts = {
      rocks = { "magick" },
    },
  },
  {
    "3rd/image.nvim",
    dependencies = { "luarocks.nvim" },
    config = function()
      require('image').setup({
        backend = 'kitty',
        max_width_window_percentage = 1000,
        max_height_window_percentage = 1000,
      })
    end,
  },
}, {})

Placeholder image used in demo (600x400 pixels): placeholder

vurentjie commented 3 months ago

I was able to fix my issue with these changes, https://github.com/3rd/image.nvim/compare/master...vurentjie:image.nvim:master

3rd commented 3 months ago

Hey, that's awesome, would you like to open a PR to track your contribution?