Experiment with a more general way of pushing editor navigation entries
This commit is contained in:
+32
-1
@@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user