Add support for activating a pane by direction
Contributes: zed-industries/community#476 Contributes: zed-industries/community#478
This commit is contained in:
parent
b13e86aba6
commit
e1379f0ef0
7 changed files with 157 additions and 5 deletions
|
@ -5,6 +5,7 @@ use crate::{
|
|||
use crate::{AutosaveSetting, DelayedDebouncedEditAction, WorkspaceSettings};
|
||||
use anyhow::Result;
|
||||
use client::{proto, Client};
|
||||
use gpui::geometry::vector::Vector2F;
|
||||
use gpui::{
|
||||
fonts::HighlightStyle, AnyElement, AnyViewHandle, AppContext, ModelHandle, Task, View,
|
||||
ViewContext, ViewHandle, WeakViewHandle, WindowContext,
|
||||
|
@ -203,6 +204,9 @@ pub trait Item: View {
|
|||
fn show_toolbar(&self) -> bool {
|
||||
true
|
||||
}
|
||||
fn pixel_position_of_cursor(&self) -> Option<Vector2F> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ItemHandle: 'static + fmt::Debug {
|
||||
|
@ -271,6 +275,7 @@ pub trait ItemHandle: 'static + fmt::Debug {
|
|||
fn breadcrumbs(&self, theme: &Theme, cx: &AppContext) -> Option<Vec<BreadcrumbText>>;
|
||||
fn serialized_item_kind(&self) -> Option<&'static str>;
|
||||
fn show_toolbar(&self, cx: &AppContext) -> bool;
|
||||
fn pixel_position_of_cursor(&self, cx: &AppContext) -> Option<Vector2F>;
|
||||
}
|
||||
|
||||
pub trait WeakItemHandle {
|
||||
|
@ -615,6 +620,10 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
fn show_toolbar(&self, cx: &AppContext) -> bool {
|
||||
self.read(cx).show_toolbar()
|
||||
}
|
||||
|
||||
fn pixel_position_of_cursor(&self, cx: &AppContext) -> Option<Vector2F> {
|
||||
self.read(cx).pixel_position_of_cursor()
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Box<dyn ItemHandle>> for AnyViewHandle {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue