Tooling · Inspection: stalls count whole, the panel owns Tab, bound keys log
FpsMeter keeps the stamp before the last second, so a frame longer than the span shows as the worst and a bar. The inspector's panel, a second root out of the app's scope, sits in a FocusScope of its own, so Tab goes on from Pick. EventLogger takes key downs through an interceptor, which runs before bindings, and marks its box with a key context to know focus is inside, so a field's Backspace and Enter log. Tests hold the stall, Tab both ways through Pick, bound keys in a field, a key while focus is outside, newest first and a bare border.
This commit is contained in:
1 parent
462e47b854
commit
4d1a17d29a
6 files changed
+182
-40
No files matched your search
@@ -9,7 +9,7 @@ use gpui::{
|
||||
|
||||
use crate::{
|
||||
buttons::{Button, ButtonVariant},
|
||||
primitives::raise,
|
||||
primitives::{FocusScope, raise},
|
||||
theme::{ActiveTheme, ControlSize, Radius, TextSize},
|
||||
typography::{Ellipsis, LEADING, literal, tabular},
|
||||
};
|
||||
@@ -305,6 +305,10 @@ fn panel(
|
||||
)
|
||||
});
|
||||
let states = inspector.render_inspector_states(window, cx);
|
||||
let focus = window
|
||||
.use_keyed_state("ely-inspector-focus", cx, |_, cx| cx.focus_handle())
|
||||
.read(cx)
|
||||
.clone();
|
||||
let owner = cx.entity();
|
||||
let theme = cx.theme();
|
||||
let colors = &theme.colors;
|
||||
@@ -314,7 +318,7 @@ fn panel(
|
||||
}
|
||||
false => "Held. Pick chooses another box.",
|
||||
};
|
||||
div()
|
||||
let body = div()
|
||||
.id("ely-inspector")
|
||||
.size_full()
|
||||
.flex()
|
||||
@@ -365,7 +369,11 @@ fn panel(
|
||||
.child(Ellipsis::new(ids)),
|
||||
)
|
||||
}))
|
||||
.children(states)
|
||||
.children(states);
|
||||
// A second root, out of the app's scope: it owns Tab itself.
|
||||
FocusScope::new(&focus)
|
||||
.size_full()
|
||||
.child(body)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
@@ -394,6 +402,12 @@ mod tests {
|
||||
);
|
||||
assert_eq!(written.padding, [Side::Px(8.0); 4]);
|
||||
assert_eq!(written.border, [Side::Px(2.0); 4]);
|
||||
let bare = layers(&StyleRefinement::default(), px(16.0));
|
||||
assert_eq!(
|
||||
bare.border,
|
||||
[Side::Px(0.0); 4],
|
||||
"no border written, none read"
|
||||
);
|
||||
let mut share = StyleRefinement::default();
|
||||
share.padding.left = Some(relative(0.25));
|
||||
let shown = layers(&share, px(16.0))
|
||||
|
||||
Reference in new issue
Block a user