mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 08:02:24 +00:00
fix(ui): give the segmented control the surface it actually paints on
`segmented` paints its own opaque track — deliberately, since every rung above it was derived against that ground. But it hardcoded the window surface, and one of its sixteen call sites is the managed-forward form in the right panel, which is a sunk `sidebar` rail: the track landed as a faintly darker box cut out of the column around it, and its hover / selected / label rungs were measured against a ground that was not there. Split off `segmented_on`, which takes the `Surface`; `segmented` keeps the window default the settings sheet wants. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WCb8ZDmvdA5xbVtvs647tD
This commit is contained in:
+5
-1
@@ -358,6 +358,9 @@ impl Tty7App {
|
||||
fn forward_form(&self, pane_id: u64, cx: &mut Context<Self>) -> Div {
|
||||
let theme = cx.theme();
|
||||
let muted = theme.muted_foreground;
|
||||
// The form is inside the right panel, i.e. on the sunk rail — not on the
|
||||
// settings sheet the segmented control otherwise assumes.
|
||||
let sf = cx.global::<crate::ui::presets::Surfaces>().sidebar;
|
||||
let kind = self.loopback_panel.mf_kind;
|
||||
let editing = self.loopback_panel.mf_editing.is_some();
|
||||
let selected = match kind {
|
||||
@@ -394,7 +397,8 @@ impl Tty7App {
|
||||
.pt(px(6.))
|
||||
.pb(px(2.))
|
||||
.gap(px(5.))
|
||||
.child(self.segmented(
|
||||
.child(self.segmented_on(
|
||||
sf,
|
||||
"ssh-managed-forward-kind",
|
||||
&["Local", "Remote", "Dynamic"],
|
||||
selected,
|
||||
|
||||
@@ -1204,6 +1204,23 @@ impl Tty7App {
|
||||
on_pick: impl Fn(&mut Self, usize, &mut Window, &mut Context<Self>) + 'static,
|
||||
) -> AnyElement {
|
||||
let sf = cx.global::<presets::Surfaces>().window;
|
||||
self.segmented_on(sf, id, options, selected, cx, on_pick)
|
||||
}
|
||||
|
||||
/// [`Self::segmented`] for a control that does *not* sit on the settings
|
||||
/// sheet. The track paints its own opaque ground, so it has to be told which
|
||||
/// one: dropped on the right panel's sunk rail, a window-surface track reads
|
||||
/// as a faintly darker box cut out of the column it sits in — and every rung
|
||||
/// above it was derived against the wrong ground.
|
||||
pub(crate) fn segmented_on(
|
||||
&self,
|
||||
sf: presets::Surface,
|
||||
id: &'static str,
|
||||
options: &'static [&'static str],
|
||||
selected: usize,
|
||||
cx: &mut Context<Self>,
|
||||
on_pick: impl Fn(&mut Self, usize, &mut Window, &mut Context<Self>) + 'static,
|
||||
) -> AnyElement {
|
||||
let border = cx.theme().border;
|
||||
let on_pick = std::rc::Rc::new(on_pick);
|
||||
h_flex()
|
||||
|
||||
Reference in New Issue
Block a user