Re-enable wrap_map module and fix compile errors

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-07-19 18:40:57 +02:00
co-authored by Nathan Sobo
parent 359132ac19
commit 631a6a2f45
4 changed files with 249 additions and 150 deletions
+7 -5
View File
@@ -483,14 +483,14 @@ impl Snapshot {
summary
}
pub fn len(&self) -> usize {
self.transforms.summary().output.bytes
pub fn len(&self) -> OutputOffset {
OutputOffset(self.transforms.summary().output.bytes)
}
pub fn line_len(&self, row: u32) -> u32 {
let line_start = self.to_output_offset(OutputPoint::new(row, 0)).0;
let line_end = if row >= self.max_point().row() {
self.len()
self.len().0
} else {
self.to_output_offset(OutputPoint::new(row + 1, 0)).0 - 1
};
@@ -1442,8 +1442,10 @@ mod tests {
}
for _ in 0..5 {
let offset = snapshot
.clip_offset(OutputOffset(rng.gen_range(0..=snapshot.len())), Bias::Right);
let offset = snapshot.clip_offset(
OutputOffset(rng.gen_range(0..=snapshot.len().0)),
Bias::Right,
);
assert_eq!(
snapshot.chunks_at(offset).collect::<String>(),
&expected_text[offset.0..],