File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -212,8 +212,8 @@ fn color_multilines(color: Colour, s: &str) -> String {
212212
213213#[ derive( Debug ) ]
214214pub struct ContextConfig < ' a > {
215- context_size : usize ,
216- skipping_marker : & ' a str ,
215+ pub context_size : usize ,
216+ pub skipping_marker : & ' a str ,
217217}
218218
219219/// Container for line-by-line text diff result. Can be pretty-printed by Display trait.
@@ -495,10 +495,10 @@ impl<'a> LineChangeset<'a> {
495495
496496 let mut next_line = 1 ;
497497
498- let diff = self . diff ( ) ;
498+ let mut diff = self . diff ( ) . into_iter ( ) . peekable ( ) ;
499499 let mut out: Vec < String > = Vec :: with_capacity ( diff. len ( ) ) ;
500500 let mut at_beginning = true ;
501- for op in diff {
501+ while let Some ( op ) = diff. next ( ) {
502502 match op {
503503 basic:: DiffOp :: Equal ( a) => match context_config {
504504 None => out. push ( a. join ( "\n " ) ) ,
@@ -531,6 +531,9 @@ impl<'a> LineChangeset<'a> {
531531 out. push ( skipping_marker. to_string ( ) ) ;
532532 next_line += lower_bound
533533 }
534+ if diff. peek ( ) . is_none ( ) {
535+ continue ;
536+ }
534537 if let Some ( newlines) = self . format_equal (
535538 & lines[ lower_bound..] ,
536539 display_line_numbers,
You can’t perform that action at this time.
0 commit comments