Remove dead TUI style settings.
This commit is contained in:
@@ -1310,6 +1310,15 @@ mod tests {
|
||||
assert_eq!(defaults.data["editor.default_mode"], "markdown");
|
||||
assert_eq!(defaults.data["editor.diff_view_style"], "inline");
|
||||
assert_eq!(defaults.data["ai.endpoint.online.api_key"], "<not set>");
|
||||
let removed_prefix = ["style", "."].concat();
|
||||
assert!(
|
||||
defaults
|
||||
.data
|
||||
.as_object()
|
||||
.unwrap()
|
||||
.keys()
|
||||
.all(|key| !key.starts_with(&removed_prefix))
|
||||
);
|
||||
assert!(
|
||||
!defaults
|
||||
.message
|
||||
|
||||
@@ -35,8 +35,6 @@ const DEFAULTS: &[(&str, &str)] = &[
|
||||
("ai.system_prompt", ""),
|
||||
("mcp.http.enabled", "false"),
|
||||
("data.automatic_rebuild", "true"),
|
||||
("style.theme", "system"),
|
||||
("style.content_width", "72"),
|
||||
];
|
||||
|
||||
pub fn get(conn: &Connection, key: &str) -> EngineResult<Option<String>> {
|
||||
@@ -113,3 +111,20 @@ pub fn set_at(conn: &Connection, key: &str, value: &str, updated_at: i64) -> Eng
|
||||
pub fn ui_language(conn: &Connection) -> EngineResult<Option<String>> {
|
||||
get(conn, UI_LANGUAGE_KEY)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::db::Database;
|
||||
|
||||
#[test]
|
||||
fn effective_defaults_exclude_removed_style_settings() {
|
||||
let db = Database::open_in_memory().unwrap();
|
||||
db.migrate().unwrap();
|
||||
|
||||
let values = list_effective(db.conn()).unwrap();
|
||||
|
||||
let removed_prefix = ["style", "."].concat();
|
||||
assert!(!values.keys().any(|key| key.starts_with(&removed_prefix)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,11 +174,10 @@ enum SettingSection {
|
||||
Publishing,
|
||||
Data,
|
||||
Mcp,
|
||||
Style,
|
||||
}
|
||||
|
||||
impl SettingSection {
|
||||
const ALL: [Self; 9] = [
|
||||
const ALL: [Self; 8] = [
|
||||
Self::Project,
|
||||
Self::Editor,
|
||||
Self::Content,
|
||||
@@ -187,7 +186,6 @@ impl SettingSection {
|
||||
Self::Publishing,
|
||||
Self::Data,
|
||||
Self::Mcp,
|
||||
Self::Style,
|
||||
];
|
||||
const fn key(self) -> &'static str {
|
||||
match self {
|
||||
@@ -199,7 +197,6 @@ impl SettingSection {
|
||||
Self::Publishing => "settings.nav.publishing",
|
||||
Self::Data => "settings.nav.data",
|
||||
Self::Mcp => "settings.nav.mcp",
|
||||
Self::Style => "settings.nav.style",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2069,20 +2066,6 @@ impl TuiApp {
|
||||
),
|
||||
]
|
||||
}
|
||||
SettingSection::Style => field_specs(&[
|
||||
(
|
||||
"Theme",
|
||||
"style.theme",
|
||||
FieldKind::Enum(&["system", "light", "dark"]),
|
||||
"system",
|
||||
),
|
||||
(
|
||||
"Content width",
|
||||
"style.content_width",
|
||||
FieldKind::Text,
|
||||
"72",
|
||||
),
|
||||
]),
|
||||
};
|
||||
specs
|
||||
.into_iter()
|
||||
@@ -2553,8 +2536,6 @@ fn setting_field_label(locale: UiLocale, key: &str, fallback: &str) -> String {
|
||||
"data.automatic_rebuild" => "tui.settingAutomaticRebuild",
|
||||
"mcp.http.enabled" => "settings.mcpEnable",
|
||||
"mcp.proposals" => "settings.mcpProposals",
|
||||
"style.theme" => "tui.settingTheme",
|
||||
"style.content_width" => "tui.settingContentWidth",
|
||||
_ => return fallback.into(),
|
||||
};
|
||||
bds_core::i18n::translate(locale, translation_key)
|
||||
@@ -4071,6 +4052,28 @@ mod tests {
|
||||
fn settings_are_typed_saved_and_server_locale_relocalizes_every_session() {
|
||||
let fixture = Fixture::new();
|
||||
let mut app = fixture.app(false);
|
||||
assert_eq!(
|
||||
SettingSection::ALL,
|
||||
[
|
||||
SettingSection::Project,
|
||||
SettingSection::Editor,
|
||||
SettingSection::Content,
|
||||
SettingSection::Ai,
|
||||
SettingSection::Technology,
|
||||
SettingSection::Publishing,
|
||||
SettingSection::Data,
|
||||
SettingSection::Mcp,
|
||||
]
|
||||
);
|
||||
let removed_prefix = ["style", "."].concat();
|
||||
for section in SettingSection::ALL {
|
||||
assert!(
|
||||
app.load_setting_fields(section)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.all(|field| !field.key.starts_with(&removed_prefix))
|
||||
);
|
||||
}
|
||||
app.set_view(TuiView::Settings).unwrap();
|
||||
app.selected_index = 2;
|
||||
app.open_selected().unwrap();
|
||||
|
||||
@@ -805,7 +805,5 @@ tui-settingRuntime = Skript-Laufzeit
|
||||
tui-settingTransferMode = Übertragungsmodus
|
||||
tui-settingDatabase = Datenbank
|
||||
tui-settingAutomaticRebuild = Automatischer Neuaufbau
|
||||
tui-settingTheme = Erscheinungsbild
|
||||
tui-settingContentWidth = Inhaltsbreite
|
||||
tui-categoryEditing = Kategorien bearbeiten
|
||||
tui-categoryEditingGuiOnly = Kategorien können weiterhin in der Desktop-Anwendung hinzugefügt, bearbeitet und entfernt werden
|
||||
|
||||
@@ -805,7 +805,5 @@ tui-settingRuntime = Scripting Runtime
|
||||
tui-settingTransferMode = Transfer Mode
|
||||
tui-settingDatabase = Database
|
||||
tui-settingAutomaticRebuild = Automatic Rebuild
|
||||
tui-settingTheme = Theme
|
||||
tui-settingContentWidth = Content Width
|
||||
tui-categoryEditing = Category Editing
|
||||
tui-categoryEditingGuiOnly = Category add, edit, and removal remain in the desktop application
|
||||
|
||||
@@ -805,7 +805,5 @@ tui-settingRuntime = Motor de scripts
|
||||
tui-settingTransferMode = Modo de transferencia
|
||||
tui-settingDatabase = Base de datos
|
||||
tui-settingAutomaticRebuild = Reconstrucción automática
|
||||
tui-settingTheme = Tema
|
||||
tui-settingContentWidth = Ancho del contenido
|
||||
tui-categoryEditing = Edición de categorías
|
||||
tui-categoryEditingGuiOnly = La creación, edición y eliminación de categorías permanecen en la aplicación de escritorio
|
||||
|
||||
@@ -805,7 +805,5 @@ tui-settingRuntime = Moteur de scripts
|
||||
tui-settingTransferMode = Mode de transfert
|
||||
tui-settingDatabase = Base de données
|
||||
tui-settingAutomaticRebuild = Reconstruction automatique
|
||||
tui-settingTheme = Thème
|
||||
tui-settingContentWidth = Largeur du contenu
|
||||
tui-categoryEditing = Modification des catégories
|
||||
tui-categoryEditingGuiOnly = L’ajout, la modification et la suppression de catégories restent dans l’application de bureau
|
||||
|
||||
@@ -805,7 +805,5 @@ tui-settingRuntime = Runtime degli script
|
||||
tui-settingTransferMode = Modalità di trasferimento
|
||||
tui-settingDatabase = Database
|
||||
tui-settingAutomaticRebuild = Ricostruzione automatica
|
||||
tui-settingTheme = Tema
|
||||
tui-settingContentWidth = Larghezza del contenuto
|
||||
tui-categoryEditing = Modifica delle categorie
|
||||
tui-categoryEditingGuiOnly = L’aggiunta, la modifica e la rimozione delle categorie restano nell’applicazione desktop
|
||||
|
||||
@@ -130,9 +130,9 @@ rule SettingsPanel {
|
||||
when: TuiKeyPressed(code: "6")
|
||||
-- "6" opens the settings panel (issue #29), matching the GUI panel
|
||||
-- numbering: the sidebar lists the same preference sections as the
|
||||
-- GUI settings editor (Project, Editor, Content, AI, Technology,
|
||||
-- Publishing, Data, MCP, Style — from BDS.UI.Sidebar's settings
|
||||
-- view). Enter on a section opens a section-specific editor in the
|
||||
-- settings backends (Project, Editor, Content, AI, Technology,
|
||||
-- Publishing, Data, MCP). The GUI-only Style tab is intentionally
|
||||
-- absent. Enter on a section opens a section-specific editor in the
|
||||
-- main area: a generic typed-field form from BDS.UI.SettingsForm.
|
||||
-- Enter edits a text field in a status-line prompt, toggles a
|
||||
-- boolean, or cycles an enum through its options; read-only info
|
||||
|
||||
Reference in New Issue
Block a user