2
0

Refactor "string truncate" (#32984)

This commit is contained in:
wxiaoguang
2024-12-26 11:56:03 +08:00
committed by GitHub
parent df9e511046
commit bf8ec00a2c
26 changed files with 199 additions and 140 deletions

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, " ")