mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Only honor rightward bias for buffer points *inside* of folds
(Not at boundaries) Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
a6a8f4fd81
commit
38d4662a4e
@ -81,9 +81,10 @@ impl Point {
|
||||
let mut cursor = snapshot.transforms.cursor::<Point, FoldPoint>();
|
||||
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!(
|
||||
|
Loading…
Reference in New Issue
Block a user