fix(emulation): handle DECRQM mode queries to fix spurious 'pp' in vim#516
Merged
lzwind merged 1 commit intolinuxdeepin:masterfrom Apr 16, 2026
Merged
Conversation
09892fd to
0496967
Compare
Absorb the '$' CSI intermediate byte in the tokenizer and dispatch the following 'p' final byte through the existing TY_CSI_PR/TY_CSI_PS paths. Add reportAnsiMode() and reportDecMode() helpers to send proper DECRPM replies for the ANSI and DEC modes already tracked by the emulation. This fixes garbage characters (e.g. 'pp') appearing in the top-left corner when launching vim, which was caused by unhandled DECRQM queries falling through to reportDecodingError(). Ref: lxqt/qtermwidget#628 pms: bug-356801
deepin pr auto review这段代码主要是为终端模拟器添加了 DECRQM(请求模式)和 DECRPM(报告模式)的支持,这是 VT100/VT102 终端标准的一部分,用于查询和报告终端的当前设置状态。 以下是对该代码的详细审查意见: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
5. 改进建议总结
修正后的代码片段示例(针对建议2): // 在类定义或头文件中定义常量
private:
static const int MODE_STATUS_RECOGNIZED_SET = 1;
static const int MODE_STATUS_RECOGNIZED_RESET = 2;
static const int MODE_STATUS_PERMANENTLY_RESET = 4;
// ...
// 在 processToken 中使用
case TY_CSI_PS('p', 2) : reportAnsiMode(2, MODE_STATUS_RECOGNIZED_RESET); break;
case TY_CSI_PR('p', 4) : reportDecMode(4, MODE_STATUS_PERMANENTLY_RESET); break;总体而言,这段代码在功能实现上是正确的,增加了对重要终端特性的支持,且具备基本的防御性编程措施。主要的妥协在于对 |
lzwind
approved these changes
Apr 16, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: JWWTSL, lzwind 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 |
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.
Absorb the '$' CSI intermediate byte in the tokenizer and dispatch the following 'p' final byte through the existing TY_CSI_PR/TY_CSI_PS paths. Add reportAnsiMode() and reportDecMode() helpers to send proper DECRPM replies for the ANSI and DEC modes already tracked by the emulation.
This fixes garbage characters (e.g. 'pp') appearing in the top-left corner when launching vim, which was caused by unhandled DECRQM queries falling through to reportDecodingError().
Ref: lxqt/qtermwidget#628