Introduce buffer::Content<'a> struct to share logic with buffer::Snapshot

We want to move a bunch of methods on FoldMap to fold_map::Snapshot. This captures a buffer snapshot, and we'll need a bunch of methods that currently are on Buffer to also be implemented on buffer::Snapshot. This Content reference struct will be a good zero-cost place to store that logic.
This commit is contained in:
Nathan Sobo
2021-07-15 09:50:50 -06:00
parent be954872d0
commit 09afba9251
2 changed files with 78 additions and 34 deletions
+2 -2
View File
@@ -1215,8 +1215,8 @@ impl Editor {
String::from_iter(clipboard_chars.by_ref().take(clipboard_selection.len));
self.buffer.update(cx, |buffer, cx| {
let selection_start = selection.start.to_point(buffer);
let selection_end = selection.end.to_point(buffer);
let selection_start = selection.start.to_point(&*buffer);
let selection_end = selection.end.to_point(&*buffer);
// If the corresponding selection was empty when this slice of the
// clipboard text was written, then the entire line containing the