WIP: Start on removing selections from buffer in favor of editor
This commit is contained in:
parent
f35c419f43
commit
8432daef6a
10 changed files with 342 additions and 951 deletions
|
@ -3559,7 +3559,6 @@ mod tests {
|
|||
#[gpui::test]
|
||||
async fn test_buffer_file_changes_on_disk(mut cx: gpui::TestAppContext) {
|
||||
use std::fs;
|
||||
use text::{Point, Selection, SelectionGoal};
|
||||
|
||||
let initial_contents = "aaa\nbbbbb\nc\n";
|
||||
let dir = temp_tree(json!({ "the-file": initial_contents }));
|
||||
|
@ -3588,22 +3587,23 @@ mod tests {
|
|||
.await
|
||||
.unwrap();
|
||||
|
||||
// TODO
|
||||
// Add a cursor on each row.
|
||||
let selection_set_id = buffer.update(&mut cx, |buffer, cx| {
|
||||
assert!(!buffer.is_dirty());
|
||||
buffer.add_selection_set(
|
||||
&(0..3)
|
||||
.map(|row| Selection {
|
||||
id: row as usize,
|
||||
start: Point::new(row, 1),
|
||||
end: Point::new(row, 1),
|
||||
reversed: false,
|
||||
goal: SelectionGoal::None,
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
cx,
|
||||
)
|
||||
});
|
||||
// let selection_set_id = buffer.update(&mut cx, |buffer, cx| {
|
||||
// assert!(!buffer.is_dirty());
|
||||
// buffer.add_selection_set(
|
||||
// &(0..3)
|
||||
// .map(|row| Selection {
|
||||
// id: row as usize,
|
||||
// start: Point::new(row, 1),
|
||||
// end: Point::new(row, 1),
|
||||
// reversed: false,
|
||||
// goal: SelectionGoal::None,
|
||||
// })
|
||||
// .collect::<Vec<_>>(),
|
||||
// cx,
|
||||
// )
|
||||
// });
|
||||
|
||||
// Change the file on disk, adding two new lines of text, and removing
|
||||
// one line.
|
||||
|
@ -3626,19 +3626,20 @@ mod tests {
|
|||
assert!(!buffer.is_dirty());
|
||||
assert!(!buffer.has_conflict());
|
||||
|
||||
let cursor_positions = buffer
|
||||
.selection_set(selection_set_id)
|
||||
.unwrap()
|
||||
.selections::<Point>(&*buffer)
|
||||
.map(|selection| {
|
||||
assert_eq!(selection.start, selection.end);
|
||||
selection.start
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(
|
||||
cursor_positions,
|
||||
[Point::new(1, 1), Point::new(3, 1), Point::new(4, 0)]
|
||||
);
|
||||
// TODO
|
||||
// let cursor_positions = buffer
|
||||
// .selection_set(selection_set_id)
|
||||
// .unwrap()
|
||||
// .selections::<Point>(&*buffer)
|
||||
// .map(|selection| {
|
||||
// assert_eq!(selection.start, selection.end);
|
||||
// selection.start
|
||||
// })
|
||||
// .collect::<Vec<_>>();
|
||||
// assert_eq!(
|
||||
// cursor_positions,
|
||||
// [Point::new(1, 1), Point::new(3, 1), Point::new(4, 0)]
|
||||
// );
|
||||
});
|
||||
|
||||
// Modify the buffer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue