diff --git a/internal/tui/absorb.go b/internal/tui/absorb.go index eb51ce3..dab374d 100644 --- a/internal/tui/absorb.go +++ b/internal/tui/absorb.go @@ -108,12 +108,14 @@ func (a absorbModel) visibleCount() int { func renderAbsorbSource(e *db.Entity, maxWidth int) string { glyph := glyphStyle.Render(display.DisplayGlyph(e.Glyph, e.CardType)) - id := idStyle.Render("[" + display.FormatID(e.ID) + "]") body := e.Body if e.Title != nil { body = *e.Title } + if idx := strings.IndexByte(body, '\n'); idx >= 0 { + body = body[:idx] + } var tags string if len(e.Tags) > 0 { @@ -125,11 +127,11 @@ func renderAbsorbSource(e *db.Entity, maxWidth int) string { tags = " " + strings.Join(tagParts, " ") } - line := fmt.Sprintf("%s %s%s %s", glyph, body, tags, id) + line := fmt.Sprintf("%s %s%s", glyph, body, tags) if maxWidth > 0 && len(stripAnsi(line)) > maxWidth { - body = truncate(body, maxWidth-20) - line = fmt.Sprintf("%s %s%s %s", glyph, body, tags, id) + body = truncate(body, maxWidth-6) + line = fmt.Sprintf("%s %s%s", glyph, body, tags) } return line diff --git a/internal/tui/cards.go b/internal/tui/cards.go index 72416cc..ed38dfb 100644 --- a/internal/tui/cards.go +++ b/internal/tui/cards.go @@ -301,12 +301,14 @@ func (c cardsModel) visibleCount() int { func renderCard(e *db.Entity, maxWidth int) string { glyph := glyphStyle.Render(display.DisplayGlyph(e.Glyph, e.CardType)) - id := idStyle.Render("[" + display.FormatID(e.ID) + "]") body := e.Body if e.Title != nil { body = *e.Title } + if idx := strings.IndexByte(body, '\n'); idx >= 0 { + body = body[:idx] + } affordance := detectAffordance(e) affordStr := "" @@ -335,11 +337,11 @@ func renderCard(e *db.Entity, maxWidth int) string { useStr = " " + useCountStyle.Render(fmt.Sprintf("%d×", e.UseCount)) } - line := fmt.Sprintf("%s %s%s%s%s %s", glyph, body, affordStr, extraStr, useStr, id) + line := fmt.Sprintf("%s %s%s%s%s", glyph, body, affordStr, extraStr, useStr) if maxWidth > 0 && len(stripAnsi(line)) > maxWidth { - body = truncate(body, maxWidth-30) - line = fmt.Sprintf("%s %s%s%s%s %s", glyph, body, affordStr, extraStr, useStr, id) + body = truncate(body, maxWidth-8) + line = fmt.Sprintf("%s %s%s%s%s", glyph, body, affordStr, extraStr, useStr) } return line diff --git a/internal/tui/list.go b/internal/tui/list.go index 8c95c96..696912c 100644 --- a/internal/tui/list.go +++ b/internal/tui/list.go @@ -204,23 +204,23 @@ func renderEntity(e *db.Entity, maxWidth int) string { } glyph := style.Render(glyphStr) - id := idStyle.Render("[" + display.FormatID(e.ID) + "]") - body := e.Body if e.Title != nil { body = *e.Title } + if idx := strings.IndexByte(body, '\n'); idx >= 0 { + body = body[:idx] + } var extras []string if e.Pinned { extras = append(extras, pinnedStyle.Render("•")) } if len(e.Tags) > 0 { - tagParts := make([]string, len(e.Tags)) - for i, t := range e.Tags { - tagParts[i] = tagStyle.Render("#" + t) + limit := min(2, len(e.Tags)) + for _, t := range e.Tags[:limit] { + extras = append(extras, tagStyle.Render("#"+t)) } - extras = append(extras, strings.Join(tagParts, " ")) } extraStr := "" @@ -228,11 +228,11 @@ func renderEntity(e *db.Entity, maxWidth int) string { extraStr = " " + strings.Join(extras, " ") } - line := fmt.Sprintf("%s %s%s %s", glyph, body, extraStr, id) + line := fmt.Sprintf("%s %s%s", glyph, body, extraStr) if maxWidth > 0 && len(stripAnsi(line)) > maxWidth { - body = truncate(body, maxWidth-20) - line = fmt.Sprintf("%s %s%s %s", glyph, body, extraStr, id) + body = truncate(body, maxWidth-6) + line = fmt.Sprintf("%s %s%s", glyph, body, extraStr) } return line diff --git a/internal/tui/styles.go b/internal/tui/styles.go index 94e31ca..637e0f5 100644 --- a/internal/tui/styles.go +++ b/internal/tui/styles.go @@ -17,7 +17,7 @@ var ( PaddingLeft(1) listItemStyle = lipgloss.NewStyle(). - PaddingLeft(2) + PaddingLeft(4) selectedItemStyle = lipgloss.NewStyle(). PaddingLeft(1).