fix(commands): truncate session label by rune count, not byte count
Prevents splitting multi-byte UTF-8 characters (CJK, emoji) when truncating session preview text in /session list output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c917184375
commit
e0e2cb0724
1 changed files with 3 additions and 2 deletions
|
|
@ -109,10 +109,11 @@ func sessionLabel(summary, preview string, maxLen int) string {
|
|||
return "(empty)"
|
||||
}
|
||||
text = strings.ReplaceAll(text, "\n", " ")
|
||||
if len(text) <= maxLen {
|
||||
runes := []rune(text)
|
||||
if len(runes) <= maxLen {
|
||||
return text
|
||||
}
|
||||
return text[:maxLen] + "..."
|
||||
return string(runes[:maxLen]) + "..."
|
||||
}
|
||||
|
||||
// extractSessionTag returns the "#N" suffix from a session key, or "#1" for
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue