Repository navigation
fix: remove visual gap between truncated filename and extension - #4406
Open
feather2222 wants to merge 1 commit into
Open
feather2222 wants to merge 1 commit into
feather2222 wants to merge 1 commit into
Conversation
Collaborator
|
Hi @feather2222, thanks for this :) I will test this and get back to you |
feather2222
force-pushed
the
fix/filename-truncation-gap
branch
4 times, most recently
from
November 1, 2026 14:32
b1738a5 to
d3a35b1
Compare
In the list layout the basename label is middle-truncated by UIKit but keeps the full remaining width, so the extension label is positioned after the label frame instead of after the last rendered glyph. The varying unused width looks like a space inside the filename. Introduce NCFilenameView, a small container that keeps basename and extension in two separate labels (preserving the bidi isolation from setBidiSafeFilename) but measures the truncated basename itself and shrinks the title label to the rendered text width, placing the extension immediately after the last visible glyph. Adopt it in NCListCell and cover the truncation logic with unit tests. Assisted-by: Kimi:K2 Signed-off-by: feather2222 <1402479908@qq.com> Signed-off-by: feather2222 <41533380+feather2222@users.noreply.github.com>
feather2222
force-pushed
the
fix/filename-truncation-gap
branch
from
November 1, 2026 15:21
d3a35b1 to
f51056d
Compare
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
In the list layout, the basename label is middle-truncated by UIKit but keeps the full remaining width. The extension label is then positioned after the label frame rather than after the last rendered glyph, and the unused width looks like a space inside the filename (e.g.
Combo 01x01...manuale .avi).This PR introduces
NCFilenameView, a small container that keeps basename and extension in two separate labels — preserving the Unicode bidi-control isolation provided bysetBidiSafeFilename— but measures the truncated basename itself, shrinks the title label to the rendered text width and positions the extension label immediately after the last visible glyph.Changes
NCFilenameView(iOSClient/Extensions/NCFilenameView.swift): lays out the two labels manually, middle-truncates the basename with the available width (binary search, TextKit measurement), keeps the extension untruncated and logically isolated. ForwardsforFirstBaselineLayoutso baseline alignment in the existing stack view is preserved.NCListCell.xib: the two filename labels are wrapped in anNCFilenameView; the existinglabelTitle/labelExtensionoutlets are unchanged, so no call site changes were needed.setBidiSafeFilename: asks the labels' superview for a layout pass after updating the text.NCFilenameViewTests): cover the truncation helper (untouched short text, fits/maximality, ellipsis fallback) and the tight extension placement.Notes
UILabelinstances.Closes #4282
AI assistance
Signed-off-by: feather2222 1402479908@qq.com