Alternate files with ctrl-6 (#11367)
This is my stab at #7709 I realize the code is flawed. There's no test coverage, I'm using `clone()` and there are probably better ways to hook into the events. Also, I didn't know what context to use for the keybinding. But maybe with some pointers from someone who actually know what they're doing, I can get this shippable. Release Notes: - vim: Added ctrl-6 for [alternate-file](https://vimhelp.org/editing.txt.html#CTRL-%5E) to navigate back and forth between two buffers. https://github.com/zed-industries/zed/assets/261929/2d10494e-5668-4988-b7b4-417c922d6c61 --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
co-authored by
Conrad Irwin
parent
0d26beb91b
commit
80d3eafa30
@@ -330,6 +330,7 @@ pub trait ItemHandle: 'static + Send {
|
||||
fn serialized_item_kind(&self) -> Option<&'static str>;
|
||||
fn show_toolbar(&self, cx: &AppContext) -> bool;
|
||||
fn pixel_position_of_cursor(&self, cx: &AppContext) -> Option<Point<Pixels>>;
|
||||
fn downgrade_item(&self) -> Box<dyn WeakItemHandle>;
|
||||
}
|
||||
|
||||
pub trait WeakItemHandle: Send + Sync {
|
||||
@@ -702,6 +703,10 @@ impl<T: Item> ItemHandle for View<T> {
|
||||
fn pixel_position_of_cursor(&self, cx: &AppContext) -> Option<Point<Pixels>> {
|
||||
self.read(cx).pixel_position_of_cursor(cx)
|
||||
}
|
||||
|
||||
fn downgrade_item(&self) -> Box<dyn WeakItemHandle> {
|
||||
Box::new(self.downgrade())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Box<dyn ItemHandle>> for AnyView {
|
||||
|
||||
Reference in New Issue
Block a user