mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
improve performance on diffing giant files (#96)
This commit is contained in:
parent
ff6712246a
commit
732690da1d
2 changed files with 3 additions and 3 deletions
|
|
@ -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 a new issue