Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions pkg/cheatsheet/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,21 @@ func getHeader(binding *types.Binding, tr *i18n.TranslationSet) header {
}

func formatSections(tr *i18n.TranslationSet, bindingSections []*bindingSection) string {
content := fmt.Sprintf("# Lazygit %s\n", tr.Keybindings)
var content strings.Builder
content.WriteString(fmt.Sprintf("# Lazygit %s\n", tr.Keybindings))

content += fmt.Sprintf("\n%s\n", italicize(tr.KeybindingsLegend))
content.WriteString(fmt.Sprintf("\n%s\n", italicize(tr.KeybindingsLegend)))

for _, section := range bindingSections {
content += formatTitle(section.title)
content += "| Key | Action | Info |\n"
content += "|-----|--------|-------------|\n"
content.WriteString(formatTitle(section.title))
content.WriteString("| Key | Action | Info |\n")
content.WriteString("|-----|--------|-------------|\n")
for _, binding := range section.bindings {
content += formatBinding(binding)
content.WriteString(formatBinding(binding))
}
}

return content
return content.String()
}

func formatTitle(title string) string {
Expand Down
8 changes: 4 additions & 4 deletions pkg/commands/patch/patch_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,22 @@ func (p *PatchBuilder) Start(from, to string, reverse bool, canRebase bool) {
}

func (p *PatchBuilder) PatchToApply(reverse bool, turnAddedFilesIntoDiffAgainstEmptyFile bool) string {
patch := ""
var patch strings.Builder

for filename, info := range p.fileInfoMap {
if info.mode == UNSELECTED {
continue
}

patch += p.RenderPatchForFile(RenderPatchForFileOpts{
patch.WriteString(p.RenderPatchForFile(RenderPatchForFileOpts{
Filename: filename,
Plain: true,
Reverse: reverse,
TurnAddedFilesIntoDiffAgainstEmptyFile: turnAddedFilesIntoDiffAgainstEmptyFile,
})
}))
}

return patch
return patch.String()
}

func (p *PatchBuilder) addFileWhole(info *fileInfo) {
Expand Down
8 changes: 5 additions & 3 deletions pkg/gui/presentation/submodules.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package presentation

import (
"strings"

"github.com/jesseduffield/lazygit/pkg/commands/models"
"github.com/jesseduffield/lazygit/pkg/theme"
"github.com/samber/lo"
Expand All @@ -15,11 +17,11 @@ func GetSubmoduleListDisplayStrings(submodules []*models.SubmoduleConfig) [][]st
func getSubmoduleDisplayStrings(s *models.SubmoduleConfig) []string {
name := s.Name
if s.ParentModule != nil {
indentation := ""
count := 0
for p := s.ParentModule; p != nil; p = p.ParentModule {
indentation += " "
count++
}

indentation := strings.Repeat(" ", count)
name = indentation + "- " + s.Name
}

Expand Down