Switch to using mouse navigation events instead of other in order to get rid of opaque button id

This commit is contained in:
Keith Simmons 2022-03-09 15:04:04 -08:00
parent fc36c706d3
commit 6ee0cceb14
7 changed files with 132 additions and 68 deletions

View file

@ -747,44 +747,58 @@ mod tests {
(file3.clone(), DisplayPoint::new(15, 0))
);
workspace.update(cx, |w, cx| Pane::go_back(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_back(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, cx),
(file3.clone(), DisplayPoint::new(0, 0))
);
workspace.update(cx, |w, cx| Pane::go_back(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_back(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, cx),
(file2.clone(), DisplayPoint::new(0, 0))
);
workspace.update(cx, |w, cx| Pane::go_back(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_back(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, cx),
(file1.clone(), DisplayPoint::new(10, 0))
);
workspace.update(cx, |w, cx| Pane::go_back(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_back(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, 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(cx, |w, cx| Pane::go_back(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_back(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, cx),
(file1.clone(), DisplayPoint::new(0, 0))
);
workspace.update(cx, |w, cx| Pane::go_forward(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_forward(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, cx),
(file1.clone(), DisplayPoint::new(10, 0))
);
workspace.update(cx, |w, cx| Pane::go_forward(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_forward(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, cx),
(file2.clone(), DisplayPoint::new(0, 0))
@ -798,7 +812,9 @@ mod tests {
.update(cx, |pane, cx| pane.close_item(editor3.id(), cx));
drop(editor3);
});
workspace.update(cx, |w, cx| Pane::go_forward(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_forward(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, cx),
(file3.clone(), DisplayPoint::new(0, 0))
@ -818,12 +834,16 @@ mod tests {
})
.await
.unwrap();
workspace.update(cx, |w, cx| Pane::go_back(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_back(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, cx),
(file1.clone(), DisplayPoint::new(10, 0))
);
workspace.update(cx, |w, cx| Pane::go_forward(w, None, cx)).await;
workspace
.update(cx, |w, cx| Pane::go_forward(w, None, cx))
.await;
assert_eq!(
active_location(&workspace, cx),
(file3.clone(), DisplayPoint::new(0, 0))