1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

copy selected text to clipboard

This commit is contained in:
Hrishikesh Hiraskar
2021-10-02 13:20:26 +05:30
committed by Jesse Duffield
parent 3621084096
commit b6454755ca
5 changed files with 48 additions and 0 deletions

View File

@ -194,6 +194,22 @@ func (p *PatchParser) Render(firstLineIndex int, lastLineIndex int, incLineIndic
return result
}
// RenderLines returns the coloured string of diff part from firstLineIndex to
// lastLineIndex
func (p *PatchParser) RenderLines(firstLineIndex, lastLineIndex int) string {
renderedLines := make([]string, lastLineIndex-firstLineIndex+1)
for index := firstLineIndex; index <= lastLineIndex; index++ {
renderedLines[index-firstLineIndex] = p.PatchLines[index].render(
false, false,
)
}
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
// note this will actually include the current index if it is stageable
func (p *PatchParser) GetNextStageableLineIndex(currentIndex int) int {