mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-26 12:35:14 +03:00
improve performance on diffing giant files (#96)
This commit is contained in:
parent
ff6712246a
commit
732690da1d
@ -71,7 +71,7 @@ pub struct FileDiff {
|
||||
/// list of hunks
|
||||
pub hunks: Vec<Hunk>,
|
||||
/// lines total summed up over hunks
|
||||
pub lines: u16,
|
||||
pub lines: usize,
|
||||
}
|
||||
|
||||
pub(crate) fn get_diff_raw<'a>(
|
||||
@ -144,7 +144,7 @@ pub fn get_diff(
|
||||
header_hash: hash(header),
|
||||
lines: lines.clone(),
|
||||
});
|
||||
res.lines += lines.len() as u16;
|
||||
res.lines += lines.len();
|
||||
};
|
||||
|
||||
let mut put = |hunk: Option<DiffHunk>, line: git2::DiffLine| {
|
||||
|
@ -172,7 +172,7 @@ impl DiffComponent {
|
||||
|
||||
if Self::hunk_visible(hunk_min, hunk_max, min, max) {
|
||||
for (i, line) in hunk.lines.iter().enumerate() {
|
||||
if line_cursor >= min {
|
||||
if line_cursor >= min && line_cursor <= max {
|
||||
Self::add_line(
|
||||
&mut res,
|
||||
width,
|
||||
|
Loading…
Reference in New Issue
Block a user