Flip the dependency between editor and theme

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-10-05 19:21:13 +02:00
parent f09798c4a7
commit f70e3878b6
12 changed files with 94 additions and 94 deletions

View file

@ -28,6 +28,7 @@ use std::{
time::Duration,
};
use sum_tree::Bias;
use theme::EditorStyle;
use util::post_inc;
const CURSOR_BLINK_INTERVAL: Duration = Duration::from_millis(500);
@ -283,27 +284,6 @@ pub struct EditorSettings {
pub style: EditorStyle,
}
#[derive(Clone, Deserialize, Default)]
pub struct EditorStyle {
pub text: TextStyle,
#[serde(default)]
pub placeholder_text: Option<TextStyle>,
pub background: Color,
pub selection: SelectionStyle,
pub gutter_background: Color,
pub active_line_background: Color,
pub line_number: Color,
pub line_number_active: Color,
pub guest_selections: Vec<SelectionStyle>,
pub syntax: Arc<SyntaxTheme>,
}
#[derive(Clone, Copy, Default, Deserialize)]
pub struct SelectionStyle {
pub cursor: Color,
pub selection: Color,
}
pub struct Editor {
handle: WeakViewHandle<Self>,
buffer: ModelHandle<Buffer>,
@ -2448,12 +2428,6 @@ impl Snapshot {
}
}
impl EditorStyle {
fn placeholder_text(&self) -> &TextStyle {
self.placeholder_text.as_ref().unwrap_or(&self.text)
}
}
impl EditorSettings {
#[cfg(any(test, feature = "test-support"))]
pub fn test(cx: &AppContext) -> Self {