diff --git a/internal/app/ui/model.go b/internal/app/ui/model.go index ca574f0..1257241 100644 --- a/internal/app/ui/model.go +++ b/internal/app/ui/model.go @@ -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. diff --git a/internal/app/ui/styles.go b/internal/app/ui/styles.go index 0e98912..2a10f75 100644 --- a/internal/app/ui/styles.go +++ b/internal/app/ui/styles.go @@ -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 { @@ -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), } }