sxyazi / yazi

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

is_dir check incomplete #1743

Closed dtomvan closed 3 weeks ago

dtomvan commented 1 month ago

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

alacritty 0.13.2

yazi --debug output

Yazi
    Version: 0.3.3 (7c445ce 2024-09-04)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.3 (7c445ce 2024-09-04)

Emulator
    Emulator.via_env: ("xterm-256color", "")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect : Unknown([])

Adapter
    Adapter.matches: X11

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : Some(":1")
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

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

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

Multiplexers
    TMUX               : false
    tmux version       : No such file or directory (os error 2)
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file             : 5.45
    ueberzugpp       : No such file or directory (os error 2)
    ffmpegthumbnailer: No such file or directory (os error 2)
    magick           : No such file or directory (os error 2)
    fzf              : No such file or directory (os error 2)
    fd               : 9.0.0
    rg               : 14.1.0
    chafa            : No such file or directory (os error 2)
    zoxide           : 0.9.3
    7z               : No such file or directory (os error 2)
    7zz              : No such file or directory (os error 2)
    jq               : 1.7

--------------------------------------------------
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/tom/.local/state/yazi" directory.

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

No, and I'll explain why below

Describe the bug

In https://github.com/sxyazi/yazi/blob/main/yazi-core/src/tab/commands/cd.rs#L88 (interactive cd) it is being checked wether or not to filter out the results. This is based on a simple check wether or not the search result is a directory or not. This goes wrong sometimes, as the possibility of a link to a directory isn't considered for interactive cd. This doesn't happen for a regular cd with the l key. It is however very annoying for hidden folders which have been put there using a symlink, like a stow-ed directory for neovim config for example.

Minimal reproducer

  1. mkdir a
  2. ln -s a link-a
  3. $ yazi
  4. g <space>
  5. Type link-a

Result: link-a gets filtered out, because it checks wether the path is strictly a directory and not nessecarily a link pointing to a directory...

When there are other search results it seems to be impossible to force a path it thinks you cannot enter. For example when I do g <space> .config/nvim then .config/astronvim does get matched (because it is not a link) and there is no way to directly enter .config/nvim.

Anything else?

I would send a PR but I don't know where to put the fix. Is it yazi-core, yazi-fs? Does it go directly into cd.rs or do we need some kind of refactor?

sxyazi commented 1 month ago

I'm not quite sure I understand what you mean - do you mean in this case, link-a should be treated by reveal instead of cd?

github-actions[bot] commented 3 weeks ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.