Synchronize FoldMap with buffer's contents lazily

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-05-04 18:27:56 +02:00
co-authored by Nathan Sobo
parent c135c84ef0
commit 05ab1bdddf
5 changed files with 574 additions and 458 deletions
+2 -2
View File
@@ -96,7 +96,7 @@ pub fn prev_word_boundary(
let mut boundary = DisplayPoint::new(point.row(), 0);
let mut column = 0;
let mut prev_c = None;
for c in map.chars_at(boundary, app)? {
for c in map.snapshot(app).chars_at(boundary, app)? {
if column >= point.column() {
break;
}
@@ -118,7 +118,7 @@ pub fn next_word_boundary(
app: &AppContext,
) -> Result<DisplayPoint> {
let mut prev_c = None;
for c in map.chars_at(point, app)? {
for c in map.snapshot(app).chars_at(point, app)? {
if prev_c.is_some() && (c == '\n' || char_kind(prev_c.unwrap()) != char_kind(c)) {
break;
}