mirror of
https://github.com/charmbracelet/crush.git
synced 2025-08-02 05:20:46 +03:00
Merge pull request #269 from charmbracelet/charm-272
fix(tui): cursor position in the textarea
This commit is contained in:
@@ -3,6 +3,7 @@ package tui
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/bubbles/v2/key"
|
||||
tea "github.com/charmbracelet/bubbletea/v2"
|
||||
@@ -447,6 +448,11 @@ func (a *appModel) View() tea.View {
|
||||
var cursor *tea.Cursor
|
||||
if v, ok := page.(util.Cursor); ok {
|
||||
cursor = v.Cursor()
|
||||
// Hide the cursor if it's positioned outside the textarea
|
||||
statusHeight := a.height - strings.Count(pageView, "\n") + 1
|
||||
if cursor != nil && cursor.Y+statusHeight+chat.EditorHeight-2 <= a.height { // 2 for the top and bottom app padding
|
||||
cursor = nil
|
||||
}
|
||||
}
|
||||
activeView := a.dialog.ActiveModel()
|
||||
if activeView != nil {
|
||||
|
||||
Reference in New Issue
Block a user