Experiment with a more general way of pushing editor navigation entries
This commit is contained in:
parent
0cae3e0ac0
commit
16b82d59f1
4 changed files with 66 additions and 2 deletions
|
@ -755,6 +755,14 @@ mod tests {
|
|||
(file3.clone(), DisplayPoint::new(0, 2))
|
||||
);
|
||||
|
||||
workspace
|
||||
.update(&mut cx, |w, cx| Pane::go_back(w, cx))
|
||||
.await;
|
||||
assert_eq!(
|
||||
active_location(&workspace, &mut cx),
|
||||
(file3.clone(), DisplayPoint::new(0, 0))
|
||||
);
|
||||
|
||||
workspace
|
||||
.update(&mut cx, |w, cx| Pane::go_back(w, cx))
|
||||
.await;
|
||||
|
@ -771,10 +779,26 @@ mod tests {
|
|||
(file1.clone(), DisplayPoint::new(0, 1))
|
||||
);
|
||||
|
||||
workspace
|
||||
.update(&mut cx, |w, cx| Pane::go_back(w, cx))
|
||||
.await;
|
||||
assert_eq!(
|
||||
active_location(&workspace, &mut cx),
|
||||
(file1.clone(), DisplayPoint::new(0, 0))
|
||||
);
|
||||
|
||||
// Go back one more time and ensure we don't navigate past the first item in the history.
|
||||
workspace
|
||||
.update(&mut cx, |w, cx| Pane::go_back(w, cx))
|
||||
.await;
|
||||
assert_eq!(
|
||||
active_location(&workspace, &mut cx),
|
||||
(file1.clone(), DisplayPoint::new(0, 0))
|
||||
);
|
||||
|
||||
workspace
|
||||
.update(&mut cx, |w, cx| Pane::go_forward(w, cx))
|
||||
.await;
|
||||
assert_eq!(
|
||||
active_location(&workspace, &mut cx),
|
||||
(file1.clone(), DisplayPoint::new(0, 1))
|
||||
|
@ -801,7 +825,7 @@ mod tests {
|
|||
.await;
|
||||
assert_eq!(
|
||||
active_location(&workspace, &mut cx),
|
||||
(file3.clone(), DisplayPoint::new(0, 2))
|
||||
(file3.clone(), DisplayPoint::new(0, 0))
|
||||
);
|
||||
|
||||
// Go back to an item that has been closed and removed from disk, ensuring it gets skipped.
|
||||
|
@ -822,6 +846,13 @@ mod tests {
|
|||
active_location(&workspace, &mut cx),
|
||||
(file1.clone(), DisplayPoint::new(0, 1))
|
||||
);
|
||||
workspace
|
||||
.update(&mut cx, |w, cx| Pane::go_forward(w, cx))
|
||||
.await;
|
||||
assert_eq!(
|
||||
active_location(&workspace, &mut cx),
|
||||
(file3.clone(), DisplayPoint::new(0, 0))
|
||||
);
|
||||
|
||||
fn active_location(
|
||||
workspace: &ViewHandle<Workspace>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue