Skip to content

Commit

Permalink
fix(textarea): pre-allocation of value (#213)
Browse files Browse the repository at this point in the history
The maximum slice size of m.value is the max number of rows,
which is the max height.
  • Loading branch information
knz committed Aug 15, 2022
1 parent e72e4a1 commit 649f78e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions textarea/textarea.go
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 649f78e

Please sign in to comment.