Skip to content

Commit 5952c6c

Browse files
feat: hide discard changes option when no modified files
1 parent 3ad64fb commit 5952c6c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/tui/views/file_view.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ func RenderFileView(m model.Model) string {
5858
}
5959

6060
// Build minimal controls; extra controls go in Help view
61-
controls := []string{"[↑/↓] navigate", "[space] stage/unstage", "[x] discard changes"}
61+
controls := []string{"[↑/↓] navigate", "[space] stage/unstage"}
62+
63+
// Only offer discard option when there are modified files to discard
64+
if len(m.Files) > 0 {
65+
controls = append(controls, "[x] discard changes")
66+
}
6267

6368
if stagedCount > 0 {
6469
controls = append(controls, "[c] commit")
@@ -69,6 +74,7 @@ func RenderFileView(m model.Model) string {
6974
controlsLine := " " + strings.Join(controls, " ")
7075

7176
s.WriteString("\n" + styles.BorderStyle.Render(
77+
//
7278
styles.HelpStyle.Render("Controls:\n")+
7379
styles.HelpStyle.Render(controlsLine),
7480
))

0 commit comments

Comments
 (0)