perf(ansiext): grow string builder to optimize allocations
commite6186c65b307e201e1a92df1898fe3e497bfae3c
authorAndrey Nering <andreynering@users.noreply.github.com>
dateWed 23 Jul 2025, 14:39 (1 year ago)
parent63efed6
internal/ansiext/ansi.go+1
@@ -10,6 +10,7 @@ import (
1010// representations to ensure they are displayed correctly in the UI.
1111func Escape(content string) string {
1212 var sb strings.Builder
13+ sb.Grow(len(content))
1314 for _, r := range content {
1415 switch {
1516 case r >= 0 && r <= 0x1f: // Control characters 0x00-0x1F