mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-21 22:43:27 +02:00
strip whitespace when there is nothing else
This commit is contained in:
parent
861bcc38be
commit
db8c398fa3
@ -2,7 +2,6 @@ package commands
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -145,7 +144,13 @@ func (p *PatchManager) RenderEachFilePatch(plain bool) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *PatchManager) RenderAggregatedPatchColored(plain bool) string {
|
func (p *PatchManager) RenderAggregatedPatchColored(plain bool) string {
|
||||||
return strings.Join(p.RenderEachFilePatch(plain), "\n")
|
result := ""
|
||||||
|
for _, patch := range p.RenderEachFilePatch(plain) {
|
||||||
|
if patch != "" {
|
||||||
|
result += patch + "\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PatchManager) GetFileStatus(filename string) int {
|
func (p *PatchManager) GetFileStatus(filename string) int {
|
||||||
|
@ -194,7 +194,11 @@ func (p *PatchParser) Render(firstLineIndex int, lastLineIndex int, incLineIndic
|
|||||||
included := utils.IncludesInt(incLineIndices, index)
|
included := utils.IncludesInt(incLineIndices, index)
|
||||||
renderedLines[index] = patchLine.render(selected, included)
|
renderedLines[index] = patchLine.render(selected, included)
|
||||||
}
|
}
|
||||||
return strings.Join(renderedLines, "\n")
|
result := strings.Join(renderedLines, "\n")
|
||||||
|
if strings.TrimSpace(utils.Decolorise(result)) == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetNextStageableLineIndex takes a line index and returns the line index of the next stageable line
|
// GetNextStageableLineIndex takes a line index and returns the line index of the next stageable line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user