sxyazi / yazi

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

`esc` escapes find before it escapes selection. #1752

Closed amano-kenji closed 1 month ago

amano-kenji commented 1 month ago

What system are you running Yazi on?

Gentoo Linux

What terminal are you running Yazi in?

foot 1.16.2

yazi --debug output

Yazi
    Version: 0.3.3 (VERGEN_IDEMPOTENT_OUTPUT 2024-10-08)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.3.3 (VERGEN_IDEMPOTENT_OUTPUT 2024-10-08)

Emulator
    Emulator.via_env: ("foot", "")
    Emulator.via_csi: Ok(Foot)
    Emulator.detect : Foot

Adapter
    Adapter.matches: Sixel

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : Some(":0")
    SWAYSOCK                   : Some("/run/user/1000/sway-ipc.1000.4366.sock")
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL              : Some("/bin/bash")
    EDITOR             : Some("hx")
    VISUAL             : None
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None

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

Multiplexers
    TMUX               : false
    tmux version       : 3.4
    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: 2.2.2
    magick           : 7.1.1-25
    fzf              : 0.54.3
    fd               : No such file or directory (os error 2)
    rg               : No such file or directory (os error 2)
    chafa            : No such file or directory (os error 2)
    zoxide           : No such file or directory (os error 2)
    7z               : 16.02
    7zz              : No such file or directory (os error 2)
    jq               : 1.7.1

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

No.

Describe the bug

I find a directory with /, enter it, and select a few files with space.

Then, I press esc to cancel selection. However, find is cancelled before selection is cancelled.

This behavior was puzzling to me.

Perhaps, should there be a cancel stack that cancels the latest action first?

amano-kenji commented 1 month ago

This describes the behavior I mentioned.

https://github.com/sxyazi/yazi/blob/558d97d08484d3d1279ac55ac7f1e3d845b5096c/yazi-core/src/tab/commands/escape.rs#L35-L60

sxyazi commented 1 month ago

No, this is by design. If you first deselect and then cancel the find, it would mean that every time a user cancels find, they have to give up the list of files they've already selected.

Introducing a cancel stack doesn't make sense to me either because it would break the following workflow:

If you want to change their order, please create a plugin to do that; here's an example https://github.com/sxyazi/yazi/pull/1042#issuecomment-2113994116.

Also, if you just want to cancel the find when entering or leaving a directory, you can simply rebind h and l:

{ on = "h", run = ["leave", "escape --find"], desc = "Go back to the parent directory" },
{ on = "l", run = ["enter", "escape --find"], desc = "Enter the child directory" }, 

Closing as it's the expected behavior

amano-kenji commented 1 month ago

Okay.

github-actions[bot] commented 3 weeks 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 file a new issue and complete the issue template so we can capture all the details necessary to investigate further.