From b80887dabe64df5f2d2f71eb74a4b502802679e5 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 18 Nov 2021 10:49:08 +0100 Subject: [PATCH] Don't insert blocks within multi-byte characters in randomized test --- crates/editor/src/display_map/block_map.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index ef7e262136..26aa2e193b 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -1146,7 +1146,9 @@ mod tests { let block_properties = (0..block_count) .map(|_| { let buffer = buffer.read(cx); - let position = buffer.anchor_before(rng.gen_range(0..=buffer.len())); + let position = buffer.anchor_before( + buffer.clip_offset(rng.gen_range(0..=buffer.len()), Bias::Left), + ); let len = rng.gen_range(0..10); let mut text = Rope::from(