Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion internal/app/ui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,15 @@ func (m *Model) printUserInput(prefix, input string) tea.Cmd {
return func() tea.Msg {
var highlightedInput string
if input != "" {
highlightedInput = m.highlighter(input)
h := lipgloss.Height(input)
var notice string
if h > 5 { // clamp text height to avoid rendering issues and long scrolling.
lines := strings.Split(input, "\n")
input = strings.Join(lines[:5], "\n")
notice = "\n" + m.styles.ClampNotice.Render(fmt.Sprintf("... (%d more lines)", h-5))
}

highlightedInput = m.highlighter(input) + notice
}

// used to separate previous user input from the current one with half straight line.
Expand Down
7 changes: 7 additions & 0 deletions internal/app/ui/styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ type Styles struct {

// StatusBar styles the status bar at the bottom.
StatusBar lipgloss.Style

// ClampNotice styles the notice when user input is clamped.
ClampNotice lipgloss.Style
}

func DefaultStyles() Styles {
Expand All @@ -48,5 +51,9 @@ func DefaultStyles() Styles {
Foreground(lipgloss.Color("#C4B5FD")).
Background(lipgloss.Color("#2A273F")).
Padding(0, 1),
ClampNotice: lipgloss.NewStyle().
Foreground(lipgloss.Color("#A78BFA")).
Italic(true).
Faint(true),
}
}
Loading