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
17 changes: 13 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,15 @@ func (m model) formatListItem(item listItem, selected bool) string {
project = project[:19] + "..."
}

topic := truncate(getTopic(item.conv), 40)
// Mark named sessions (custom/ai title) so they're distinguishable from
// rows that fall back to the first user message. ponytail: the glyph is
// ambiguous-width, so a named row may sit one cell narrow on CJK-width
// terminals - cosmetic only, truncate is rune-safe.
topic := getTopic(item.conv)
if item.conv.Title != "" {
topic = "✎ " + topic
}
topic = truncate(topic, 40)

// Message count
msgs := len(item.conv.Messages)
Expand Down Expand Up @@ -861,10 +869,11 @@ func buildItems(conversations []Conversation) []listItem {
searchParts = append(searchParts, formatTimestamp(conv.FirstTimestamp))
searchParts = append(searchParts, formatTimestamp(conv.LastTimestamp))

// Include assistant messages too so a conversation is findable by
// what Claude said, matching the HITS column and preview which already
// count all messages.
for _, msg := range conv.Messages {
if msg.Role == "user" {
searchParts = append(searchParts, msg.Text)
}
searchParts = append(searchParts, msg.Text)
}

searchText := strings.Join(searchParts, " ")
Expand Down
27 changes: 27 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ func TestBuildItems(t *testing.T) {
t.Errorf("search text should contain all user messages, got %q", items[0].searchText)
}

// Search text should also contain assistant messages (findable by what Claude said)
if !strings.Contains(items[0].searchText, "response 1") || !strings.Contains(items[0].searchText, "response 2") {
t.Errorf("search text should contain assistant messages, got %q", items[0].searchText)
}

// Search text should contain session ID
if !strings.Contains(items[0].searchText, "session1") {
t.Errorf("search text should contain session ID, got %q", items[0].searchText)
Expand Down Expand Up @@ -697,6 +702,28 @@ func TestFormatListItem(t *testing.T) {
}
}

func TestFormatListItemNamedSessionMarker(t *testing.T) {
named := listItem{conv: Conversation{
SessionID: "s1",
Title: "Refactor auth flow",
LastTimestamp: "2024-01-15T10:30:00Z",
Messages: []Message{{Role: "user", Text: "hi"}},
}}
unnamed := listItem{conv: Conversation{
SessionID: "s2",
LastTimestamp: "2024-01-15T10:30:00Z",
Messages: []Message{{Role: "user", Text: "just a first message"}},
}}
m := initialModel([]listItem{named, unnamed}, "", nil)

if got := m.formatListItem(named, false); !strings.Contains(got, "✎ Refactor auth flow") {
t.Errorf("named session should show the marker, got %q", got)
}
if got := m.formatListItem(unnamed, false); strings.Contains(got, "✎") {
t.Errorf("first-message fallback should not show the marker, got %q", got)
}
}

func TestUpdateKeyboardNavigation(t *testing.T) {
items := []listItem{
{conv: Conversation{SessionID: "test-1"}, searchText: "first"},
Expand Down
Loading