fix(terminal): skip wide char placeholders when copying text - #550
Conversation
Skip zero-width placeholder cells used by wide characters in plain text decoding. Log: Fix invisible characters in copied selection PMS: BUG-367885
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // PlainTextDecoder::decodeLine 中遍历字符数组时,过滤 character == 0 的空字符
void PlainTextDecoder::decodeLine(const Character* const characters, int count, LineProperty /*properties*/
)
{
...
for (int i=0;i<outputCount;)
{
// 过滤空字符,避免 QString::fromStdWString 生成包含嵌入 \0 的字符串导致截断或乱码
if (characters[i].character != 0) {
plainText.push_back(characters[i].character);
}
i += qMax(1,Character::width(characters[i].character));
}
*_output << QString::fromStdWString(plainText);
} |
|
[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 |
|
/forcemerge |
Skip zero-width placeholder cells used by wide characters in plain text decoding.
Log: Fix invisible characters in copied selection
PMS: BUG-367885