fix(parser/diff): try n-1
This commit is contained in:
parent
787aa0e0e8
commit
c3ba14d321
|
@ -85,7 +85,7 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
|
||||||
}
|
}
|
||||||
answerLines := strings.Split(answerStr, "\n")
|
answerLines := strings.Split(answerStr, "\n")
|
||||||
resultLines := strings.Split(resultStr, "\n")
|
resultLines := strings.Split(resultStr, "\n")
|
||||||
commonPreixLineCount := 0
|
commonPrefixLineCount := 0
|
||||||
if output.HideCommonPrefix {
|
if output.HideCommonPrefix {
|
||||||
n := 0
|
n := 0
|
||||||
for ; n < len(answerLines) &&
|
for ; n < len(answerLines) &&
|
||||||
|
@ -97,9 +97,9 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
|
||||||
); n += 1 {
|
); n += 1 {
|
||||||
}
|
}
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
answerLines = answerLines[n:]
|
answerLines = answerLines[n-1:]
|
||||||
resultLines = resultLines[n:]
|
resultLines = resultLines[n-1:]
|
||||||
commonPreixLineCount = n
|
commonPrefixLineCount = n
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(answerLines) > output.MaxDiffLines {
|
if len(answerLines) > output.MaxDiffLines {
|
||||||
|
@ -121,10 +121,10 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
|
||||||
if truncated {
|
if truncated {
|
||||||
diffOutput += "\n\n(truncated)"
|
diffOutput += "\n\n(truncated)"
|
||||||
}
|
}
|
||||||
if commonPreixLineCount > 0 {
|
if commonPrefixLineCount > 0 {
|
||||||
diffOutput = fmt.Sprintf(
|
diffOutput = fmt.Sprintf(
|
||||||
"(%d line(s) of common prefix hidden)\n\n",
|
"(%d line(s) of common prefix hidden)\n\n",
|
||||||
commonPreixLineCount,
|
commonPrefixLineCount,
|
||||||
) + diffOutput
|
) + diffOutput
|
||||||
}
|
}
|
||||||
comment += fmt.Sprintf(
|
comment += fmt.Sprintf(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user