perf(ansiext): grow string builder to optimize allocations

This commit is contained in:
Andrey Nering
2025-07-23 14:39:00 -03:00
parent 63efed61ac
commit e6186c65b3

View File

@@ -10,6 +10,7 @@ import (
// representations to ensure they are displayed correctly in the UI.
func Escape(content string) string {
var sb strings.Builder
sb.Grow(len(content))
for _, r := range content {
switch {
case r >= 0 && r <= 0x1f: // Control characters 0x00-0x1F