mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-24 14:44:38 +03:00
perf(textarea): amortize heap allocs in Value
(#212)
This commit is contained in:
parent
9b67fb8724
commit
e72e4a190b
@ -271,13 +271,13 @@ func (m Model) Value() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
var v string
|
var v strings.Builder
|
||||||
for _, l := range m.value {
|
for _, l := range m.value {
|
||||||
v += string(l)
|
v.WriteString(string(l))
|
||||||
v += "\n"
|
v.WriteByte('\n')
|
||||||
}
|
}
|
||||||
|
|
||||||
return strings.TrimSuffix(v, "\n")
|
return strings.TrimSuffix(v.String(), "\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Length returns the number of characters currently in the text input.
|
// Length returns the number of characters currently in the text input.
|
||||||
|
Loading…
Reference in New Issue
Block a user