From fce96bd7ef7e4712ecc8fd56650d7af44b3ed915 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Sun, 14 Aug 2022 14:10:58 +0200 Subject: [PATCH] textarea: fix the pre-allocation of value The maximum slice size of m.value is the max number of rows, which is the max height. --- textarea/textarea.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/textarea/textarea.go b/textarea/textarea.go index c7040058..3c0e92ac 100644 --- a/textarea/textarea.go +++ b/textarea/textarea.go @@ -193,7 +193,7 @@ func New() Model { Cursor: cur, KeyMap: DefaultKeyMap, - value: make([][]rune, minHeight, maxWidth), + value: make([][]rune, minHeight, maxHeight), focus: false, col: 0, row: 0, @@ -409,7 +409,7 @@ func (m *Model) Blur() { // Reset sets the input to its default state with no input. func (m *Model) Reset() { - m.value = make([][]rune, minHeight, maxWidth) + m.value = make([][]rune, minHeight, maxHeight) m.col = 0 m.row = 0 m.viewport.GotoTop()