Debian Codegraph @

testdata/consecutive-words.riff-output

raw
1 commit bbc4309d726819512f9b5fb72b187eeb63d34680
2 Author: Johan Walles <[email protected]>
3 Date: Thu Dec 31 15:22:09 2020 +0100
4
5 Skip highlighting based on newline counts
6
7 If old text and new text have very different line counts, just do the
8 simplistic highlighting.
9
10 diff --git xsrc/refiner.rs xsrc/refiner.rs
11 index d1ebdc1..40ae0df 100644
12 --- xsrc/refiner.rs
13 +++ xsrc/refiner.rs
14 @@ -15,8 +15,8 @@ use diffus::{
15 /// it.
16 const MAX_HIGHLIGHT_PERCENTAGE: usize = 30;
17
18 -const LARGE_BYTE_COUNT_CHANGE_PERCENT: usize = 100;
19 -const SMALL_BYTE_COUNT_CHANGE: usize = 10;
20 +const LARGE_COUNT_CHANGE_PERCENT: usize = 100;
21 +const SMALL_COUNT_CHANGE: usize = 10;
22
23 /// Format old and new lines in OLD and NEW colors.
24 ///
25 @@ -55,11 +55,14 @@ pub fn format(old_text: &str, new_text: &str) -> Vec<String> {
26 return simple_format(old_text, new_text);
27 }
28
29 - // This check makes us faster, please use the benchmark.py script before and
30 - // after if you change this.
31 + // These checks make us faster, please use the benchmark.py script before
32 + // and after if you change this.
33 if is_large_byte_count_change(old_text, new_text) {
34 return simple_format(old_text, new_text);
35 }
36 + if is_large_newline_count_change(old_text, new_text) {
37 + return simple_format(old_text, new_text);
38 + }
39
40 // Find diffs between adds and removals
41 let mut old_collector = TokenCollector::create(StyledToken::new("-".to_string(), Style::Old));