mikavilpas / yazi.nvim

A Neovim Plugin for the yazi terminal file manager
MIT License
373 stars 11 forks source link

yazi_floating_window_winblend behaving oddly with icons #162

Closed BigJayToDaIzo closed 3 weeks ago

BigJayToDaIzo commented 1 month ago

When enabling this configuration point yazi behaves oddly with icons that are wider than monospace allows. I've tested this in kitty and alacritty. Both behave slightly differently.

image image image

My yazi.nvim

return {
    "mikavilpas/yazi.nvim",
    event = "VeryLazy",
    dependencies = {
        { "nvim-lua/plenary.nvim", lazy = true },
    },
    keys = {
        -- 👇 in this section, choose your own keymappings!
        {
            "<leader>_",
            function()
                require("yazi").yazi()
            end,
            desc = "Open the file manager",
        },
        {
            -- Open in the current working directory
            "<leader>e",
            function()
                require("yazi").yazi(nil, vim.fn.getcwd())
            end,
            desc = "[E]xecute Yazi File Tree ó°™… ",
        },
    },
    opts = {
        -- if you want to open yazi instead of netrw, see below for more info
        open_for_directories = true,
        floating_window_scaling_factor = 0.85,
        -- Bugged?
        -- yazi_floating_window_winblend = 20,
    },
}

I doubt this has any effect, but my plugin list is rather small and fully curated by myself. Not a bulky distro like NVChad or LazyVIM.

image

In kitty: image

image

Kitty is broken by making the icons with text behind the overflow, half sized so there is no overflow. Kitty resumes normally after disabling.

In Alacritty: image image

As you can see, it behaves differently because the right portion of icons that have text behind them allow the text to bleed through as though the far right end of the icon is transparent, or the 'bg color'. image

Alacritty also resumes normal behavior after commenting.

This behavior does not exist outside the confines of neovim loading the plugin. There are no transparency options (I'm aware of) so raw terminal instances of Yazi both in Zellij and outside the influence of a muxer behave normally.

In terms of where to begin looking, this interesting comment was made on the Yazi discord that may explain this: image

EDIT/UPDATE: Installed Foot terminal and it works beautifully with the feature enabled: image

If you'd like a minimal reproduction, please point me at exactly what that entails and I'll get it done for you.

Thank you for the exceedingly handy plugin!

mikavilpas commented 1 month ago

Thanks for the bug report! This looks like an interesting adventure to be sure...

I tried your settings out but wasn't able to reproduce this on wezterm. Maybe it's terminal specific, but I would like to rule out any chance of conflicting plugins first.

Could you follow the instructions here to create a minimal reproduction? https://github.com/mikavilpas/yazi.nvim/blob/main/documentation/reproducing-issues.md

BigJayToDaIzo commented 1 month ago

Minimal Repro steps:

The only change I made to the repro.lua was enabling that single feature. No other plugins were loaded. If I could get wezterm to work on my box I'd test it, and I'm happy to test any other terminals (Wayland friendly) if it will help. Heck I've got half a mind to jump over into AwesomeWM and see how things are on X. (And will if you want to deep dive this)

As directed, my repro.lua

-- You can use this file to reproduce an issue with your configuration.

---@module "yazi"
---@module "lazy"

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify('./.repro', ':p')

-- set stdpaths to use .repro
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
  vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end

-- bootstrap lazy
local lazypath = root .. '/plugins/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git',
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)
vim.g.mapleader = ' '

-- install the following plugins
---@type LazySpec
local plugins = {
  'folke/tokyonight.nvim',
  {
    'mikavilpas/yazi.nvim',
    event = 'VeryLazy',
    keys = {
      {
        -- 👇 choose your own keymapping
        '<leader>fy',
        function()
          require('yazi').yazi()
        end,

        { desc = 'Open the file manager' },
      },
    },
    ---@type YaziConfig
    opts = {
      open_for_directories = false,
      yazi_floating_window_winblend = 20,

    },
  },
}
require('lazy').setup(plugins, {
  root = root .. '/plugins',
})

vim.cmd.colorscheme('tokyonight')
-- add anything e

Have a fantastic weekend!

mikavilpas commented 3 weeks ago

Do you think the kitty issue might be this? https://yazi-rs.github.io/docs/faq#why-icons-shrink

Looks like the recommendation/workaround is to use a flavor. Can you test this out?

If you're currently not using a flavor, there is an example of the change you need to make here https://github.com/mikavilpas/dotfiles/commit/abbf921f5c85087da7e272f7f1dce5f26ab97c91

basically it's just installing the flavor and then configuring yazi to use it.

mikavilpas commented 3 weeks ago

For reference, I think the issue that was mentioned might have been this https://github.com/sxyazi/yazi/issues/906 and this comment specifically https://github.com/sxyazi/yazi/issues/906#issuecomment-2076696877

BigJayToDaIzo commented 3 weeks ago

This does not seem to solve the problem for me.
image

If you'll remember I tried this in foot, kitty & Alacritty. Alacritty was also exhibiting a slight variation of the oddity. Refactoring from a theme to a flavor sadly did not seem to make any changes/fix.

Added the following table to my yazi.lua neovim plugin:

    {
        "yazi-rs/flavors",
        name = "yazi-flavor-catppuccin-macchiato",
        lazy = true,
        build = function(spec)
            require("yazi.plugin").build_flavor(spec, {
                sub_dir = "catppuccin-macchiato.yazi",
            })
        end,
    },

Pointed my yazi.toml away from theme and onto flavor. I won't bore you with that diff. The colors and appearance changed from my everforest theme to catppuccin so I know it hooked up but the icons falter when yazi_floating_window_winblend = 15 (or other arbitrary integers around 15)

BigJayToDaIzo commented 3 weeks ago

New interesting thing! This is an oil floating window, with winblend enabled. image Notice the exact same issue? I do. AKA this happens as well with yazi and yazi.nvim completely removed from the scenario.

mikavilpas commented 3 weeks ago

That's very interesting indeed. I looked at the oil.nvim repo as well as neovim's repo, but couldn't find any leads in about 20 minutes of investigation.

It might be some neovim bug, but I'm not really sure. Kind of out of ideas.

BigJayToDaIzo commented 3 weeks ago

That's very interesting indeed. I looked at the oil.nvim repo as well as neovim's repo, but couldn't find any leads in about 20 minutes of investigation.

It might be some neovim bug, but I'm not really sure. Kind of out of ideas.

Yeah that's why I wanted to get you the update. I don't think it's ANYTHING within your control as a plugin developer OR a yazi user. Looks like any winblend with icons in the ecosystem seems to behave the same way.