File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -630,6 +630,7 @@ func (m *Model) CursorDown() {
630630 m .col = nli .StartColumn
631631
632632 if nli .Width <= 0 {
633+ m .repositionView ()
633634 return
634635 }
635636
@@ -641,6 +642,8 @@ func (m *Model) CursorDown() {
641642 offset += rw .RuneWidth (m.value [m.row ][m.col ])
642643 m .col ++
643644 }
645+
646+ m .repositionView ()
644647}
645648
646649// CursorUp moves the cursor up by one line.
@@ -665,6 +668,7 @@ func (m *Model) CursorUp() {
665668 m .col = nli .StartColumn
666669
667670 if nli .Width <= 0 {
671+ m .repositionView ()
668672 return
669673 }
670674
@@ -676,6 +680,8 @@ func (m *Model) CursorUp() {
676680 offset += rw .RuneWidth (m.value [m.row ][m.col ])
677681 m .col ++
678682 }
683+
684+ m .repositionView ()
679685}
680686
681687// SetCursorColumn moves the cursor to the given position. If the position is
@@ -1041,12 +1047,14 @@ func (m Model) Width() int {
10411047func (m * Model ) MoveToBegin () {
10421048 m .row = 0
10431049 m .SetCursorColumn (0 )
1050+ m .repositionView ()
10441051}
10451052
10461053// MoveToEnd moves the cursor to the end of the input.
10471054func (m * Model ) MoveToEnd () {
10481055 m .row = len (m .value ) - 1
10491056 m .SetCursorColumn (len (m .value [m .row ]))
1057+ m .repositionView ()
10501058}
10511059
10521060// SetWidth sets the width of the textarea to fit exactly within the given width.
@@ -1125,6 +1133,8 @@ func (m *Model) SetHeight(h int) {
11251133 m .height = max (h , minHeight )
11261134 m .viewport .SetHeight (max (h , minHeight ))
11271135 }
1136+
1137+ m .repositionView ()
11281138}
11291139
11301140// Update is the Bubble Tea update loop.
You can’t perform that action at this time.
0 commit comments