Repository navigation
Conversation
1. Root cause: BiDi rendering reorders RTL/LTR mixed text visually, but reordered glyph positions misalign with terminal fixed-width cell grid, causing display misalignment in ug_CN/bo_CN 2. Fix: explicitly call setBidiEnabled(false) for ug_CN/bo_CN to force LTR path (LTR_OVERRIDE_CHAR + AlignBottom); TerminalDisplay defaults _bidiEnabled(true), so removing the call is insufficient 3. Impact: only ug_CN/bo_CN affected; other locales unchanged. Uyghur/Tibetan text shows in logical order (LTR) not RTL visual Log: fix terminal display misalignment in Uyghur/Tibetan environment Influence: 1. Test uos-activator-cmd -q output alignment in ug_CN locale 2. Test terminal output alignment in bo_CN locale 3. Verify no regression in zh_CN and en_US locales fix: 禁用维语藏语 BiDi 渲染修复显示错位 1. 根因:BiDi 渲染对 RTL/LTR 混合文本做视觉重排,重排后字符位置 与终端固定宽度 cell 网格不对应,导致 ug_CN/bo_CN 显示错位 2. 方案:对 ug_CN/bo_CN 显式 setBidiEnabled(false) 走 LTR 强制路径 (LTR_OVERRIDE_CHAR + AlignBottom);TerminalDisplay 默认 _bidiEnabled(true),仅删除调用无法关闭 BiDi 3. 影响:仅影响 ug_CN/bo_CN,其他语言不受影响。维语/藏语按逻辑 顺序(LTR)显示而非 RTL 视觉顺序 Log: 修复维语/藏语环境下终端显示错位问题 Influence: 1. 测试维语环境下 uos-activator-cmd -q 输出对齐 2. 测试藏语环境下终端输出对齐 3. 验证中文/英文环境无回归 PMS: BUG-379531
pengfeixx
marked this pull request as draft
November 6, 2026 22:06
Reviewer's GuideImplementationDisable BiDi rendering for Uyghur and Tibetan locales to keep terminal text aligned with the fixed-width cell grid.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
|
TAG Bot New tag: 6.5.42 |
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.
Root Cause Analysis
When the terminal locale is set to
ug_CN(Uyghur) orbo_CN(Tibetan),TermWidget::TermWidgetcallssetBidiEnabled(true), enabling Qt's BiDi text reordering. BiDi reordering visually rearranges mixed RTL/LTR text, but the reordered glyph positions no longer align with the terminal's fixed-width cell grid (_fontWidth * len), causing display misalignment when running commands likeuos-activator-cmd -qthat output mixed RTL labels and LTR values (analysis-report.md section 6).Key evidence:
TerminalDisplay.cpp:886-898— BiDi path usesdrawText(QPointF, text)with cell-grid-left anchoring;TerminalDisplay.cpp:446—_bidiEnableddefaults totrue, so merely removing thesetBidiEnabled(true)call does not disable BiDi.Fix
Explicitly call
setBidiEnabled(false)forug_CN/bo_CNatsrc/views/termwidget.cpp:180, forcing RTL text through the LTR override path (LTR_OVERRIDE_CHAR(U+202D) +AlignBottom), which keeps glyph positions aligned with the cell grid. This matches analysis-report.md section 10 (symptom-layer patch) with no deviation.Change Safety Assessment
Code Safety
fdcad090(2021-03-16), which enabled BiDi for Uyghur/Tibetan to provide RTL visual reading order. This reversal is explicitly approved by BugFix-leader-2.0.setBidiEnabledis called only once inTermWidgetconstructor;change-safety-raw.jsonreferences are empty (reference_count: 0), no other callers affected.Business Impact Scope
Only Uyghur (
ug_CN) and Tibetan (bo_CN) terminal rendering paths are affected — text in these locales will display in logical (LTR) order instead of RTL visual order. All other locales (zh_CN, en_US, etc.) are completely unaffected. User scenario: runninguos-activator-cmd -qor any command producing mixed RTL/LTR output in Uyghur/Tibetan environment.Verification Suggestion
Test
uos-activator-cmd -qoutput alignment inug_CNlocale; verify terminal output alignment inbo_CN; confirm no regression inzh_CN/en_US.根因分析
当终端语言环境为
ug_CN(维语)或bo_CN(藏语)时,TermWidget::TermWidget调用setBidiEnabled(true)启用 Qt BiDi 文本重排。BiDi 重排对混合 RTL/LTR 文本做视觉重排,重排后字符位置与终端固定宽度 cell 网格(_fontWidth * len)不对应,导致运行uos-activator-cmd -q等输出混合 RTL 标签与 LTR 值的命令时显示错位(analysis-report.md 第六节)。关键证据:
TerminalDisplay.cpp:886-898— BiDi 路径用drawText(QPointF, text)以 cell 网格左边界为锚点;TerminalDisplay.cpp:446—_bidiEnabled默认为true,仅删除setBidiEnabled(true)调用无法关闭 BiDi。修复方案
在
src/views/termwidget.cpp:180对ug_CN/bo_CN显式调用setBidiEnabled(false),使 RTL 文本走 LTR 强制路径(LTR_OVERRIDE_CHAR(U+202D) +AlignBottom),字符位置与 cell 网格对齐。与 analysis-report.md 第十节症状层补丁方案一致,无偏离。改动安全评估
代码安全评估
fdcad090(2021-03-16)引入的设计决策(为维语/藏语启用 BiDi 以获得 RTL 视觉阅读顺序),该反转由 BugFix-leader-2.0 显式批准。setBidiEnabled仅在TermWidget构造函数中调用一次;change-safety-raw.json引用为空(reference_count: 0),无其他调用者受影响。业务影响范围
仅影响维语(
ug_CN)和藏语(bo_CN)终端渲染路径——这些语言环境的文本将按逻辑顺序(LTR)显示而非 RTL 视觉顺序。其他语言环境(zh_CN、en_US 等)完全不受影响。用户场景:在维语/藏语环境下运行uos-activator-cmd -q或任何产生混合 RTL/LTR 输出的命令。验证建议
在
ug_CN环境下测试uos-activator-cmd -q输出对齐;验证bo_CN终端输出对齐;确认zh_CN/en_US无回归。Summary by Sourcery
Bug Fixes: