1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Refactor "string truncate" (#32984)

This commit is contained in:
wxiaoguang
2024-12-26 11:56:03 +08:00
committed by GitHub
parent 594edad213
commit 9bfa9f450d
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, " ")