feat: add editor component

This commit is contained in:
2026-11-04 14:01:54 +07:00
parent 50da1d4a9d
commit 503b105bad
13 changed files with 1021 additions and 9 deletions
+3
View File
@@ -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,
}
+14
View File
@@ -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::*;