mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-10-06 08:02:04 +00:00
fix(panel): light the side panel's current tab; clicking it no longer closes the panel (#1079)
* fix(panel): light the side panel's current tab; clicking it no longer closes the panel The current tab differed from the others only in ink and weight, which read as no selection at all; it now sits on a pill. Clicking it used to put the panel away, so a stray click on the tab you were on hid the panel. ⌘J and the title-bar panel tile still do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(panel): spell the hide shortcut as a key, like the line above it --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
l0ng-ai
parent
aadd80d4ae
commit
528bd12c86
@@ -6,8 +6,8 @@ description: "Info, Files, Search, Source Control and GitHub — plus the built-
|
||||
<kbd>⌘ J</kbd> opens a panel on the right of the window. It is hidden by
|
||||
default; whichever tab you leave it on is where it opens next time.
|
||||
|
||||
The icons at the top switch tabs — hover one for its name — and clicking the
|
||||
lit one puts the panel away again.
|
||||
The tabs at the top switch what the panel shows; the current one sits on a
|
||||
pill. <kbd>⌘ J</kbd> or the panel tile in the title bar puts it away.
|
||||
|
||||
<Frame caption="The Info tab beside a terminal: session, processes, listening ports">
|
||||
<img src="/images/side-panel.webp" alt="The tty7 side panel" />
|
||||
|
||||
+11
-22
@@ -1507,7 +1507,7 @@ impl Tty7App {
|
||||
// destroys the element holding the focus — and a keymap
|
||||
// scoped to a focused thing goes quiet with it, leaving the
|
||||
// ⌘J that would undo this doing nothing. Hand the terminal
|
||||
// back what it lost, the same way the tab tiles below do.
|
||||
// back what it lost.
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
let closing = this.right_panel_open(cx);
|
||||
this.toggle_right_panel(cx);
|
||||
@@ -1520,9 +1520,8 @@ impl Tty7App {
|
||||
}
|
||||
|
||||
/// The right panel's tabs: words, the current one in body ink and medium
|
||||
/// weight — v5's inspector row. Four names fit the panel's resting width
|
||||
/// once Search folded into Files; this is secondary navigation, not an
|
||||
/// action, so it gets neither a pill nor a bar.
|
||||
/// weight on a pill (ink and weight alone read as no selection at all).
|
||||
/// Four names fit the panel's resting width once Search folded into Files.
|
||||
pub(crate) fn right_panel_tabs(&self, cx: &mut Context<Self>) -> Vec<AnyElement> {
|
||||
let active_tab = self.right_panel_tab;
|
||||
let body_ink = cx.theme().foreground;
|
||||
@@ -1553,6 +1552,9 @@ impl Tty7App {
|
||||
div()
|
||||
.flex_shrink_0()
|
||||
.px(px(TAB_INNER_PAD))
|
||||
.py_0p5()
|
||||
.rounded_md()
|
||||
.when(current, |s| s.bg(cx.theme().secondary))
|
||||
.text_size(gpui::rems(crate::ui::right_panel::TAB_TEXT))
|
||||
.font_weight(match current {
|
||||
true => FontWeight::MEDIUM,
|
||||
@@ -1562,24 +1564,11 @@ impl Tty7App {
|
||||
.hover(move |s| s.text_color(body_ink))
|
||||
.child(t(label_key)),
|
||||
)
|
||||
// Another tab switches to it; the current one puts the panel
|
||||
// away, the way an activity bar behaves everywhere else.
|
||||
// (These only exist while the panel is open, so
|
||||
// `ToggleRightPanel` and the chrome tile beside them are still
|
||||
// what brings it back.)
|
||||
.on_click(cx.listener(move |this, _, window, cx| {
|
||||
match this.right_panel_open(cx) && this.right_panel_tab == tab {
|
||||
true => {
|
||||
this.toggle_right_panel(cx);
|
||||
// These tabs live inside the panel, so closing
|
||||
// from one destroys the element that holds the
|
||||
// focus and leaves it nowhere — and a keymap whose
|
||||
// bindings are scoped to a focused thing goes
|
||||
// quiet with it. Hand the terminal back what it
|
||||
// lost.
|
||||
this.focus_active(window, cx);
|
||||
}
|
||||
false => this.set_right_panel_tab(tab, cx),
|
||||
// The current one does nothing: only ⌘J and the title-bar
|
||||
// panel tile put the panel away.
|
||||
.on_click(cx.listener(move |this, _, _, cx| {
|
||||
if this.right_panel_tab != tab {
|
||||
this.set_right_panel_tab(tab, cx);
|
||||
}
|
||||
}))
|
||||
.into_any_element()
|
||||
|
||||
Reference in New Issue
Block a user