fix: simplify special tab chrome

This commit is contained in:
kuddev committed 2026-07-16 12:40:01 +08:00
1 parent 57b634b6a7
commit 2ee4fbe9bf
5 files changed
+41 -13

No files matched your search

+6 -2
View File
@@ -1186,6 +1186,10 @@ pub(super) fn draw_chrome(d: &mut Display) {
ICON_SETTINGS,
);
for (hit, cx, cy) in chrome_control_centers(w, top_y, bar_h, scale) {
if d.nebula_special_tab_active && matches!(hit, ChromeHit::PanelFiles | ChromeHit::PanelGit)
{
continue;
}
let hovered = d.nebula_chrome_hover == hit;
let icon = match hit {
ChromeHit::Minimize => ICON_CHROME_MINIMIZE,
@@ -1245,7 +1249,7 @@ pub(super) fn draw_chrome(d: &mut Display) {
section_title_tracking,
TXT_DIM,
section_title_flags,
&format!("{} {tabs_chevron}", language.pick("标签页", "TABS")),
&format!("TABS {tabs_chevron}"),
&mut d.glyph_cache,
);
for (index, (tab_x, row_y, tab_w, tab_h)) in tab_layout.tabs.iter().copied().enumerate() {
@@ -1461,7 +1465,7 @@ pub(super) fn draw_chrome(d: &mut Display) {
section_title_tracking,
TXT_DIM,
section_title_flags,
&format!("{} {hosts_chevron}", language.pick("SSH 主机", "SSH HOSTS")),
&format!("SSH HOSTS {hosts_chevron}"),
&mut d.glyph_cache,
);
// Empty state: the section stays visible with a hint teaching the
+10
View File
@@ -1385,6 +1385,7 @@ pub struct Display {
/// window is following the operating system.
nebula_window_theme_override: Option<WinitTheme>,
pub nebula_settings_open: bool,
pub nebula_special_tab_active: bool,
nebula_language_preference: LanguagePreference,
nebula_language: UiLanguage,
/// Paths from the last successful app configuration generation.
@@ -1807,6 +1808,7 @@ impl Display {
nebula_system_theme,
nebula_window_theme_override,
nebula_settings_open: false,
nebula_special_tab_active: false,
nebula_language_preference: settings_init.language,
nebula_language: settings_init.language.resolved(),
nebula_config_paths: config.config_paths.clone(),
@@ -2822,6 +2824,7 @@ impl Display {
return;
}
self.nebula_settings_open = active;
self.nebula_special_tab_active = active;
if !active {
self.nebula_shell_picker_open = false;
self.nebula_font_picker_open = false;
@@ -2833,6 +2836,13 @@ impl Display {
self.pending_update.dirty = true;
}
pub fn set_special_tab_active(&mut self, active: bool) {
self.nebula_special_tab_active = active;
if !active {
self.nebula_settings_open = false;
}
}
pub fn set_ui_language(&mut self, preference: LanguagePreference) {
if self.nebula_language_preference == preference {
return;
-11
View File
@@ -835,17 +835,6 @@ pub(super) fn push_quads(
// The page is flush with the active tab card. No veil, drop shadow or
// second window outline: depth belongs to the app shell, not this page.
quads.push(UiQuad::solid(px, py, pw, ph, s(12.0), sk.panel));
quads.push(UiQuad::solid(
px + s(12.0),
py,
pw - s(24.0),
s(1.0),
0.0,
// Top bevel: a subtle white lift on dark themes; on light panels a
// faint dark line reads as the lit edge instead.
if sk.is_light { Rgba::new(0, 0, 0, 24) } else { Rgba::new(255, 255, 255, 20) },
));
let (side_x, side_y, side_w, side_h) = geometry.sidebar;
// Sidebar: no fill of its own — just a hairline separator on its right
+17
View File
@@ -692,6 +692,15 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
} else {
crate::display::ChromeHit::None
};
let chrome_hover = if self.ctx.display().nebula_special_tab_active
&& matches!(
chrome_hover,
crate::display::ChromeHit::PanelFiles | crate::display::ChromeHit::PanelGit
) {
crate::display::ChromeHit::None
} else {
chrome_hover
};
self.ctx.display().set_chrome_hover(chrome_hover, settings_hover);
// Resize cursor on the window border, arrow over the title bar/sidebar,
@@ -1722,6 +1731,14 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> {
crate::display::SettingsHit::None => {},
}
let chrome_hit = self.ctx.display().chrome_hit(x, y);
if self.ctx.display().nebula_special_tab_active
&& matches!(
chrome_hit,
crate::display::ChromeHit::PanelFiles | crate::display::ChromeHit::PanelGit
)
{
return;
}
// Multi-click state was advanced once at the top of this
// function; read it for the tab double-click rename below.
let state = self.ctx.mouse().click_state;
+8
View File
@@ -1640,6 +1640,8 @@ impl WindowContext {
}
self.active_tab = index;
self.tabs[index].has_bell = false;
self.display
.set_special_tab_active(self.tabs[index].doc.is_some() || self.tabs[index].settings);
self.display.set_settings_tab_active(self.tabs[index].settings);
self.zoom = None;
self.resize_active_layout();
@@ -1700,6 +1702,9 @@ impl WindowContext {
} else if self.active_tab >= self.tabs.len() {
self.active_tab = self.tabs.len() - 1;
}
let special =
self.tabs.get(self.active_tab).is_some_and(|tab| tab.doc.is_some() || tab.settings);
self.display.set_special_tab_active(special);
self.display.set_settings_tab_active(
self.tabs.get(self.active_tab).is_some_and(|tab| tab.settings),
);
@@ -1987,6 +1992,9 @@ impl WindowContext {
}
fn sync_chrome_tabs(&mut self) {
let special =
self.tabs.get(self.active_tab).is_some_and(|tab| tab.doc.is_some() || tab.settings);
self.display.set_special_tab_active(special);
self.display.set_settings_tab_active(
self.tabs.get(self.active_tab).is_some_and(|tab| tab.settings),
);