Detailed changes
@@ -199,7 +199,17 @@ func (r *Code) renderFile(path, content string, width int) (string, error) {
Language: lang,
}
s := strings.Builder{}
- err := formatter.Render(&s, r.renderContext)
+ rc := r.renderContext
+ if r.showLineNumber {
+ st := common.StyleConfig()
+ var m uint = 0
+ st.CodeBlock.Margin = &m
+ rc = gansi.NewRenderContext(gansi.Options{
+ ColorProfile: termenv.TrueColor,
+ Styles: st,
+ })
+ }
+ err := formatter.Render(&s, rc)
if err != nil {
return "", err
}
@@ -74,7 +74,7 @@ func (d LogItemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd {
}
var (
- highlight = lipgloss.NewStyle().Foreground(lipgloss.Color("#F1F1F1"))
+ faint = func(s string) string { return lipgloss.NewStyle().Faint(true).Render(s) }
)
// Render renders the item. Implements list.ItemDelegate.
@@ -113,17 +113,18 @@ func (d LogItemDelegate) Render(w io.Writer, m list.Model, index int, listItem l
hashStyle = hashStyle.Bold(true)
}
hash = hashStyle.Render(hash)
- author := highlight.Render(i.Author.Name)
- commiter := highlight.Render(i.Committer.Name)
+ author := i.Author.Name
+ commiter := i.Committer.Name
who := ""
if author != "" && commiter != "" {
- who = fmt.Sprintf("%s committed", commiter)
+ who = commiter + faint(" committed")
if author != commiter {
- who = fmt.Sprintf("%s authored and %s", author, who)
+ who = author + faint(" authored and ") + who
}
who += " "
}
date := fmt.Sprintf("on %s", i.Committer.When.Format("Feb 02"))
+ date = faint(date)
if i.Committer.When.Year() != time.Now().Year() {
date += fmt.Sprintf(" %d", i.Committer.When.Year())
}
@@ -43,7 +43,8 @@ func New(s session.Session, common common.Common) *Selection {
selector := selector.New(common,
[]selector.IdentifiableItem{},
ItemDelegate{&common, &sel.activeBox})
- selector.SetShowTitle(false)
+ selector.SetShowTitle(true)
+ selector.Title = "Repositories"
selector.SetShowHelp(false)
selector.SetShowStatusBar(false)
selector.DisableQuitKeybindings()
@@ -2,6 +2,7 @@ package ui
import (
"log"
+ "os"
"github.com/charmbracelet/bubbles/key"
tea "github.com/charmbracelet/bubbletea"
@@ -139,7 +140,9 @@ func (ui *UI) Init() tea.Cmd {
// Update implements tea.Model.
func (ui *UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
- log.Printf("msg: %T", msg)
+ if os.Getenv("DEBUG") == "true" {
+ log.Printf("ui msg: %T", msg)
+ }
cmds := make([]tea.Cmd, 0)
switch msg := msg.(type) {
case tea.WindowSizeMsg: