Introduce a new fingerprint field to TextSummary
This is calculated in `Rope` and uses the `bromberg_sl2` homomorphic hash function to determine the fingerprint of a single chunk and compose each chunk fingerprint into a single fingerprint for the entire rope that is equivalent to hashing all the rope's bytes at once.
This commit is contained in:
@@ -370,22 +370,10 @@ impl FoldMap {
|
||||
|
||||
if fold.end > fold.start {
|
||||
let output_text = "…";
|
||||
let chars = output_text.chars().count() as u32;
|
||||
let lines = Point::new(0, output_text.len() as u32);
|
||||
let lines_utf16 =
|
||||
PointUtf16::new(0, output_text.encode_utf16().count() as u32);
|
||||
new_transforms.push(
|
||||
Transform {
|
||||
summary: TransformSummary {
|
||||
output: TextSummary {
|
||||
bytes: output_text.len(),
|
||||
lines,
|
||||
lines_utf16,
|
||||
first_line_chars: chars,
|
||||
last_line_chars: chars,
|
||||
longest_row: 0,
|
||||
longest_row_chars: chars,
|
||||
},
|
||||
output: TextSummary::from(output_text),
|
||||
input: new_buffer.text_summary_for_range(fold.start..fold.end),
|
||||
},
|
||||
output_text: Some(output_text),
|
||||
|
||||
@@ -1923,15 +1923,7 @@ impl MultiBufferSnapshot {
|
||||
);
|
||||
|
||||
if range.end > end_before_newline {
|
||||
summary.add_assign(&D::from_text_summary(&TextSummary {
|
||||
bytes: 1,
|
||||
lines: Point::new(1 as u32, 0),
|
||||
lines_utf16: PointUtf16::new(1 as u32, 0),
|
||||
first_line_chars: 0,
|
||||
last_line_chars: 0,
|
||||
longest_row: 0,
|
||||
longest_row_chars: 0,
|
||||
}));
|
||||
summary.add_assign(&D::from_text_summary(&TextSummary::from("\n")));
|
||||
}
|
||||
|
||||
cursor.next(&());
|
||||
|
||||
Reference in New Issue
Block a user