feat: add editor component
This commit is contained in:
@@ -57,6 +57,8 @@ pub struct Theme {
|
||||
pub titlebar_height: Pixels,
|
||||
/// The platform's native root font size; rem-based sizing scales with it.
|
||||
pub root_font_size: Pixels,
|
||||
/// The platform's monospace family, for code surfaces.
|
||||
pub mono_font: &'static str,
|
||||
pub sizes: SizeTable,
|
||||
pub accessibility: AccessibilityPreferences,
|
||||
}
|
||||
@@ -411,6 +413,7 @@ impl Theme {
|
||||
scrollbar: resolved.scrollbar,
|
||||
titlebar_height: resolved.titlebar_height,
|
||||
root_font_size: resolved.root_font_size,
|
||||
mono_font: resolved.mono_font,
|
||||
sizes: resolved.sizes,
|
||||
accessibility: resolved.accessibility,
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ pub struct ResolvedTheme {
|
||||
pub titlebar_height: gpui::Pixels,
|
||||
/// The platform's native root font size; the fallback theme uses 16.
|
||||
pub root_font_size: gpui::Pixels,
|
||||
/// The platform's monospace family, for code surfaces.
|
||||
pub mono_font: &'static str,
|
||||
pub sizes: SizeTable,
|
||||
pub accessibility: crate::system::AccessibilityPreferences,
|
||||
}
|
||||
@@ -244,11 +246,23 @@ pub(crate) fn resolve(
|
||||
},
|
||||
titlebar_height,
|
||||
root_font_size,
|
||||
mono_font: mono_font(),
|
||||
sizes,
|
||||
accessibility,
|
||||
}
|
||||
}
|
||||
|
||||
/// The platform's monospace family, for code surfaces.
|
||||
fn mono_font() -> &'static str {
|
||||
if cfg!(target_os = "macos") {
|
||||
"Menlo"
|
||||
} else if cfg!(target_os = "windows") {
|
||||
"Consolas"
|
||||
} else {
|
||||
"monospace"
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user