sxyazi / yazi

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

map <C-c> to `escape` not work for `close find/filter... popup` #1365

Closed lost22git closed 1 month ago

lost22git commented 1 month ago

What system are you running Yazi on?

Windows

What terminal are you running Yazi in?

windows terminal

yazi --debug output

```sh Yazi Version: 0.2.5 (c65a14c 2024-04-23) OS: windows-x86_64 (windows) Debug: false Emulator Emulator.via_env: ("", "") Emulator.via_csi: Ok(Unknown([])) Emulator.detect: Unknown([]) Adaptor Adaptor.matches: Chafa Desktop XDG_SESSION_TYPE: None WAYLAND_DISPLAY: None DISPLAY: None SSH shared.in_ssh_connection: false WSL /proc/sys/fs/binfmt_misc/WSLInterop: false Variables SHELL: None EDITOR: Some("nvim") ZELLIJ_SESSION_NAME: None YAZI_FILE_ONE: Some("E:\\scoop\\global\\apps\\git\\current\\usr\\bin\\file.exe") YAZI_CONFIG_HOME: None file(1) Version: Ok(Output { status: ExitStatus(ExitStatus(0)), stdout: "file-5.45\nmagic file from /usr/share/misc/magic\n", stderr: "" }) Text Opener default: Some(Opener { run: "nvim \"%*\"", block: true, orphan: false, desc: "neovim", for_: None, spread: true }) block: Some(Opener { run: "nvim \"%*\"", block: true, orphan: false, desc: "neovim", for_: None, spread: true }) tmux TMUX: false Ueberzug++ Version: Err(Error { kind: NotFound, message: "program not found" }) -------------------------------------------------- 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 "C:\\Users\\zzz\\AppData\\Roaming\\yazi\\state" 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

[manager]
prepend_keymap = [
  { on = [ "<C-c>" ], run = "escape", desc = "Exit visual mode, clear selected, or cancel search" }
]

\ map to escape only works for cancel selection but not work for others (e.g. find/filter...)

Expected Behavior

map \ to escape work normally as \<C-[>

To Reproduce

Same as description

Configuration

No response

Anything else?

No response

sxyazi commented 1 month ago

You need to bind it to the input component to make it work like this

https://github.com/sxyazi/yazi/blob/72e9ac79e5c4c5b52ce9332d9391f766b98664bf/yazi-config/preset/keymap.toml#L205-L208

Note that C-c closing the input is a default behavior in the upcoming Yazi 0.3, so you will no longer need it if you're using the latest main branch.

Doc of keymap.toml: https://yazi-rs.github.io/docs/configuration/keymap

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