settings_ui: Correct stepper increment and enforce max value for Centered Layout Padding (#40751)
Closes #40748 This PR improves the Centered Layout Padding in settings ui by limiting the numeric stepper to be within valid values and adding a custom schema generated to improve the JSON LSP completions and warnings when editing the setting field manually. Release Notes: - settings ui: limit stepper increment for centered padding between 0 and 0.4 and increment by 0.05 now --------- Co-authored by: Anthony Eid <anthony@zed.dev>
This commit is contained in:
@@ -8,7 +8,7 @@ use std::{
|
||||
use editor::{Editor, EditorStyle};
|
||||
use gpui::{ClickEvent, Entity, FocusHandle, Focusable, FontWeight, Modifiers};
|
||||
|
||||
use settings::{CodeFade, DelayMs, InactiveOpacity, MinimumContrast};
|
||||
use settings::{CenteredPaddingSettings, CodeFade, DelayMs, InactiveOpacity, MinimumContrast};
|
||||
use ui::prelude::*;
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
@@ -71,6 +71,14 @@ impl_newtype_numeric_stepper!(CodeFade, 0.1, 0.2, 0.05, 0.0, 0.9);
|
||||
impl_newtype_numeric_stepper!(InactiveOpacity, 0.1, 0.2, 0.05, 0.0, 1.0);
|
||||
impl_newtype_numeric_stepper!(MinimumContrast, 1., 10., 0.5, 0.0, 106.0);
|
||||
impl_newtype_numeric_stepper!(DelayMs, 100, 500, 10, 0, 2000);
|
||||
impl_newtype_numeric_stepper!(
|
||||
CenteredPaddingSettings,
|
||||
0.05,
|
||||
0.2,
|
||||
0.1,
|
||||
CenteredPaddingSettings::MIN_PADDING,
|
||||
CenteredPaddingSettings::MAX_PADDING
|
||||
);
|
||||
|
||||
macro_rules! impl_numeric_stepper_int {
|
||||
($type:ident) => {
|
||||
|
||||
Reference in New Issue
Block a user