From 256bb69f90aa41dd00c0709f544159298ffb976a Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sun, 16 Aug 2026 03:46:50 +0800 Subject: [PATCH] refactor(home): drop the labels for two rows the home page stopped offering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `SplitRight` and `SplitDown` were taken out of `HOME_SHORTCUTS` because both need a pane and the home page is what a window shows without one — "advertising two chords that do nothing from the only screen that offers them", as the comment there puts it, with a test to keep them out. Their labels stayed. `home_shortcut_label` still had an arm for each, and `HomeSplitRight`/`HomeSplitDown` were carried in three locale tables to serve those arms and nothing else. Nothing could point this out. The single caller iterates `HOME_SHORTCUTS`, so the arms are unreachable — but `_ => action` makes the match total, so no compiler warning, and the keys are textually referenced, so `dead_code` sees them as used. Only reading the caller does it. Removing the enum variants is what makes this safe rather than hopeful: the three locale tables match `L10nKey` exhaustively, so the compiler named every translation to delete and would have caught a fourth. --- src/ui/home.rs | 2 -- src/ui/i18n/en.rs | 2 -- src/ui/i18n/ja.rs | 2 -- src/ui/i18n/mod.rs | 2 -- src/ui/i18n/zh.rs | 2 -- 5 files changed, 10 deletions(-) diff --git a/src/ui/home.rs b/src/ui/home.rs index 8ac73519..9be72a4f 100644 --- a/src/ui/home.rs +++ b/src/ui/home.rs @@ -162,8 +162,6 @@ fn home_shortcut_label(action: &str, closed: Option<&str>) -> String { "ReopenClosedTab" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeReopenClosedTab), "ToggleSwitcher" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeSwitchWorkspace), "TogglePalette" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeCommandPalette), - "SplitRight" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeSplitRight), - "SplitDown" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeSplitDown), "OpenSettings" => crate::ui::i18n::t(crate::ui::i18n::L10nKey::HomeSettings), _ => action, }; diff --git a/src/ui/i18n/en.rs b/src/ui/i18n/en.rs index 811651ae..e8fc154f 100644 --- a/src/ui/i18n/en.rs +++ b/src/ui/i18n/en.rs @@ -20,8 +20,6 @@ pub fn translate_en(key: L10nKey) -> &'static str { L10nKey::HomeReopenClosedTab => "Reopen Closed Tab", L10nKey::HomeSwitchWorkspace => "Switch Workspace…", L10nKey::HomeCommandPalette => "Command Palette…", - L10nKey::HomeSplitRight => "Split Right", - L10nKey::HomeSplitDown => "Split Down", L10nKey::HomeSettings => "Settings…", L10nKey::Reconnect => "Reconnect", L10nKey::None => "None.", diff --git a/src/ui/i18n/ja.rs b/src/ui/i18n/ja.rs index 903c5aba..670770db 100644 --- a/src/ui/i18n/ja.rs +++ b/src/ui/i18n/ja.rs @@ -20,8 +20,6 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> { L10nKey::HomeReopenClosedTab => "閉じたタブをもう一度開く", L10nKey::HomeSwitchWorkspace => "ワークスペースを切り替える…", L10nKey::HomeCommandPalette => "コマンドパレット…", - L10nKey::HomeSplitRight => "右に分割", - L10nKey::HomeSplitDown => "下に分割", L10nKey::HomeSettings => "設定…", L10nKey::Reconnect => "再接続", L10nKey::None => "なし", diff --git a/src/ui/i18n/mod.rs b/src/ui/i18n/mod.rs index 9e8094b8..9b2d5324 100644 --- a/src/ui/i18n/mod.rs +++ b/src/ui/i18n/mod.rs @@ -98,8 +98,6 @@ l10n_keys! { HomeReopenClosedTab, HomeSwitchWorkspace, HomeCommandPalette, - HomeSplitRight, - HomeSplitDown, HomeSettings, Reconnect, None, diff --git a/src/ui/i18n/zh.rs b/src/ui/i18n/zh.rs index 5a7c809b..aa00239b 100644 --- a/src/ui/i18n/zh.rs +++ b/src/ui/i18n/zh.rs @@ -20,8 +20,6 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> { L10nKey::HomeReopenClosedTab => "重新打开已关闭的标签页", L10nKey::HomeSwitchWorkspace => "切换工作区…", L10nKey::HomeCommandPalette => "命令面板…", - L10nKey::HomeSplitRight => "向右分屏", - L10nKey::HomeSplitDown => "向下分屏", L10nKey::HomeSettings => "设置…", L10nKey::Reconnect => "重新连接", L10nKey::None => "无。",