Skip to content

Commit

Permalink
Truncate repo names in repo detail header if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Sep 17, 2021
1 parent 4b93e2e commit d61ea80
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tui/bubbles/repo/bubble.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/glamour"
"github.com/charmbracelet/lipgloss"
"github.com/muesli/reflow/truncate"
"github.com/muesli/reflow/wordwrap"
"github.com/muesli/reflow/wrap"
)

const glamourMaxWidth = 120
const (
glamourMaxWidth = 120
repoNameMaxWidth = 32
)

type ErrMsg struct {
Error error
Expand Down Expand Up @@ -103,7 +107,7 @@ func (b Bubble) headerView() string {
ns = ns.Copy().BorderForeground(b.styles.ActiveBorderColor)
}
var gc string
n := b.name
n := truncate.StringWithTail(b.name, repoNameMaxWidth, "…")
if n == "config" {
n = "Home"
} else {
Expand Down

0 comments on commit d61ea80

Please sign in to comment.