diff --git a/zed/src/editor/display_map/fold_map.rs b/zed/src/editor/display_map/fold_map.rs index cb5ea4ebbbb39e649f3700cb4bc047c0e1a32544..bdc5523150fecd7920d03403d38326f250b5127a 100644 --- a/zed/src/editor/display_map/fold_map.rs +++ b/zed/src/editor/display_map/fold_map.rs @@ -81,9 +81,10 @@ impl Point { let mut cursor = snapshot.transforms.cursor::(); cursor.seek(self, Bias::Right, &()); if cursor.item().map_or(false, |t| t.is_fold()) { - match bias { - Bias::Left => *cursor.sum_start(), - Bias::Right => cursor.sum_end(&()), + if bias == Bias::Left || *self == *cursor.seek_start() { + *cursor.sum_start() + } else { + cursor.sum_end(&()) } } else { let overshoot = *self - cursor.seek_start(); @@ -1379,7 +1380,7 @@ mod tests { assert_eq!( buffer_point.to_fold_point(&snapshot, Right), fold_point, - "buffer_Point.to_fold_point({:?})", + "{:?} -> fold point", buffer_point, ); assert_eq!(