Skip to content

Commit 732690d

Browse files
author
Stephan Dilly
committed
improve performance on diffing giant files (#96)
1 parent ff67122 commit 732690d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

asyncgit/src/sync/diff.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub struct FileDiff {
7171
/// list of hunks
7272
pub hunks: Vec<Hunk>,
7373
/// lines total summed up over hunks
74-
pub lines: u16,
74+
pub lines: usize,
7575
}
7676

7777
pub(crate) fn get_diff_raw<'a>(
@@ -144,7 +144,7 @@ pub fn get_diff(
144144
header_hash: hash(header),
145145
lines: lines.clone(),
146146
});
147-
res.lines += lines.len() as u16;
147+
res.lines += lines.len();
148148
};
149149

150150
let mut put = |hunk: Option<DiffHunk>, line: git2::DiffLine| {

src/components/diff.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl DiffComponent {
172172

173173
if Self::hunk_visible(hunk_min, hunk_max, min, max) {
174174
for (i, line) in hunk.lines.iter().enumerate() {
175-
if line_cursor >= min {
175+
if line_cursor >= min && line_cursor <= max {
176176
Self::add_line(
177177
&mut res,
178178
width,

0 commit comments

Comments
 (0)