Skip to content

Commit 1bb717c

Browse files
committed
feat: display release tags inline in log view message column
1 parent 80c2663 commit 1bb717c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/views/log.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ func UpdateLogContent(m *models.Model) {
140140
rest := parts[1]
141141

142142
// Extract branch info from decorations like "(HEAD -> main, origin/main)"
143-
// Split into local branch and origin/remote branch
143+
// Split into local branch, origin/remote branch, and tag
144144
localBranch := ""
145145
originBranch := ""
146+
tag := ""
146147
bracketStart := strings.Index(rest, "(")
147148
bracketEnd := strings.Index(rest, ")")
148149
if bracketStart != -1 && bracketEnd != -1 && bracketStart < bracketEnd {
@@ -163,7 +164,10 @@ func UpdateLogContent(m *models.Model) {
163164
if strings.HasPrefix(part, "HEAD ->") {
164165
branch := strings.TrimSpace(strings.TrimPrefix(part, "HEAD ->"))
165166
localBranch = branch
166-
} else if !strings.HasPrefix(part, "tag:") {
167+
} else if strings.HasPrefix(part, "tag:") {
168+
// Extract tag name
169+
tag = strings.TrimSpace(strings.TrimPrefix(part, "tag:"))
170+
} else {
167171
// Check if it's a remote branch (starts with known remote prefixes)
168172
isRemote := strings.HasPrefix(part, "origin/") ||
169173
strings.HasPrefix(part, "upstream/") ||
@@ -193,6 +197,12 @@ func UpdateLogContent(m *models.Model) {
193197
time := strings.TrimSpace(rest[timeStart+1 : strings.Index(rest[timeStart:], ")")+timeStart])
194198
author := strings.TrimSpace(rest[authorStart+1 : len(rest)-1])
195199

200+
// If there's a tag, prepend it to the message with styling
201+
if tag != "" {
202+
styledTag := lipgloss.NewStyle().Foreground(lipgloss.Color("220")).Render("[" + tag + "]")
203+
message = styledTag + " " + message
204+
}
205+
196206
// Create row with optional styling based on HEAD or origin
197207
row := table.NewRow(table.RowData{
198208
"hash": hash,

0 commit comments

Comments
 (0)