1
0
forked from JOJ/JOJ3

feat(parser/diff): default max diff length 2048

This commit is contained in:
张泊明518370910136 2024-11-04 09:00:04 -05:00
parent e5ae6fc223
commit 0b841dd730
Signed by untrusted user: 张泊明518370910136
GPG Key ID: D47306D7062CDA9D

View File

@ -30,7 +30,7 @@ type Conf struct {
CompareSpace bool
AlwaysHide bool
ForceQuitOnDiff bool
MaxDiffLength int
MaxDiffLength int `default:"2048"` // just for reference
}
}
}
@ -83,7 +83,9 @@ func (*Diff) Run(results []stage.ExecutorResult, confAny any) (
// Generate Myers diff
diffOps := myersDiff(stdoutLines, resultLines)
if output.MaxDiffLength == 0 { // real default value
output.MaxDiffLength = 2048
}
// Generate diff block with surrounding context
diffOutput := generateDiffWithContext(
stdoutLines, resultLines, diffOps, output.MaxDiffLength)