Fix right click handler for tabs (#4130)
Also, some fun test helpers Co-Authored-By: Mikayla <mikayla@zed.dev> You can now use .debug_selector() to make it possible for tests to find a given element, and .debug_bounds() to find the coordinates of where it was painted. Release Notes: - (Added|Fixed|Improved) ... ([#<public_issue_number_if_exists>](https://github.com/zed-industries/community/issues/<public_issue_number_if_exists>)).
This commit is contained in:
commit
81baefb460
9 changed files with 116 additions and 11 deletions
|
@ -30,7 +30,7 @@ use std::{
|
|||
borrow::{Borrow, BorrowMut, Cow},
|
||||
cell::RefCell,
|
||||
collections::hash_map::Entry,
|
||||
fmt::Debug,
|
||||
fmt::{Debug, Display},
|
||||
future::Future,
|
||||
hash::{Hash, Hasher},
|
||||
marker::PhantomData,
|
||||
|
@ -318,6 +318,9 @@ pub(crate) struct Frame {
|
|||
requested_cursor_style: Option<CursorStyle>,
|
||||
pub(crate) view_stack: Vec<EntityId>,
|
||||
pub(crate) reused_views: FxHashSet<EntityId>,
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub(crate) debug_bounds: collections::FxHashMap<String, Bounds<Pixels>>,
|
||||
}
|
||||
|
||||
impl Frame {
|
||||
|
@ -341,6 +344,9 @@ impl Frame {
|
|||
requested_cursor_style: None,
|
||||
view_stack: Vec::new(),
|
||||
reused_views: FxHashSet::default(),
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
debug_bounds: FxHashMap::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3380,6 +3386,20 @@ pub enum ElementId {
|
|||
NamedInteger(SharedString, usize),
|
||||
}
|
||||
|
||||
impl Display for ElementId {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
ElementId::View(entity_id) => write!(f, "view-{}", entity_id)?,
|
||||
ElementId::Integer(ix) => write!(f, "{}", ix)?,
|
||||
ElementId::Name(name) => write!(f, "{}", name)?,
|
||||
ElementId::FocusHandle(__) => write!(f, "FocusHandle")?,
|
||||
ElementId::NamedInteger(s, i) => write!(f, "{}-{}", s, i)?,
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl ElementId {
|
||||
pub(crate) fn from_entity_id(entity_id: EntityId) -> Self {
|
||||
ElementId::View(entity_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue