diff --git a/crates/settings/src/settings_content/terminal.rs b/crates/settings/src/settings_content/terminal.rs index 1154c1cd6c9a89cba8e4f7a05278fd6ad8d02cff..9a848d767cbcb023f0035b522cd4101e4cb624c3 100644 --- a/crates/settings/src/settings_content/terminal.rs +++ b/crates/settings/src/settings_content/terminal.rs @@ -242,7 +242,19 @@ pub enum CursorShapeContent { Hollow, } -#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema, MergeFrom)] +#[derive( + Copy, + Clone, + Debug, + Serialize, + Deserialize, + PartialEq, + Eq, + JsonSchema, + MergeFrom, + strum::VariantArray, + strum::VariantNames, +)] #[serde(rename_all = "snake_case")] pub enum TerminalBlink { /// Never blink the cursor, ignoring the terminal mode. @@ -254,7 +266,19 @@ pub enum TerminalBlink { On, } -#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema, MergeFrom)] +#[derive( + Clone, + Copy, + Debug, + Serialize, + Deserialize, + PartialEq, + Eq, + JsonSchema, + MergeFrom, + strum::VariantArray, + strum::VariantNames, +)] #[serde(rename_all = "snake_case")] pub enum AlternateScroll { On, diff --git a/crates/settings_ui/src/page_data.rs b/crates/settings_ui/src/page_data.rs index 8d8a52585a0dc5324be5d41df44495c8ecafaca6..5ad88833cf118db1808819b37f25e57af94c7122 100644 --- a/crates/settings_ui/src/page_data.rs +++ b/crates/settings_ui/src/page_data.rs @@ -2774,6 +2774,163 @@ pub(crate) fn user_settings_data() -> Vec { }), metadata: None, }), + SettingsPageItem::SettingItem(SettingItem { + title: "Default Width", + description: "Default width when the terminal is docked to the left or right", + field: Box::new(SettingField { + pick: |settings_content| { + if let Some(terminal) = &settings_content.terminal { + &terminal.default_width + } else { + &None + } + }, + pick_mut: |settings_content| { + &mut settings_content + .terminal + .get_or_insert_default() + .default_width + }, + }), + metadata: None, + }), + SettingsPageItem::SettingItem(SettingItem { + title: "Default Height", + description: "Default height when the terminal is docked to the bottom", + field: Box::new(SettingField { + pick: |settings_content| { + if let Some(terminal) = &settings_content.terminal { + &terminal.default_height + } else { + &None + } + }, + pick_mut: |settings_content| { + &mut settings_content + .terminal + .get_or_insert_default() + .default_height + }, + }), + metadata: None, + }), + SettingsPageItem::SettingItem(SettingItem { + title: "Blinking", + description: "Sets the cursor blinking behavior in the terminal", + field: Box::new(SettingField { + pick: |settings_content| { + if let Some(terminal) = &settings_content.terminal { + &terminal.blinking + } else { + &None + } + }, + pick_mut: |settings_content| { + &mut settings_content.terminal.get_or_insert_default().blinking + }, + }), + metadata: None, + }), + SettingsPageItem::SettingItem(SettingItem { + title: "Alternate Scroll", + description: "Sets whether Alternate Scroll mode is active by default", + field: Box::new(SettingField { + pick: |settings_content| { + if let Some(terminal) = &settings_content.terminal { + &terminal.alternate_scroll + } else { + &None + } + }, + pick_mut: |settings_content| { + &mut settings_content + .terminal + .get_or_insert_default() + .alternate_scroll + }, + }), + metadata: None, + }), + SettingsPageItem::SettingItem(SettingItem { + title: "Option As Meta", + description: "Sets whether the option key behaves as the meta key", + field: Box::new(SettingField { + pick: |settings_content| { + if let Some(terminal) = &settings_content.terminal { + &terminal.option_as_meta + } else { + &None + } + }, + pick_mut: |settings_content| { + &mut settings_content + .terminal + .get_or_insert_default() + .option_as_meta + }, + }), + metadata: None, + }), + SettingsPageItem::SettingItem(SettingItem { + title: "Copy On Select", + description: "Whether selecting text in the terminal automatically copies to clipboard", + field: Box::new(SettingField { + pick: |settings_content| { + if let Some(terminal) = &settings_content.terminal { + &terminal.copy_on_select + } else { + &None + } + }, + pick_mut: |settings_content| { + &mut settings_content + .terminal + .get_or_insert_default() + .copy_on_select + }, + }), + metadata: None, + }), + SettingsPageItem::SettingItem(SettingItem { + title: "Keep Selection On Copy", + description: "Whether to keep the text selection after copying it to the clipboard", + field: Box::new(SettingField { + pick: |settings_content| { + if let Some(terminal) = &settings_content.terminal { + &terminal.keep_selection_on_copy + } else { + &None + } + }, + pick_mut: |settings_content| { + &mut settings_content + .terminal + .get_or_insert_default() + .keep_selection_on_copy + }, + }), + metadata: None, + }), + SettingsPageItem::SettingItem(SettingItem { + title: "Max Scroll History Lines", + description: "The maximum number of lines to keep in the scrollback history", + field: Box::new(SettingField { + pick: |settings_content| { + if let Some(terminal) = &settings_content.terminal { + &terminal.max_scroll_history_lines + } else { + &None + } + }, + pick_mut: |settings_content| { + &mut settings_content + .terminal + .get_or_insert_default() + .max_scroll_history_lines + }, + }), + metadata: None, + }), SettingsPageItem::SectionHeader("Outline Panel"), SettingsPageItem::SettingItem(SettingItem { title: "Outline Panel Button", diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index 6999a754e5b7f1c27ff9d05c9aaf29494f93a750..e363a36518bd8e6bb8db4c155a7cc79ec693f49c 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -421,6 +421,12 @@ fn init_renderers(cx: &mut App) { }) .add_renderer::(|settings_field, file, _, window, cx| { render_dropdown(*settings_field, file, window, cx) + }) + .add_renderer::(|settings_field, file, _, window, cx| { + render_dropdown(*settings_field, file, window, cx) + }) + .add_renderer::(|settings_field, file, _, window, cx| { + render_dropdown(*settings_field, file, window, cx) }); // todo(settings_ui): Figure out how we want to handle discriminant unions