sxyazi / yazi

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

[UX] Move rename input box view adaptively #1192

Open fishBone000 opened 3 months ago

fishBone000 commented 3 months ago

Please describe the problem you're trying to solve

When renaming a file and the file name is very long, only a part of the name is displayed in the input box. Deleting all characters within the view won't make the view automatically go left. This is a bit inconvenient and a little confusing.

For example:

Cursor is at then end of the view          here v
╭Rename:─────────────────────────────────────────╮
│ctsABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQR │
╰────────────────────────────────────────────────╯
Hold backspace to delete characters
╭Rename:─────────────────────────────────────────╮
│                                                │
╰────────────────────────────────────────────────╯
All characters in the view is gone, keep holding backspace causes characters outside of the view get deleted. 

Would you be willing to contribute this feature?

Describe the solution you'd like

Perhaps try not to let the cursor touch the left border, e.g. pan the view left when cursor is around 6 characters away from the left border

Additional context

No response

Xerxes-2 commented 3 months ago

I think a better approach is to keep the cursor as centre as possible?

fishBone000 commented 3 months ago

I think a better approach is to keep the cursor as centre as possible?

That sounds good as well