Move EditorStyle into editor module

This commit is contained in:
Nathan Sobo
2021-09-16 12:26:18 -06:00
parent 260114af6c
commit ad9712db70
3 changed files with 51 additions and 48 deletions
+1 -44
View File
@@ -2,6 +2,7 @@ mod highlight_map;
mod resolution;
mod theme_registry;
use crate::editor::{EditorStyle, SelectionStyle};
use anyhow::Result;
use gpui::{
color::Color,
@@ -158,20 +159,6 @@ pub struct ContainedLabel {
pub label: LabelStyle,
}
#[derive(Clone, Deserialize)]
pub struct EditorStyle {
pub text: HighlightStyle,
#[serde(default)]
pub placeholder_text: HighlightStyle,
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>,
}
#[derive(Clone, Deserialize)]
pub struct InputEditorStyle {
#[serde(flatten)]
@@ -181,12 +168,6 @@ pub struct InputEditorStyle {
pub selection: SelectionStyle,
}
#[derive(Clone, Copy, Default, Deserialize)]
pub struct SelectionStyle {
pub cursor: Color,
pub selection: Color,
}
impl SyntaxTheme {
pub fn new(highlights: Vec<(String, HighlightStyle)>) -> Self {
Self { highlights }
@@ -204,30 +185,6 @@ impl SyntaxTheme {
}
}
impl Default for EditorStyle {
fn default() -> Self {
Self {
text: HighlightStyle {
color: Color::from_u32(0xff0000ff),
font_properties: Default::default(),
underline: false,
},
placeholder_text: HighlightStyle {
color: Color::from_u32(0x00ff00ff),
font_properties: Default::default(),
underline: false,
},
background: Default::default(),
gutter_background: Default::default(),
active_line_background: Default::default(),
line_number: Default::default(),
line_number_active: Default::default(),
selection: Default::default(),
guest_selections: Default::default(),
}
}
}
impl InputEditorStyle {
pub fn as_editor(&self) -> EditorStyle {
EditorStyle {