mirror of
https://github.com/Maks1mS/bubbles.git
synced 2025-11-05 15:51:22 +03:00
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.
This commit is contained in:
@@ -193,7 +193,7 @@ func New() Model {
|
|||||||
Cursor: cur,
|
Cursor: cur,
|
||||||
KeyMap: DefaultKeyMap,
|
KeyMap: DefaultKeyMap,
|
||||||
|
|
||||||
value: make([][]rune, minHeight, maxWidth),
|
value: make([][]rune, minHeight, maxHeight),
|
||||||
focus: false,
|
focus: false,
|
||||||
col: 0,
|
col: 0,
|
||||||
row: 0,
|
row: 0,
|
||||||
@@ -409,7 +409,7 @@ func (m *Model) Blur() {
|
|||||||
|
|
||||||
// Reset sets the input to its default state with no input.
|
// Reset sets the input to its default state with no input.
|
||||||
func (m *Model) Reset() {
|
func (m *Model) Reset() {
|
||||||
m.value = make([][]rune, minHeight, maxWidth)
|
m.value = make([][]rune, minHeight, maxHeight)
|
||||||
m.col = 0
|
m.col = 0
|
||||||
m.row = 0
|
m.row = 0
|
||||||
m.viewport.GotoTop()
|
m.viewport.GotoTop()
|
||||||
|
|||||||
Reference in New Issue
Block a user