Skip to content
Open
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
7 changes: 6 additions & 1 deletion internal/ui/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type styledLine struct {
text string
highlight bool
secondary bool
noIndent bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The change makes sense to me, but I would phrase the bool the other way around: there is a double-negative feel and the zero value (false = indented) is the minority case (only SeverityInfo gets indented). Since Go's default value for bool is false, it's cleaner to flip to indent bool so the default means "no indent".

}

type App struct {
Expand Down Expand Up @@ -149,7 +150,8 @@ func (a App) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.spinner, _ = a.spinner.Stop()
return a, nil
case output.MessageEvent:
line := styledLine{text: components.RenderMessage(msg)}
noIndent := msg.Severity == output.SeveritySuccess || msg.Severity == output.SeverityNote || msg.Severity == output.SeverityWarning
line := styledLine{text: components.RenderMessage(msg), noIndent: noIndent}
if a.spinner.PendingStop() {
a.bufferedLines = append(a.bufferedLines, line)
} else {
Expand Down Expand Up @@ -299,6 +301,9 @@ func (a App) View() string {
sb.WriteString(indent)
text := hardWrap(line.text, contentWidth)
sb.WriteString(styles.SecondaryMessage.Render(text))
} else if line.noIndent {
text := hardWrap(line.text, a.width)
sb.WriteString(text)
} else {
sb.WriteString(indent)
text := hardWrap(line.text, contentWidth)
Expand Down