summaryrefslogtreecommitdiffstats
path: root/src/edits.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-11-18 20:52:58 -0500
committerDan Davison <dandavison7@gmail.com>2021-11-28 18:28:22 -0500
commit39ef747843d3f49078a5402577bde8e6ae235b67 (patch)
treebe90e3ee700fcdd4981b31c2bd37c57585d566aa /src/edits.rs
parent8a275c361743f1689c1a9118deab4a35ad975f86 (diff)
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.
Diffstat (limited to 'src/edits.rs')
-rw-r--r--src/edits.rs14
1 files changed, 10 insertions, 4 deletions
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>(