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