Refactor "string truncate" (#32984)

This commit is contained in:
wxiaoguang authored and GitHub committed 2024-12-26 11:56:03 +08:00
1 parent 594edad213
commit 9bfa9f450d
26 files changed
+199 -140

No files matched your search

+1 -1
View File
@@ -109,7 +109,7 @@ func (a *actionNotifier) CreateIssueComment(ctx context.Context, doer *user_mode
IsPrivate: issue.Repo.IsPrivate,
}
truncatedContent, truncatedRight := util.SplitStringAtByteN(comment.Content, 200)
truncatedContent, truncatedRight := util.EllipsisDisplayStringX(comment.Content, 200)
if truncatedRight != "" {
// in case the content is in a Latin family language, we remove the last broken word.
lastSpaceIdx := strings.LastIndex(truncatedContent, " ")