From 93d845cb015696863033ee3adf1b813b525698d0 Mon Sep 17 00:00:00 2001 From: stk Date: Wed, 25 Jan 2023 17:25:53 +0100 Subject: [PATCH 1/2] Cleanup: remove unused function RenderPlain --- pkg/commands/patch/patch_parser.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/commands/patch/patch_parser.go b/pkg/commands/patch/patch_parser.go index 90b2ea13e..b57242c67 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 { From fc38e3b54d2327feee6ef30a78463238eb7554a4 Mon Sep 17 00:00:00 2001 From: stk Date: Wed, 25 Jan 2023 21:36:43 +0100 Subject: [PATCH 2/2] Don't omit final line feed when copying diff lines to clipboard --- pkg/commands/patch/patch_parser.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/commands/patch/patch_parser.go b/pkg/commands/patch/patch_parser.go index b57242c67..1fd3c107a 100644 --- a/pkg/commands/patch/patch_parser.go +++ b/pkg/commands/patch/patch_parser.go @@ -210,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