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
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 {
saved = lipgloss.NewStyle().Faint(true).Render(" (not saved)")
suffix += faint.Render(" (not saved)")
}
var selectedPrefix string
if m.focus == focusMessages && i == m.selectedMessage {
selectedPrefix = "> "
}
header := lipgloss.NewStyle().PaddingLeft(1).Render(selectedPrefix + user + saved)
header := lipgloss.NewStyle().PaddingLeft(1).Render(prefix + user + suffix)
sb.WriteString(header)
lineCnt += lipgloss.Height(header)