Skip to content

Commit

Permalink
Fix handling of custom output separator for multiline matches. See #51
Browse files Browse the repository at this point in the history
  • Loading branch information
svent committed Jan 4, 2016
1 parent a29f6c8 commit 3fd32f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions output.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ func printMatch(match Match, lastMatch Match, target string, lastPrintedLine *in
// first line of multiline match with partial highlighting
printFilename(target, ":")
printLineno(match.lineno, ":")
writeOutput("%s%s%s%s%s", firstLine[0:firstLineOffset], global.termHighlightMatch,
firstLine[firstLineOffset:len(firstLine)], global.termHighlightReset, options.OutputSeparator)
writeOutput("%s%s%s%s\n", firstLine[0:firstLineOffset], global.termHighlightMatch,
firstLine[firstLineOffset:len(firstLine)], global.termHighlightReset)

// lines 2 upto n-1 of multiline match with full highlighting
for i := 1; i < len(lines)-1; i++ {
line := lines[i]
printFilename(target, ":")
printLineno(match.lineno+int64(i), ":")
writeOutput("%s%s%s%s", global.termHighlightMatch, line, global.termHighlightReset, options.OutputSeparator)
writeOutput("%s%s%s\n", global.termHighlightMatch, line, global.termHighlightReset)
}

// last line of multiline match with partial highlighting
Expand Down

0 comments on commit 3fd32f6

Please sign in to comment.