8a57c24eae4fa763d1e586091e06ea8930181e82

Author
Ayman Bagabas <ayman.bagabas@gmail.com>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

fix(tui): selecting an item in an empty git tree

Diff

 1diff --git a/internal/tui/bubbles/git/tree/bubble.go b/internal/tui/bubbles/git/tree/bubble.go
 2index 1a7be03f101ad990185f6f4d4c8a069613e40a22..94c4b43eac5cd832b37a5c6fdbdadbc003b24c42 100644
 3--- a/internal/tui/bubbles/git/tree/bubble.go
 4+++ b/internal/tui/bubbles/git/tree/bubble.go
 5@@ -236,7 +236,7 @@ func (b *Bubble) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 6 		case "F":
 7 			return b, b.reset()
 8 		case "enter", "right", "l":
 9-			if b.state == treeState {
10+			if len(b.list.Items()) > 0 && b.state == treeState {
11 				index := b.list.Index()
12 				item := b.list.SelectedItem().(item)
13 				mode := item.Mode()