From 39ef747843d3f49078a5402577bde8e6ae235b67 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 18 Nov 2021 20:52:58 -0500 Subject: Change rules for non-emph style Fixes #776 Previously, when a paired plus line had no edits, it received plus-style. With this commit such a line receives plus-non-emph-style. There's no change to unpaired lines (still plus-style) and paired lines with edits (still a mosaic of plus-non-emph-style and plus-emph-style). (The above statements hold for minus lines also). Since *-non-emph-style defaults to *-emph-style, this commit does not result in any change in output for users using the defaults. --- src/edits.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/edits.rs') diff --git a/src/edits.rs b/src/edits.rs index 11979aa8..bd90787d 100644 --- a/src/edits.rs +++ b/src/edits.rs @@ -8,10 +8,16 @@ use crate::align; /// Infer the edit operations responsible for the differences between a collection of old and new /// lines. A "line" is a string. An annotated line is a Vec of (op, &str) pairs, where the &str /// slices are slices of the line, and their concatenation equals the line. Return the input minus -/// and plus lines, in annotated form. Also return a specification of the inferred alignment of -/// minus and plus lines. `noop_deletions[i]` is the appropriate deletion operation tag to be used -/// for `minus_lines[i]`; `noop_deletions` is guaranteed to be the same length as `minus_lines`. -/// The equivalent statements hold for `plus_insertions` and `plus_lines`. +/// and plus lines, in annotated form. +/// +/// Also return a specification of the inferred alignment of minus and plus lines: a paired minus +/// and plus line is represented in this alignment specification as +/// (Some(minus_line_index),Some(plus_line_index)), whereas an unpaired minus line is +/// (Some(minus_line_index), None). +/// +/// `noop_deletions[i]` is the appropriate deletion operation tag to be used for `minus_lines[i]`; +/// `noop_deletions` is guaranteed to be the same length as `minus_lines`. The equivalent statements +/// hold for `plus_insertions` and `plus_lines`. #[allow(clippy::too_many_arguments)] #[allow(clippy::type_complexity)] pub fn infer_edits<'a, EditOperation>( -- cgit v1.2.3