d61ea80f98e66170220dde6ab8f8559c105f9551
- Author
- Christian Rocha <christian@rocha.is>
- Committer
- Christian Rocha <christian@rocha.is>
- Date
Message
Truncate repo names in repo detail header if needed
Diff
1diff --git a/tui/bubbles/repo/bubble.go b/tui/bubbles/repo/bubble.go
2index 573c869dc52ac1f867816ae2c7e85c1b426f2c2b..84a77caa10e79b257bd98a6d13cd98608ae8a7d1 100644
3--- a/tui/bubbles/repo/bubble.go
4+++ b/tui/bubbles/repo/bubble.go
5@@ -12,11 +12,15 @@ import (
6 tea "github.com/charmbracelet/bubbletea"
7 "github.com/charmbracelet/glamour"
8 "github.com/charmbracelet/lipgloss"
9+ "github.com/muesli/reflow/truncate"
10 "github.com/muesli/reflow/wordwrap"
11 "github.com/muesli/reflow/wrap"
12 )
13
14-const glamourMaxWidth = 120
15+const (
16+ glamourMaxWidth = 120
17+ repoNameMaxWidth = 32
18+)
19
20 type ErrMsg struct {
21 Error error
22@@ -103,7 +107,7 @@ func (b Bubble) headerView() string {
23 ns = ns.Copy().BorderForeground(b.styles.ActiveBorderColor)
24 }
25 var gc string
26- n := b.name
27+ n := truncate.StringWithTail(b.name, repoNameMaxWidth, "…")
28 if n == "config" {
29 n = "Home"
30 } else {