fix(tui): show selected chat message first
This commit is contained in:
parent
5d30d87305
commit
701411fac4
@ -3416,15 +3416,16 @@ func (m model) chatDetailLines(item Item, width int) []string {
|
||||
if meta := chatMetaLine(item); meta != "" {
|
||||
lines = append(lines, dim(meta))
|
||||
}
|
||||
if message := chatBodyText(item); message != "" {
|
||||
lines = append(lines, "", dim(tuiRule(width)), bold("Message"))
|
||||
lines = appendLimitedDetailLines(lines, chatBubbleLines(item, message, true, width), detailBodyLimit(m.compactDetail))
|
||||
}
|
||||
if title, thread := m.threadSection(item, width); len(thread) > 0 {
|
||||
lines = append(lines, "", dim(tuiRule(width)), bold(title))
|
||||
lines = appendLimitedDetailLines(lines, thread, detailBodyLimit(m.compactDetail))
|
||||
} else if title, conversation := m.conversationSection(item, width); len(conversation) > 0 {
|
||||
lines = append(lines, "", dim(tuiRule(width)), bold(title))
|
||||
lines = appendLimitedDetailLines(lines, conversation, detailBodyLimit(m.compactDetail))
|
||||
} else if message := chatBodyText(item); message != "" {
|
||||
lines = append(lines, "", dim(tuiRule(width)), bold("Message"))
|
||||
lines = appendLimitedDetailLines(lines, chatBubbleLines(item, message, true, width), detailBodyLimit(m.compactDetail))
|
||||
}
|
||||
if !m.compactDetail {
|
||||
if properties := chatPropertyLines(item); len(properties) > 0 {
|
||||
|
||||
@ -467,6 +467,9 @@ func TestChatDetailUsesTranscriptShapeBeforeMetadata(t *testing.T) {
|
||||
t.Fatalf("chat detail missing %q:\n%s", want, joined)
|
||||
}
|
||||
}
|
||||
if strings.Index(joined, "Message") > strings.Index(joined, "Thread 1-2/2") {
|
||||
t.Fatalf("selected message should appear before thread context:\n%s", joined)
|
||||
}
|
||||
if strings.Index(joined, "Thread") > strings.Index(joined, "Properties") {
|
||||
t.Fatalf("chat detail should put readable content before properties:\n%s", joined)
|
||||
}
|
||||
@ -515,6 +518,9 @@ func TestChatDetailFallsBackToConversationWindow(t *testing.T) {
|
||||
t.Fatalf("conversation detail missing %q:\n%s", want, joined)
|
||||
}
|
||||
}
|
||||
if strings.Index(joined, "Message") > strings.Index(joined, "Conversation 1-3/3") {
|
||||
t.Fatalf("selected message should appear before conversation context:\n%s", joined)
|
||||
}
|
||||
}
|
||||
|
||||
func TestChatDetailDoesNotTreatMetadataAsMessageBody(t *testing.T) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user