Debian Codegraph @

etc/examples/189-merge-conflict.2.diff

raw
1 diff --cc src/paint.rs
2 index 79b44db1,0f429d5c..00000000
3 --- a/src/paint.rs
4 +++ b/src/paint.rs
5 @@@ -387,30 -457,36 +387,88 @@@ impl<'p> Painter<'p> 
6 ) -> (Option<BgFillMethod>, Style) {
7 // style: for right fill if line contains no emph sections
8 // non_emph_style: for right fill if line contains emph sections
9 ++<<<<<<< HEAD
10  + let (style, non_emph_style) = match state {
11  + State::HunkMinus(None) | State::HunkMinusWrapped => {
12  + (config.minus_style, config.minus_non_emph_style)
13  + }
14  + State::HunkZero | State::HunkZeroWrapped => (config.zero_style, config.zero_style),
15  + State::HunkPlus(None) | State::HunkPlusWrapped => {
16  + (config.plus_style, config.plus_non_emph_style)
17  + }
18  + State::HunkMinus(Some(_)) | State::HunkPlus(Some(_)) => {
19  + let style = if !diff_sections.is_empty() {
20  + diff_sections[diff_sections.len() - 1].0
21 ++||||||| parent of 4d4b19ca (Always use non-emph style for right fill)
22 ++ let (style, non_emph_style) = match state {
23 ++ State::HunkMinus(None) | State::HunkMinusWrapped => {
24 ++ (config.minus_style, config.minus_non_emph_style)
25 ++ }
26 ++ State::HunkMinus(Some(raw_line)) => {
27 ++ // TODO: This is the second time we are parsing the ANSI sequences
28 ++ if let Some(ansi_term_style) = ansi::parse_first_style(raw_line) {
29 ++ let style = Style {
30 ++ ansi_term_style,
31 ++ ..Style::new()
32 ++ };
33 ++ (style, style)
34 ++ } else {
35 ++ (config.minus_style, config.minus_non_emph_style)
36 ++ }
37 ++ }
38 ++ State::HunkZero | State::HunkZeroWrapped => (config.zero_style, config.zero_style),
39 ++ State::HunkPlus(None) | State::HunkPlusWrapped => {
40 ++ (config.plus_style, config.plus_non_emph_style)
41 ++ }
42 ++ State::HunkPlus(Some(raw_line)) => {
43 ++ // TODO: This is the second time we are parsing the ANSI sequences
44 ++ if let Some(ansi_term_style) = ansi::parse_first_style(raw_line) {
45 ++ let style = Style {
46 ++ ansi_term_style,
47 ++ ..Style::new()
48 ++ };
49 ++ (style, style)
50 ++=======
51 + let non_emph_style = match state {
52 + State::HunkMinus(None) | State::HunkMinusWrapped => config.minus_non_emph_style,
53 + State::HunkMinus(Some(raw_line)) => {
54 + // TODO: This is the second time we are parsing the ANSI sequences
55 + if let Some(ansi_term_style) = ansi::parse_first_style(raw_line) {
56 + Style {
57 + ansi_term_style,
58 + ..Style::new()
59 + }
60 + } else {
61 + config.minus_non_emph_style
62 + }
63 + }
64 + State::HunkZero | State::HunkZeroWrapped => config.zero_style,
65 + State::HunkPlus(None) | State::HunkPlusWrapped => config.plus_non_emph_style,
66 + State::HunkPlus(Some(raw_line)) => {
67 + // TODO: This is the second time we are parsing the ANSI sequences
68 + if let Some(ansi_term_style) = ansi::parse_first_style(raw_line) {
69 + Style {
70 + ansi_term_style,
71 + ..Style::new()
72 + }
73 ++>>>>>>> 4d4b19ca (Always use non-emph style for right fill)
74 } else {
75 ++<<<<<<< HEAD
76  + config.null_style
77  + };
78  + (style, style)
79 ++||||||| parent of 4d4b19ca (Always use non-emph style for right fill)
80 ++ (config.plus_style, config.plus_non_emph_style)
81 ++ }
82 ++=======
83 + config.plus_non_emph_style
84 + }
85 ++>>>>>>> 4d4b19ca (Always use non-emph style for right fill)
86 }
87 - State::Blame(_, _) => (diff_sections[0].0, diff_sections[0].0),
88 - _ => (config.null_style, config.null_style),
89 - };
90 - let fill_style = if style_sections_contain_more_than_one_style(diff_sections) {
91 - non_emph_style // line contains an emph section
92 - } else {
93 - style
94 + State::Blame(_, _) => diff_sections[0].0,
95 + _ => config.null_style,
96 };
97 + let fill_style = non_emph_style;
98 
99 match (
100 fill_style.get_background_color().is_some(),