Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [editor] Fix the replaceRange interface issue #945

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

Kakueeen
Copy link
Contributor

as title

Log: fix issue

@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • 代码中使用了lineText.length()来获取行长度,但没有考虑到多字节字符的情况,可能会导致中文等字符被错误地计算为多个字符长度。
  • replaceRange函数中的注释提到了lineLength()函数计算的是字节长度,但没有提供解决方案来处理多字节字符的情况。

是否建议立即修改:

建议的修改措施:

  • 使用editor->toPlainText().length()来获取行长度,确保正确处理多字节字符。
  • 如果需要处理特定字符集的长度,可以考虑使用editor->toPlainText().toUtf8().length()来获取字节数,但要注意这可能会导致性能问题。
  • 在注释中提供解决方案,例如使用editor->toPlainText().length()来替代lineLength(),并确保文档中说明如何处理多字节字符。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deepin-mozart, Kakueeen

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot deepin-ci-robot merged commit 95109fd into linuxdeepin:master Oct 16, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants