Introduce AutoindentMode parameter to Buffer::edit
This controls whether or not we preserve the relative indentation of inserted text blocks. Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
This commit is contained in:
co-authored by
Mikayla Maki
parent
cdf6ae25bb
commit
fa5af4383d
@@ -1164,7 +1164,7 @@ mod tests {
|
||||
|
||||
// Insert a line break, separating two block decorations into separate lines.
|
||||
let buffer_snapshot = buffer.update(cx, |buffer, cx| {
|
||||
buffer.edit([(Point::new(1, 1)..Point::new(1, 1), "!!!\n")], cx);
|
||||
buffer.edit([(Point::new(1, 1)..Point::new(1, 1), "!!!\n")], None, cx);
|
||||
buffer.snapshot(cx)
|
||||
});
|
||||
|
||||
|
||||
@@ -1240,6 +1240,7 @@ mod tests {
|
||||
(Point::new(0, 0)..Point::new(0, 1), "123"),
|
||||
(Point::new(2, 3)..Point::new(2, 3), "123"),
|
||||
],
|
||||
None,
|
||||
cx,
|
||||
);
|
||||
buffer.snapshot(cx)
|
||||
@@ -1262,7 +1263,7 @@ mod tests {
|
||||
);
|
||||
|
||||
let buffer_snapshot = buffer.update(cx, |buffer, cx| {
|
||||
buffer.edit([(Point::new(2, 6)..Point::new(4, 3), "456")], cx);
|
||||
buffer.edit([(Point::new(2, 6)..Point::new(4, 3), "456")], None, cx);
|
||||
buffer.snapshot(cx)
|
||||
});
|
||||
let (snapshot4, _) = map.read(buffer_snapshot.clone(), subscription.consume().into_inner());
|
||||
@@ -1318,7 +1319,7 @@ mod tests {
|
||||
|
||||
// Edit within one of the folds.
|
||||
let buffer_snapshot = buffer.update(cx, |buffer, cx| {
|
||||
buffer.edit([(0..1, "12345")], cx);
|
||||
buffer.edit([(0..1, "12345")], None, cx);
|
||||
buffer.snapshot(cx)
|
||||
});
|
||||
let (snapshot, _) =
|
||||
@@ -1360,7 +1361,7 @@ mod tests {
|
||||
assert_eq!(snapshot.text(), "aa…cccc\nd…eeeee");
|
||||
|
||||
let buffer_snapshot = buffer.update(cx, |buffer, cx| {
|
||||
buffer.edit([(Point::new(2, 2)..Point::new(3, 1), "")], cx);
|
||||
buffer.edit([(Point::new(2, 2)..Point::new(3, 1), "")], None, cx);
|
||||
buffer.snapshot(cx)
|
||||
});
|
||||
let (snapshot, _) = map.read(buffer_snapshot.clone(), subscription.consume().into_inner());
|
||||
|
||||
Reference in New Issue
Block a user