-
Notifications
You must be signed in to change notification settings - Fork 658
feat: truncate long items in the file list #2754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
So the extension won’t be shown? I don’t see the difference between a file name being cut off because it doesn’t fit in the pane and one ending with "..." since the extension is hidden either way. Also, why waste three characters with "..." when a single character like "~" could do the job more efficiently? |
|
No, it's `…` (width is 1, U+2026 HORIZONTAL ELLIPSIS), not `...` (width is
3).
The former is a symbol specifically defined by the Unicode standard for
ellipsis, and CSS also uses it,
https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis
…On Wed, May 14, 2025 at 2:34 AM PoisonFrog ***@***.***> wrote:
*PoisonFrog* left a comment (sxyazi/yazi#2754)
<#2754 (comment)>
So the extension won’t be shown? I don’t see the difference between a file
name being cut off because it doesn’t fit in the pane and one ending with
"..." since the extension is hidden either way. Also, why waste three
characters with "..." when a single character like "~" could do the job
more efficiently?
—
Reply to this email directly, view it on GitHub
<#2754 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEFWFIEN6MHIW5O23YZWVVT26I3LXAVCNFSM6AAAAAB5BIIF3CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNZXGU3TGNBUGE>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Oh, I see. That's much better.
Is there any other case where this would be an issue? If |
|
Yes, there are, `show_symlink` is just one of the cases built-in supported
by Yazi, but users can freely add any content before or after the filename
through the Lua API:
https://github.com/sxyazi/yazi/blob/5a4e6e40684751e600f927aa9ed32e8baabe66f9/yazi-plugin/preset/components/entity.lua#L3-L9
So it's uncertain how much space should be allocated for the filename part.
The current implementation truncates the entire part of the line that
doesn't include `linemode`, so all these cases work correctly.
…On Wed, May 14, 2025 at 2:54 AM PoisonFrog ***@***.***> wrote:
*PoisonFrog* left a comment (sxyazi/yazi#2754)
<#2754 (comment)>
No, it's … (width is 1, U+2026 HORIZONTAL ELLIPSIS), not ... (width is
3). The former is a symbol specifically defined by the Unicode standard for
ellipsis, and CSS also uses it,
https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow#ellipsis
Oh, I see. That's much better.
For example, if the user has enabled show_symlink
<https://yazi-rs.github.io/docs/configuration/yazi/#manager.show_symlink>,
then for symlinks, " -> /path/linked/to" will be appended after the
filename, in which it's hard to determine how long the filename part should
occupy
Is there any other case where this would be an issue? If show_symlink is
the only setting that would conflict with showing the extension we could
have it show extensions when show_symlink is set to false and not show
extensions when it is set to true.
—
Reply to this email directly, view it on GitHub
<#2754 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEFWFIBPHY2PZNFAAWPKOQ326I5U7AVCNFSM6AAAAAB5BIIF3CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNZXGYYTSOJQGU>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
|
@PoisonFrog |
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [sxyazi/yazi](https://github.com/sxyazi/yazi) | minor | `v25.4.8` -> `v25.5.31` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>sxyazi/yazi (sxyazi/yazi)</summary> ### [`v25.5.31`](https://github.com/sxyazi/yazi/releases/tag/v25.5.31) [Compare Source](sxyazi/yazi@v25.5.28...v25.5.31) This is a maintenance release, focusing on bug fixes. #### What's Changed - fix: expose `ui.Wrap` by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2810 - fix: `forward --end-of-word` of the input should consider the mode's delta by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2811 - fix: make every effort to carry hidden states for dummy files by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2814 **Full Changelog**: sxyazi/yazi@v25.5.28...v25.5.31 ### [`v25.5.28`](https://github.com/sxyazi/yazi/releases/tag/v25.5.28) [Compare Source](sxyazi/yazi@v25.4.8...v25.5.28) #### Breaking Changes - `[manager]` is deprecated in favor of the new `[mgr]`. sxyazi/yazi#2803 - `tab_width` has been removed as it no longer needs to be set manually. sxyazi/yazi#2745 - `tab_active` and `tab_inactive` are moved under the new `[tabs]` section. sxyazi/yazi#2745 - `sixel_fraction` has been removed as it's no longer needed. sxyazi/yazi#2707 #### Deprecated - `ya.mgr_emit()`, `ya.app_emit()` and `ya.input_emit()` are deprecated. sxyazi/yazi#2653 - `ya.preview_widgets()` is deprecated. sxyazi/yazi#2706 - `Command:args()` is deprecated. sxyazi/yazi#2752 - The `ya pack` subcommand is deprecated. sxyazi/yazi#2770 - `LEFT`, `CENTER`, `RIGHT` on `ui.Line`, `ui.Text` are deprecated. sxyazi/yazi#2802 - `NONE`, `TOP`, `RIGHT`, `BOTTOM`, `LEFT`, `ALL` on `ui.Bar`, `ui.Border` are deprecated. sxyazi/yazi#2802 - `WRAP_NO`, `WRAP`, `WRAP_TRIM` on `ui.Text` are deprecated. sxyazi/yazi#2802 #### Redesign Tabs sxyazi/yazi#2745 decouples tabs from the header into an independent tab bar component to enhance UX: - A standalone single-line component increases the available space for displaying tabs. - Tab titles are displayed by default to increase recognizability. - Supports switching tabs via mouse for easier navigation. The new tab bar is only shown when there is more than one tab, ensuring no space is wasted for users who don't use tabs. https://github.com/user-attachments/assets/5ca33561-7558-4b9c-8b6a-9dfbc0bc8aa4 #### Calculate Real-Time Directory Size in Spotter sxyazi/yazi#2695 adds directory sizes to the `folder` spotter. The size is computed dynamically in real time and asynchronously, which means: - Every time a user clicks `<Tab>` on a directory, the latest size is calculated. - For large directories, real-time changes in size are reported to the user, with "(?)" appended at the end to indicate that the calculation is in progress. - If the user closes the spotter or switches directories using the left/right arrow keys, any ongoing calculations will be canceled to avoid wasting resources. Also, the computed directory size will be updated in the file list: - If the user sets `linemode = size`, the latest size will be shown on the right of the file line. - If the user sets `sort_by = size`, the file list will be sorted by the latest sizes (if necessary). https://github.com/user-attachments/assets/eb2981e6-3e02-4997-abfc-83cc456a1677 #### 9x Faster Sixel Image Preview sxyazi/yazi#2707 replaces the existing neural network quantization algorithm with Wu's Color Quantizer, which offers [better performance](https://github.com/Ivordir/quantette/blob/main/docs/Benchmarks%20and%20Accuracy.md#time) while [maintaining comparable quality](https://github.com/Ivordir/quantette/blob/main/docs/Benchmarks%20and%20Accuracy.md#accuracydssim). Old implementation (neural network via [`color_quant`](https://github.com/image-rs/color_quant), with default `sixel_fraction = 20`) – average 189.5763999ms: ```sh time: 190.025ms time: 191.054417ms time: 187.696792ms time: 188.060791ms time: 189.381958ms time: 191.618042ms time: 192.383125ms time: 190.511291ms time: 187.8395ms time: 187.193083ms ``` New implementation (Wu - sRGB via [`quantette`](https://github.com/Ivordir/quantette)) – average 20.9199916ms: ```sh time: 21.226458ms time: 20.719542ms time: 21.207583ms time: 20.815875ms time: 21.071291ms time: 21.273459ms time: 20.811792ms time: 20.723166ms time: 20.52675ms time: 20.824ms ``` #### [`piper.yazi` Plugin](https://github.com/yazi-rs/plugins/tree/main/piper.yazi) With [`piper.yazi`](https://github.com/yazi-rs/plugins/tree/main/piper.yazi), you can use the output of any shell command as preview content. This eliminates the need to write a separate plugin for each command, making the use of custom previewers much more convenient.  See https://github.com/yazi-rs/plugins/tree/main/piper.yazi#examples for more examples! #### Double Directory Size Calculation Speed sxyazi/yazi#2683 greatly improves directory computation performance by dividing the task into chunks and reusing existing threads. Directory sorting and file trashing will be observably twice as fast. Run the benchmark script against a 10.16GB folder 5 times in release mode: ```sh Old: elapsed 759.877791ms New: elapsed 364.802583ms Old: elapsed 734.5155ms New: elapsed 360.103375ms Old: elapsed 734.124167ms New: elapsed 365.662458ms Old: elapsed 733.27325ms New: elapsed 365.694042ms Old: elapsed 743.394875ms New: elapsed 364.455083ms ``` #### Input Component Now Supports Password Mode With sxyazi/yazi#2675, a new `obscure = true` option is available: ```lua local value = ya.input { title = "Password:", obscure = true, position = { "center", w = 50 }, } ``` https://github.com/user-attachments/assets/ff5b21f2-977b-4e9f-a279-e4cb15b51a57 #### Truncate Long Items in the File List sxyazi/yazi#2754, sxyazi/yazi#2759, and sxyazi/yazi#2778 add truncation support for long filenames in the file list and archive preview, and display file extensions at the end, ensuring that even if a filename is truncated, you can still know what file type it is by its extension. https://github.com/user-attachments/assets/0f1afbdb-17ec-410f-adea-e8b1d2ed6341 #### [`types.yazi` Plugin](https://github.com/yazi-rs/plugins/tree/main/types.yazi) For a long time, Yazi lacked a type definition file, which made plugin development very painful. Now, it's here! [`types.yazi`](https://github.com/yazi-rs/plugins/tree/main/types.yazi) provides type definitions for Yazi's Lua API, empowering an efficient plugin development experience. #### Improved Built-In Previewers - The `video` previewer now supports displaying embedded video covers, sxyazi/yazi#2640 - The `magick` previewer will respect the user's `image_alloc` and `image_bound` settings, to limit its maximum resource usage, sxyazi/yazi#2602, thanks to [@​ze0987](https://github.com/ze0987) - The `video` previewer will respect the user's `max_width` setting, sxyazi/yazi#2560, thanks to [@​ze0987](https://github.com/ze0987) #### Improve Path Auto-Completion Results The auto-completion results for interactive cd (key: `g` => `<Space>`) will now more closely match the user's input keywords. Done in sxyazi/yazi#2765 #### What's Changed - fix: reverse the mixing order of theme and flavor configuration by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2594 - feat: limit memory usage for previewing large images by [@​ze0987](https://github.com/ze0987) in sxyazi/yazi#2602 - fix: respect the user's `max_width` setting for the built-in video previewer by [@​ze0987](https://github.com/ze0987) in sxyazi/yazi#2560 - feat: allow custom exit code with `quit --code` by [@​Nicholas42](https://github.com/Nicholas42) in sxyazi/yazi#2609 - fix: ensure state synchronization even when the package update fails midway by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2613 - fix: do not change revision when package deployment fails by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2627 - feat: copy-on-write support for field caching by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2629 - feat: fall back to `CSI 16 t` when PowerShell OpenSSH returns a fake terminal size by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2636 - feat: support embedded cover for video preview by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2640 - fix: lazily update files to avoid triggering issues dependent on sort order by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2643 - feat: new `ya.emit()` API by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2653 - feat: fine-grained `peek` and `watch` by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2655 - feat: new `--no-dummy` option for `reveal` command by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2664 - feat: obscure input component for inputting passwords by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2675 - feat: increase the maximum allowed value of `sixel_fraction` to `30` by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2682 - perf: double directory size calculation speed by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2683 - feat: new `fs.calc_size()` API by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2691 - feat: promote `Id` to a first-class type by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2692 - feat: calculate real-time directory size in spotter by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2695 - feat: checks in `ya pub` and `ya emit` subcommands to verify receiver exists and has necessary abilities by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2696 - feat: add `s` and `S` keybinds in the input component by [@​hankertrix](https://github.com/hankertrix) in sxyazi/yazi#2678 - fix: no title is set when starts the first time by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2700 - refactor: move `tty` to the new `yazi-term` crate by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2701 - feat: show error when image preview fails by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2706 - feat!: 9x faster Sixel image preview by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2707 - fix: reset the cursor position with `arrow()` after deleting files by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2708 - fix: `ya pub-to 0` checks if any peer is able to receive the message by [@​mikavilpas](https://github.com/mikavilpas) in sxyazi/yazi#2697 - feat: add `--hovered` to the `copy` command by [@​hankertrix](https://github.com/hankertrix) in sxyazi/yazi#2709 - fix: missing a `hover` event after `cd` by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2719 - fix: detach background and orphan processes from the controlling terminal with `setsid()` by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2723 - fix: avoid tmux interfering with kitty graphical sequences by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2734 - fix: `windows-sys` missing a `Win32_Security` feature by [@​Kreijstal](https://github.com/Kreijstal) in sxyazi/yazi#2728 - feat: make `ui.Line` renderable by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2743 - feat!: redesign tabs by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2745 - refactor: deprecate the `Command:args()` method by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2752 - perf: avoid unnecessary memory allocation in `ya.truncate()` by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2753 - fix: icon rules mixing by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2755 - feat: show file extension for truncated file list items by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2759 - perf: remove intermediate variables in natural sorting algorithm to avoid unnecessary allocation by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2764 - feat: improve path auto-completion results by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2765 - fix: always try to create state directory before draining DDS data by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2769 - feat: truncate long paths in archive preview file list by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2778 - feat: add a `/` to the interactive cd auto-completion candidates by [@​ineu](https://github.com/ineu) in sxyazi/yazi#2777 - feat: make custom tab bar easier by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2782 - fix: update `rust-onig` to v6.5.1 for GCC 15 compatibility by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2794 - feat: new `ui.Align`, `ui.Wrap`, and `ui.Edge` by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2802 - refactor!: deprecate `[manager]` in favor of `[mgr]` by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2803 - chore: bump version to 25.5.28 by [@​sxyazi](https://github.com/sxyazi) in sxyazi/yazi#2804 #### New Contributors - [@​Nicholas42](https://github.com/Nicholas42) made their first contribution in sxyazi/yazi#2609 - [@​Kreijstal](https://github.com/Kreijstal) made their first contribution in sxyazi/yazi#2728 - [@​ineu](https://github.com/ineu) made their first contribution in sxyazi/yazi#2777 **Full Changelog**: sxyazi/yazi@v25.4.8...v25.5.28 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MC41MC4wIiwidXBkYXRlZEluVmVyIjoiNDAuNTAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
An implementation of the feature request: #903
Resolves #903
Note that this implementation uses a fixed"…"rather than"…file extension"because the filename might not necessarily be at the end of the line.For example, if the user has enabledshow_symlink, then for symlinks," -> /path/linked/to"will be appended after the filename, in which it's hard to determine how long the filename part should occupy"…file extension"is now supported in #2759