fix(editor): improve mixed-language file name display in tabs - #507
fix(editor): improve mixed-language file name display in tabs#507JWWTSL wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: JWWTSL The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideIncreases the maximum per-tab width in the editor tab bar so mixed-language (e.g., Chinese/English) filenames are less squeezed and more fully visible. Flow diagram for updated tab width calculationflowchart LR
A[Tabbar::tabSizeHint]
B[Get total width]
C[Get tabCount]
D[Set maxTabWidth = 200]
E[Set minTabWidth = 110]
F{tabCount * maxTabWidth <= total?}
G[tabWidth = maxTabWidth]
H[tabWidth = total / tabCount]
I[Return tabWidth]
A --> B --> C --> D --> E --> F
F -- Yes --> G --> I
F -- No --> H --> I
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Instead of hardcoding
maxTabWidthto 200, consider deriving it from font metrics or DPI (or making it a configurable constant) so the tab width scales appropriately across different display settings and localization scenarios. - Given the fixed
minTabWidthand newmaxTabWidth, it may be worth validating that the overflow/auto-resizing logic still behaves well when the window is narrow and many tabs are open, to avoid unexpected layout issues or truncated close icons.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Instead of hardcoding `maxTabWidth` to 200, consider deriving it from font metrics or DPI (or making it a configurable constant) so the tab width scales appropriately across different display settings and localization scenarios.
- Given the fixed `minTabWidth` and new `maxTabWidth`, it may be worth validating that the overflow/auto-resizing logic still behaves well when the window is narrow and many tabs are open, to avoid unexpected layout issues or truncated close icons.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Increase the maximum tab width to avoid squeezing mixed-language names. 增大标签页最大宽度,避免中英文混合文件名被过度挤压。 Log: 优化中英文混合文件名标签显示 PMS: BUG-370145 Influence: 标签页可展示更完整的中英文混合文件名,减少字符显示不清晰问题。
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 diff --git a/src/controls/tabbar.cpp b/src/controls/tabbar.cpp
--- a/src/controls/tabbar.cpp
+++ b/src/controls/tabbar.cpp
@@ -895,11 +895,9 @@ QSize Tabbar::maximumTabSizeHint(int index) const
{
qDebug() << "Enter maximumTabSizeHint, index:" << index;
Q_UNUSED(index)
#ifdef DTKWIDGET_CLASS_DSizeMode
- return QSize(160, DGuiApplicationHelper::isCompactMode() ? s_TabbarHeightCompact : s_TabbarHeight);
+ return QSize(200, DGuiApplicationHelper::isCompactMode() ? s_TabbarHeightCompact : s_TabbarHeight);
#else
- return QSize(160, 40);
+ return QSize(200, 40);
#endif
- qDebug() << "Exit maximumTabSizeHint";
} |
Increase the maximum tab width to avoid squeezing mixed-language names.
增大标签页最大宽度,避免中英文混合文件名被过度挤压。
Log: 优化中英文混合文件名标签显示
PMS: BUG-370145
Influence: 标签页可展示更完整的中英文混合文件名,减少字符显示不清晰问题。
Summary by Sourcery
Increase the maximum tab width in the editor tab bar to allow longer mixed-language file names to be displayed more clearly.