diff --git a/crates/editor/src/editor_settings_controls.rs b/crates/editor/src/editor_settings_controls.rs index 09f01837eecab58474a9a86f1fc8a8cc8d9449c2..82847a64917e664f6e2601b94e67ff921e8c4554 100644 --- a/crates/editor/src/editor_settings_controls.rs +++ b/crates/editor/src/editor_settings_controls.rs @@ -140,6 +140,7 @@ impl RenderOnce for BufferFontSizeControl { .gap_2() .child(Icon::new(IconName::FontSize)) .child(NumericStepper::new( + "buffer-font-size", value.to_string(), move |_, cx| { Self::write(value - px(1.), cx); diff --git a/crates/settings_ui/src/appearance_settings_controls.rs b/crates/settings_ui/src/appearance_settings_controls.rs index 1947c8be0ae8b7262023d791b31ec1fec84ef40c..c12eba18af0b6ecf4973eef1eec2a5472bf7c1d3 100644 --- a/crates/settings_ui/src/appearance_settings_controls.rs +++ b/crates/settings_ui/src/appearance_settings_controls.rs @@ -260,6 +260,7 @@ impl RenderOnce for UiFontSizeControl { .gap_2() .child(Icon::new(IconName::FontSize)) .child(NumericStepper::new( + "ui-font-size", value.to_string(), move |_, cx| { Self::write(value - px(1.), cx); diff --git a/crates/title_bar/src/application_menu.rs b/crates/title_bar/src/application_menu.rs index a1e92865d3af8708e3dc0e8683990f9211a16332..47d4818da5e92ba4294b144f67b10be30030f359 100644 --- a/crates/title_bar/src/application_menu.rs +++ b/crates/title_bar/src/application_menu.rs @@ -26,6 +26,7 @@ impl RenderOnce for ApplicationMenu { .child(Label::new("Buffer Font Size")) .child( NumericStepper::new( + "buffer-font-size", theme::get_buffer_font_size(cx).to_string(), |_, cx| { cx.dispatch_action(Box::new( @@ -61,6 +62,7 @@ impl RenderOnce for ApplicationMenu { .child(Label::new("UI Font Size")) .child( NumericStepper::new( + "ui-font-size", theme::get_ui_font_size(cx).to_string(), |_, cx| { cx.dispatch_action(Box::new( diff --git a/crates/ui/src/components/numeric_stepper.rs b/crates/ui/src/components/numeric_stepper.rs index 16946588bacc8744245dd3803976755250ad3121..64ea79f21cc6def01bd08ab4d97a2753d96cc90e 100644 --- a/crates/ui/src/components/numeric_stepper.rs +++ b/crates/ui/src/components/numeric_stepper.rs @@ -4,6 +4,7 @@ use crate::{prelude::*, IconButtonShape}; #[derive(IntoElement)] pub struct NumericStepper { + id: ElementId, value: SharedString, on_decrement: Box, on_increment: Box, @@ -14,11 +15,13 @@ pub struct NumericStepper { impl NumericStepper { pub fn new( + id: impl Into, value: impl Into, on_decrement: impl Fn(&ClickEvent, &mut WindowContext) + 'static, on_increment: impl Fn(&ClickEvent, &mut WindowContext) + 'static, ) -> Self { Self { + id: id.into(), value: value.into(), on_decrement: Box::new(on_decrement), on_increment: Box::new(on_increment), @@ -47,6 +50,7 @@ impl RenderOnce for NumericStepper { let icon_size = IconSize::Small; h_flex() + .id(self.id) .gap_1() .map(|element| { if let Some(on_reset) = self.on_reset {