tui: show the message position when focused

This commit is contained in:
Matt Low 2024-03-17 21:18:50 +00:00
parent 6c64f21d9a
commit 3185b2d7d6

View File

@ -786,17 +786,22 @@ func (m *model) conversationView() string {
// write message heading with space for content // write message heading with space for content
user := style.Render(icon + friendly) user := style.Render(icon + friendly)
var saved string var prefix string
var suffix string
faint := lipgloss.NewStyle().Faint(true)
if m.focus == focusMessages {
if i == m.selectedMessage {
prefix = "> "
}
suffix += faint.Render(fmt.Sprintf(" (%d/%d)", i+1, msgCnt))
}
if message.ID == 0 { if message.ID == 0 {
saved = lipgloss.NewStyle().Faint(true).Render(" (not saved)") suffix += faint.Render(" (not saved)")
} }
var selectedPrefix string header := lipgloss.NewStyle().PaddingLeft(1).Render(prefix + user + suffix)
if m.focus == focusMessages && i == m.selectedMessage {
selectedPrefix = "> "
}
header := lipgloss.NewStyle().PaddingLeft(1).Render(selectedPrefix + user + saved)
sb.WriteString(header) sb.WriteString(header)
lineCnt += lipgloss.Height(header) lineCnt += lipgloss.Height(header)