Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions sample_files/compare.expected
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ sample_files/elixir_1.ex sample_files/elixir_2.ex
5ab1a845f7cb3ca6db1fdef7bc4a042f -

sample_files/elm_1.elm sample_files/elm_2.elm
8a67269f2dd2e4913f885b3b6e6d6a07 -
384f1695fb6c512c9510e9eae47b82fc -

sample_files/elvish_1.elv sample_files/elvish_2.elv
93af1d46752d57db84011ca7482ae842 -
Expand All @@ -80,7 +80,7 @@ sample_files/erlang_1.erl sample_files/erlang_2.erl
77c259baf4751716db4da1503088e742 -

sample_files/f_sharp_1.fs sample_files/f_sharp_2.fs
63defe290bfc6754b51457a6c374838b -
eb2a87f6e7d0cd4a545c3a6860eee448 -

sample_files/fortran_1.f90 sample_files/fortran_2.f90
b5fae2c0a3e0755ca8182df1f728400b -
Expand Down Expand Up @@ -119,7 +119,16 @@ sample_files/identical_1.scala sample_files/identical_2.scala
15c5a789e644348cb7e0de051ff4b63e -

sample_files/if_1.py sample_files/if_2.py
afcc7b60dd5c267ae183a496e0af511b -
224c74aaee642194766600a680cd48a0 -

sample_files/if_multiline_1.py sample_files/if_multiline_2.py
f135f2c5b6b7a12668c8859e888d19b6 -

sample_files/if_nested_1.py sample_files/if_nested_2.py
37bc29631193efba13845783688f9c7f -

sample_files/indented_string_1.py sample_files/indented_string_2.py
044539323b209aa31042ebee5de034d8 -

sample_files/insert_blank_1.txt sample_files/insert_blank_2.txt
a5fd75afcc99aa7b2b285f1f9ced8607 -
Expand Down Expand Up @@ -326,7 +335,7 @@ sample_files/xml_1.xml sample_files/xml_2.xml
38600945878fdea4b06c5da026e1fb78 -

sample_files/yaml_1.yaml sample_files/yaml_2.yaml
3a4a35bf75297de64796eafb1feb4f97 -
77efbb4ab9adfec62f8d5187f3ca2737 -

sample_files/zig_1.zig sample_files/zig_2.zig
ee5a604e604d310066deeff30e28f9d7 -
Expand Down
3 changes: 3 additions & 0 deletions sample_files/if_multiline_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if x:
foo
bar
2 changes: 2 additions & 0 deletions sample_files/if_multiline_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
foo
bar
4 changes: 4 additions & 0 deletions sample_files/if_nested_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if a:
foo
if b:
bar
4 changes: 4 additions & 0 deletions sample_files/if_nested_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if a:
foo
if b:
bar
5 changes: 5 additions & 0 deletions sample_files/indented_string_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
t = (
"Hello"
" "
"World"
)
5 changes: 5 additions & 0 deletions sample_files/indented_string_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
t = (
"Hello"
" "
"World"
)
2 changes: 1 addition & 1 deletion src/display/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl Highlight {
AtomKind::Keyword => Self::Keyword,
AtomKind::Comment => Self::Comment,
AtomKind::Type => Self::Type,
AtomKind::Normal => Self::Normal,
AtomKind::Normal | AtomKind::Indent => Self::Normal,
AtomKind::CanIgnore => Self::Normal,
AtomKind::TreeSitterError => Self::TreeSitterError,
},
Expand Down
22 changes: 11 additions & 11 deletions src/display/side_by_side.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
use std::cmp::{max, min};

use line_numbers::{LineNumber, SingleLineSpan};
use owo_colors::{OwoColorize, Style};
use owo_colors::OwoColorize;

use crate::constants::Side;
use crate::display::context::all_matched_lines_filled;
use crate::display::hunks::{matched_lines_indexes_for_hunk, Hunk};
use crate::display::style::{
self, apply_colors, apply_line_number_color, color_positions, novel_style, replace_tabs,
split_and_apply, width_respecting_tabs, BackgroundColor,
split_and_apply, width_respecting_tabs, BackgroundColor, DftStyle,
};
use crate::hash::{DftHashMap, DftHashSet};
use crate::lines::{format_line_num, split_on_newlines};
Expand Down Expand Up @@ -46,7 +46,7 @@ fn format_missing_line_num(
Side::Right => prev_num >= source_dims.rhs_max_line_in_file,
};

let mut style = Style::new();
let mut style = DftStyle::new();
if use_color {
style = style.dimmed();
}
Expand All @@ -70,7 +70,7 @@ fn format_missing_line_num(
c.repeat(num_digits),
width = column_width - 1
)
.style(style)
.style(style.into_owo_style())
.to_string()
}

Expand Down Expand Up @@ -99,16 +99,16 @@ fn display_single_column(
header_line.push('\n');
formatted_lines.push(header_line);

let mut style = Style::new();
let mut style = DftStyle::new();
if display_options.use_color {
style = novel_style(Style::new(), side, display_options.background_color);
style = novel_style(DftStyle::new(), side, display_options.background_color);
}

for (i, line) in src_lines.iter().enumerate() {
let mut formatted_line = String::with_capacity(line.len());
formatted_line.push_str(
&format_line_num_padded((i as u32).into(), column_width)
.style(style)
.style(style.into_owo_style())
.to_string(),
);
formatted_line.push_str(line);
Expand Down Expand Up @@ -281,8 +281,8 @@ fn highlight_positions(
lhs_mps: &[MatchedPos],
rhs_mps: &[MatchedPos],
) -> (
DftHashMap<LineNumber, Vec<(SingleLineSpan, Style)>>,
DftHashMap<LineNumber, Vec<(SingleLineSpan, Style)>>,
DftHashMap<LineNumber, Vec<(SingleLineSpan, DftStyle)>>,
DftHashMap<LineNumber, Vec<(SingleLineSpan, DftStyle)>>,
) {
let lhs_positions = color_positions(
Side::Left,
Expand All @@ -292,7 +292,7 @@ fn highlight_positions(
lhs_mps,
);
// Preallocate the hashmap assuming the average line will have 2 items on it.
let mut lhs_styles: DftHashMap<LineNumber, Vec<(SingleLineSpan, Style)>> =
let mut lhs_styles: DftHashMap<LineNumber, Vec<(SingleLineSpan, DftStyle)>> =
DftHashMap::default();
for (span, style) in lhs_positions {
let styles = lhs_styles.entry(span.line).or_insert_with(Vec::new);
Expand All @@ -306,7 +306,7 @@ fn highlight_positions(
file_format,
rhs_mps,
);
let mut rhs_styles: DftHashMap<LineNumber, Vec<(SingleLineSpan, Style)>> =
let mut rhs_styles: DftHashMap<LineNumber, Vec<(SingleLineSpan, DftStyle)>> =
DftHashMap::default();
for (span, style) in rhs_positions {
let styles = rhs_styles.entry(span.line).or_insert_with(Vec::new);
Expand Down
Loading
Loading