Skip to content

Commit 649f78e

Browse files
authored
fix(textarea): pre-allocation of value (#213)
The maximum slice size of m.value is the max number of rows, which is the max height.
1 parent e72e4a1 commit 649f78e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

textarea/textarea.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func New() Model {
193193
Cursor: cur,
194194
KeyMap: DefaultKeyMap,
195195

196-
value: make([][]rune, minHeight, maxWidth),
196+
value: make([][]rune, minHeight, maxHeight),
197197
focus: false,
198198
col: 0,
199199
row: 0,
@@ -409,7 +409,7 @@ func (m *Model) Blur() {
409409

410410
// Reset sets the input to its default state with no input.
411411
func (m *Model) Reset() {
412-
m.value = make([][]rune, minHeight, maxWidth)
412+
m.value = make([][]rune, minHeight, maxHeight)
413413
m.col = 0
414414
m.row = 0
415415
m.viewport.GotoTop()

0 commit comments

Comments
 (0)