sxyazi / yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.
https://yazi-rs.github.io
MIT License
17.11k stars 399 forks source link

`cd --interactive` - some dirs/files icons are small until hovered #1477

Closed xfzv closed 3 months ago

xfzv commented 3 months ago

What system are you running Yazi on?

Linux X11

What terminal are you running Yazi in?

kitty 0.35.2

yazi --debug output

Yazi
    Version: 0.3.0 (71d6b0d 2024-08-12)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.0

Emulator
    Emulator.via_env: ("xterm-kitty", "")
    Emulator.via_csi: Ok(Kitty)
    Emulator.detect : Kitty

Adapter
    Adapter.matches: Kitty

Desktop
    XDG_SESSION_TYPE: Some("tty")
    WAYLAND_DISPLAY : None
    DISPLAY         : Some(":0")

SSH
    shared.in_ssh_connection: false

WSL
    /proc/sys/fs/binfmt_misc/WSLInterop: false

Variables
    SHELL              : Some("/bin/zsh")
    EDITOR             : Some("nvim")
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None
    ZELLIJ_SESSION_NAME: None

Text Opener
    default: Some(Opener { run: "${EDITOR} \"$@\"", block: true, orphan: false, desc: "Neovim", for_: None, spread: true })
    block  : Some(Opener { run: "${EDITOR} \"$@\"", block: true, orphan: false, desc: "Neovim", for_: None, spread: true })

tmux
    TMUX   : false
    Version: No such file or directory (os error 2)

Dependencies
    file             : 5.45
    ueberzugpp       : No such file or directory (os error 2)
    ffmpegthumbnailer: 2.2.2
    magick           : 7.1.1-25
    fzf              : 0.53.0
    fd               : 10.1.0
    rg               : 14.1.0
    chafa            : No such file or directory (os error 2)
    zoxide           : 0.9.4
    7z               : 16.02
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1

--------------------------------------------------
When reporting a bug, please also upload the `yazi.log` log file - only upload the most recent content by time.
You can find it in the "/home/xfzv/.local/state/yazi" directory.

Did you try the latest nightly build to see if the problem got fixed?

Yes, and I updated the debug information above (yazi --debug) to the nightly that I tried

Describe the bug

With

{ on = [ "g", "<Space>" ], run = "cd --interactive", desc = "Go to a directory interactively" },

directories and files icons are small until hovered:

screenshot

I'm using JetBrainsMono Nerd Font if that matters:

# ~/.config/kitty/kitty.conf

font_family                     JetBrainsMono NF Medium
bold_font                       JetBrainsMono NF Bold
italic_font                     JetBrainsMono NF Italic
bold_italic_font                JetBrainsMono NF Bold Italic

Minimal reproducer

Occurs without ~/.config/yazi/ directory. Just use cd --interactive.

Anything else?

Also tried with empty ~/.config/kitty directory (so without JetBrainsMono Nerd Font), same issue.

It seems that depending on the current working directory, sometimes the icons have normal size out of the box. I can't determine a precise pattern.

Sometimes, some directories that have not been hovered yet have the correct icon size (here /usr ; /mnt and /sys):

2

CyberShadow commented 3 months ago

I think this is described here: https://yazi-rs.github.io/docs/faq/#why-icons-shrink

xfzv commented 3 months ago

I think this is described here: https://yazi-rs.github.io/docs/faq/#why-icons-shrink

I'm actually using a Yazi flavor (catppuccin-mocha.yazi) so I guess this shouldn't happen?

ValdezFOmar commented 3 months ago

This is just a feature of kitty (https://github.com/kovidgoyal/kitty/issues/2672#issuecomment-631320091). I've seen this happen with other terminal programs and is just a fact of how kitty works, sometimes it might not grow or shrink icons until you hover over them (like in your issue) for whatever reason. So I don't think there's much that can be done on yazi (or any program) to mitigate that.

Also related: https://github.com/kovidgoyal/kitty/issues/6210

With that said, I was able to reproduce your issue sometimes when typing a / (like in your examples) as the first thing in the prompt. Other thing that also works is typing any character, press backspace and some of the new listed entries will have the same issue. If you hover over them, close the prompt and repeat the steps, now the new listed entries no longer have the issue, until you open a new instance of yazi.

xfzv commented 3 months ago

Other thing that also works is typing any character, press backspace and some of the new listed entries will have the same issue. If you hover over them, close the prompt and repeat the steps, now the new listed entries no longer have the issue, until you open a new instance of yazi.

Can reproduce this too.

Well, if there's pretty much no way to avoid this with Kitty, maybe https://yazi-rs.github.io/docs/faq/#why-icons-shrink should be changed.

As I understand it in its current state, using a yazi flavor should fix the problem, turns out it's not (unless I'm missing something).

sxyazi commented 3 months ago

Well, if there's pretty much no way to avoid this with Kitty, maybe https://yazi-rs.github.io/docs/faq/#why-icons-shrink should be changed.

The FAQ already mentioned that this is a hack based on setting colors for icons:

In kitty, you have to add a style to file list items (like foreground color) to make the icons match the text size

But as you can see, the auto-complete icons don't support color settings, so it doesn't work for them

https://github.com/sxyazi/yazi/blob/c75960eae632a69686a6db38d4d7214625ecf254/yazi-config/preset/theme.toml#L108-L111

I don't think there's much Yazi can do here. Maybe in the future, if auto-complete icons start supporting color, this issue might be less of a problem (though you'd still need a flavor).

It's worth mentioning that I can't reproduce the auto-complete icon issue whether I use a flavor or not. My icon sizes are always fine, though I'm pretty sure this is a problem specific to Kitty.

xfzv commented 3 months ago

I see, thanks for the details.

github-actions[bot] commented 2 months ago

I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.