Skip to content

fix(#23): 底部控制列自適應流式佈局 — 英文 label 不再截斷#29

Merged
yintzuyuan merged 8 commits into
mainfrom
fix/ui-text-truncation
Jul 12, 2026
Merged

fix(#23): 底部控制列自適應流式佈局 — 英文 label 不再截斷#29
yintzuyuan merged 8 commits into
mainfrom
fix/ui-text-truncation

Conversation

@yintzuyuan

Copy link
Copy Markdown
Owner

承接已關閉的 #25(base 分支隨 #24 合併刪除而自動關閉)。內容為 #23 修正,已 rebase 到含 #21/#22/#26 的最新 main。

Closes #23

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

yintzuyuan and others added 8 commits June 30, 2026 01:01
#21 未開字型時搜尋會以 charset=None 回退查整個 IDS 資料庫、資料量過大
而崩潰;#22 清空搜尋框時結果區未同步清空、停留在上次搜尋。兩者同屬
搜尋框 callback 路徑,抽單一純函式 resolve_search_action 統一決策
(auto/clear/noop/gate/search),UI 僅負責 dispatch(統一而非添加)。

- hanzi_core: 新增 resolve_search_action 純函式
- glyphs_ui: search_callback 改為依 resolver dispatch;on_glyph_changed
  自動跟隨路徑也改走同一 resolver(自動模式搜尋框恆為空),確保「當前字
  無資料庫資料(如拉丁字母)」在清空搜尋框與自動跟隨兩路徑一致視為無
  選擇而清空;抽 _current_selection_glyph/_current_selection_char
  /_show_selection_char/_clear_all_results 共用 helper;perform_search
  開頭加 #21 防禦性 font guard(defense-in-depth)
- localization: 新增 hint_open_font 四語提示(en/zh-Hant/zh-Hans/ja)
- tests: 新增 test_resolve_search_action(8 測試涵蓋全分支)

核心邏輯 TDD 驗證(151 passed 零回歸);UI 行為實機驗證通過。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
固定座標假設了字串長度(英文 "Deep Analysis"/"Derived" 比中日文長),
80px/60px 容不下英文 label 而截斷。改以實機量測 checkbox 寬度(sizeToFit)
+ flow_layout 純函式由左到右流式擺放,滑桿左緣接續其後,所有語言
(en/zh-Hant/zh-Hans/ja)與未來字串都不再截斷。實機四語驗證 OK。

- hanzi_core.py: 新增 flow_layout 純函式(5 tests,先紅後綠)
- glyphs_ui.py: _measured_checkbox_width + _layout_bottom_bar;minSize 寬 420→470
- 比照 resolve_search_action:純邏輯 TDD、UI 量測黏合靠實機

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
而崩潰;#22 清空搜尋框時結果區未同步清空、停留在上次搜尋。兩者同屬
搜尋框 callback 路徑,抽單一純函式 resolve_search_action 統一決策
(auto/clear/noop/gate/search),UI 僅負責 dispatch(統一而非添加)。

- hanzi_core: 新增 resolve_search_action 純函式
- glyphs_ui: search_callback 改為依 resolver dispatch;on_glyph_changed
  自動跟隨路徑也改走同一 resolver(自動模式搜尋框恆為空),確保「當前字
  無資料庫資料(如拉丁字母)」在清空搜尋框與自動跟隨兩路徑一致視為無
  選擇而清空;抽 _current_selection_glyph/_current_selection_char
  /_show_selection_char/_clear_all_results 共用 helper;perform_search
  開頭加 #21 防禦性 font guard(defense-in-depth)
- localization: 新增 hint_open_font 四語提示(en/zh-Hant/zh-Hans/ja)
- tests: 新增 test_resolve_search_action(8 測試涵蓋全分支)

核心邏輯 TDD 驗證(151 passed 零回歸);UI 行為實機驗證通過。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
固定座標假設了字串長度(英文 "Deep Analysis"/"Derived" 比中日文長),
80px/60px 容不下英文 label 而截斷。改以實機量測 checkbox 寬度(sizeToFit)
+ flow_layout 純函式由左到右流式擺放,滑桿左緣接續其後,所有語言
(en/zh-Hant/zh-Hans/ja)與未來字串都不再截斷。實機四語驗證 OK。

- hanzi_core.py: 新增 flow_layout 純函式(5 tests,先紅後綠)
- glyphs_ui.py: _measured_checkbox_width + _layout_bottom_bar;minSize 寬 420→470
- 比照 resolve_search_action:純邏輯 TDD、UI 量測黏合靠實機

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
固定座標假設了字串長度(英文 "Deep Analysis"/"Derived" 比中日文長),
80px/60px 容不下英文 label 而截斷。改以實機量測 checkbox 寬度(sizeToFit)
+ flow_layout 純函式由左到右流式擺放,滑桿左緣接續其後,所有語言
(en/zh-Hant/zh-Hans/ja)與未來字串都不再截斷。實機四語驗證 OK。

- hanzi_core.py: 新增 flow_layout 純函式(5 tests,先紅後綠)
- glyphs_ui.py: _measured_checkbox_width + _layout_bottom_bar;minSize 寬 420→470
- 比照 resolve_search_action:純邏輯 TDD、UI 量測黏合靠實機

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yintzuyuan
yintzuyuan merged commit 8dbfcd8 into main Jul 12, 2026
2 checks passed
@yintzuyuan
yintzuyuan deleted the fix/ui-text-truncation branch July 12, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

英文的UI文字被截斷

1 participant