summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-01-29 14:19:29 +1100
committerGitHub <noreply@github.com>2023-01-29 14:19:29 +1100
commitd8c7d47067ff53ec37563805e1a16f1c5d4b99c5 (patch)
treeddf0aff00d96847e131ff76a7a03c2351bb375ad /pkg/commands
parentf79a8c281f3f0ac500e3f29255cf94e0efbe3b3f (diff)
parentfc38e3b54d2327feee6ef30a78463238eb7554a4 (diff)
Merge pull request #2395 from stefanhaller/trailing-lf-when-copying-diff-lines
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/patch/patch_parser.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/pkg/commands/patch/patch_parser.go b/pkg/commands/patch/patch_parser.go
index 90b2ea13e..1fd3c107a 100644
--- a/pkg/commands/patch/patch_parser.go
+++ b/pkg/commands/patch/patch_parser.go
@@ -202,10 +202,6 @@ func (p *PatchParser) Render(isFocused bool, firstLineIndex int, lastLineIndex i
return result
}
-func (p *PatchParser) RenderPlain() string {
- return renderLinesPlain(p.PatchLines)
-}
-
// RenderLinesPlain returns the non-coloured string of diff part from firstLineIndex to
// lastLineIndex
func (p *PatchParser) RenderLinesPlain(firstLineIndex, lastLineIndex int) string {
@@ -214,10 +210,10 @@ func (p *PatchParser) RenderLinesPlain(firstLineIndex, lastLineIndex int) string
func renderLinesPlain(lines []*PatchLine) string {
renderedLines := slices.Map(lines, func(line *PatchLine) string {
- return line.Content
+ return line.Content + "\n"
})
- return strings.Join(renderedLines, "\n")
+ return strings.Join(renderedLines, "")
}
// GetNextStageableLineIndex takes a line index and returns the line index of the next stageable line