diff --git a/ui/components/code/code.go b/ui/components/code/code.go index bbdfe5db15e5da719170e9614bb7d01e19c0f091..6cda3cd1b60affdb46eea9cca5edfe060c790a4c 100644 --- a/ui/components/code/code.go +++ b/ui/components/code/code.go @@ -139,6 +139,8 @@ func (r *Code) ScrollPercent() float64 { func styleConfig() gansi.StyleConfig { noColor := "" s := glamour.DarkStyleConfig + // This fixes an issue with the default style config. For example + // highlighting empty spaces with red in Dockerfile type. s.Document.StylePrimitive.Color = &noColor s.CodeBlock.Chroma.Text.Color = &noColor s.CodeBlock.Chroma.Name.Color = &noColor diff --git a/ui/pages/repo/repo.go b/ui/pages/repo/repo.go index c2c37c6ef050f803a6ca6fc6fdc155d5099c2e3e..a27499508d589a018b1434aba42a48026e3f188f 100644 --- a/ui/pages/repo/repo.go +++ b/ui/pages/repo/repo.go @@ -146,7 +146,12 @@ func (r *Repo) FullHelp() [][]key.Binding { // Init implements tea.View. func (r *Repo) Init() tea.Cmd { - return nil + cmds := make([]tea.Cmd, 0) + cmds = append(cmds, + r.tabs.Init(), + r.statusbar.Init(), + ) + return tea.Batch(cmds...) } // Update implements tea.Model. diff --git a/ui/ui.go b/ui/ui.go index ccf61d64449b3ead3142b4f3bfdaa10a47ddaa40..2f408f95571f4253456a24c3e3ff11cafd60abce 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -118,11 +118,24 @@ func (ui *UI) Init() tea.Cmd { ui.pages[selectionPage] = selection.New(ui.s, ui.common) ui.pages[repoPage] = repo.New(ui.common, &source{cfg.Source}) ui.SetSize(ui.common.Width, ui.common.Height) - ui.state = loadedState - return tea.Batch( + cmd := tea.Batch( ui.pages[selectionPage].Init(), ui.pages[repoPage].Init(), ) + var msg tea.Msg + if cmd != nil { + msg = cmd() + switch msg := msg.(type) { + case common.ErrorMsg: + ui.state = errorState + return common.ErrorCmd(msg) + } + } + ui.state = loadedState + if msg != nil { + return func() tea.Msg { return msg } + } + return nil } // Update implements tea.Model.