on main help sign in
Merge pull request #269 from charmbracelet/charm-272

fix(tui): cursor position in the textarea

commit809477b036ef63fc2632cdb05d9faa5185975ea1 authorKujtim Hoxha <kujtimii.h@gmail.com> dateThu 24 Jul 2025, 09:21 (1 year ago) parenta6b9d6f8f39595
1 file changed+6
internal/tui/tui.go+6
internal/tui/tui.go+6
@@ -3,6 +3,7 @@ package tui
33import (
44 "context"
55 "fmt"
6+ "strings"
67
78 "github.com/charmbracelet/bubbles/v2/key"
89 tea "github.com/charmbracelet/bubbletea/v2"
@@ -447,6 +448,11 @@ func (a *appModel) View() tea.View {
447448 var cursor *tea.Cursor
448449 if v, ok := page.(util.Cursor); ok {
449450 cursor = v.Cursor()
451+ // Hide the cursor if it's positioned outside the textarea
452+ statusHeight := a.height - strings.Count(pageView, "\n") + 1
453+ if cursor != nil && cursor.Y+statusHeight+chat.EditorHeight-2 <= a.height { // 2 for the top and bottom app padding
454+ cursor = nil
455+ }
450456 }
451457 activeView := a.dialog.ActiveModel()
452458 if activeView != nil {