WIP
This commit is contained in:
parent
3b01a032ba
commit
6b25841e2a
9 changed files with 25 additions and 18 deletions
|
@ -9379,8 +9379,8 @@ impl Render for Editor {
|
||||||
EditorMode::SingleLine => {
|
EditorMode::SingleLine => {
|
||||||
TextStyle {
|
TextStyle {
|
||||||
color: cx.theme().colors().text,
|
color: cx.theme().colors().text,
|
||||||
font_family: "Zed Sans".into(), // todo!()
|
font_family: settings.ui_font.family.clone(), // todo!()
|
||||||
font_features: FontFeatures::default(),
|
font_features: settings.ui_font.features,
|
||||||
font_size: rems(0.875).into(),
|
font_size: rems(0.875).into(),
|
||||||
font_weight: FontWeight::NORMAL,
|
font_weight: FontWeight::NORMAL,
|
||||||
font_style: FontStyle::Normal,
|
font_style: FontStyle::Normal,
|
||||||
|
|
|
@ -1448,6 +1448,7 @@ impl EditorElement {
|
||||||
|
|
||||||
let snapshot = editor.snapshot(cx);
|
let snapshot = editor.snapshot(cx);
|
||||||
let style = self.style.clone();
|
let style = self.style.clone();
|
||||||
|
|
||||||
dbg!(&style.text.font());
|
dbg!(&style.text.font());
|
||||||
let font_id = cx.text_system().font_id(&style.text.font()).unwrap();
|
let font_id = cx.text_system().font_id(&style.text.font()).unwrap();
|
||||||
let font_size = style.text.font_size.to_pixels(cx.rem_size());
|
let font_size = style.text.font_size.to_pixels(cx.rem_size());
|
||||||
|
|
|
@ -39,11 +39,12 @@ impl FileFinder {
|
||||||
Self::open(workspace, cx);
|
Self::open(workspace, cx);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
file_finder.update(cx, |file_finder, cx| {
|
file_finder.update(cx, |file_finder, cx| {
|
||||||
file_finder
|
file_finder
|
||||||
.picker
|
.picker
|
||||||
.update(cx, |picker, cx| picker.cycle_selection(cx))
|
.update(cx, |picker, cx| picker.cycle_selection(cx))
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
div, Action, AnyView, AnyWindowHandle, AppCell, AppContext, AsyncAppContext,
|
div, Action, AnyView, AnyWindowHandle, AppCell, AppContext, AsyncAppContext,
|
||||||
BackgroundExecutor, Context, Div, EventEmitter, ForegroundExecutor, InputEvent, KeyDownEvent,
|
BackgroundExecutor, Context, Div, EventEmitter, ForegroundExecutor, InputEvent, KeyDownEvent,
|
||||||
Keystroke, Model, ModelContext, Render, Result, Task, TestDispatcher, TestPlatform, TextStyle,
|
Keystroke, Model, ModelContext, Render, Result, Task, TestDispatcher, TestPlatform, View,
|
||||||
View, ViewContext, VisualContext, WindowContext, WindowHandle, WindowOptions,
|
ViewContext, VisualContext, WindowContext, WindowHandle, WindowOptions,
|
||||||
};
|
};
|
||||||
use anyhow::{anyhow, bail};
|
use anyhow::{anyhow, bail};
|
||||||
use futures::{Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
|
@ -83,16 +83,9 @@ impl TestAppContext {
|
||||||
));
|
));
|
||||||
let asset_source = Arc::new(());
|
let asset_source = Arc::new(());
|
||||||
let http_client = util::http::FakeHttpClient::with_404_response();
|
let http_client = util::http::FakeHttpClient::with_404_response();
|
||||||
let cx = AppContext::new(platform, asset_source, http_client);
|
|
||||||
let lock = cx.borrow_mut();
|
|
||||||
lock.push_text_style(crate::TextStyleRefinement {
|
|
||||||
font_family: "Helvetica".into(),
|
|
||||||
..Default::default()
|
|
||||||
});
|
|
||||||
drop(lock);
|
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
app: cx,
|
app: AppContext::new(platform, asset_source, http_client),
|
||||||
background_executor,
|
background_executor,
|
||||||
foreground_executor,
|
foreground_executor,
|
||||||
dispatcher: dispatcher.clone(),
|
dispatcher: dispatcher.clone(),
|
||||||
|
|
|
@ -35,6 +35,7 @@ pub(crate) fn one_dark() -> Theme {
|
||||||
id: "one_dark".to_string(),
|
id: "one_dark".to_string(),
|
||||||
name: "One Dark".into(),
|
name: "One Dark".into(),
|
||||||
appearance: Appearance::Dark,
|
appearance: Appearance::Dark,
|
||||||
|
|
||||||
styles: ThemeStyles {
|
styles: ThemeStyles {
|
||||||
system: SystemColors::default(),
|
system: SystemColors::default(),
|
||||||
colors: ThemeColors {
|
colors: ThemeColors {
|
||||||
|
|
|
@ -19,6 +19,7 @@ const MIN_LINE_HEIGHT: f32 = 1.0;
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ThemeSettings {
|
pub struct ThemeSettings {
|
||||||
pub ui_font_size: Pixels,
|
pub ui_font_size: Pixels,
|
||||||
|
pub ui_font: Font,
|
||||||
pub buffer_font: Font,
|
pub buffer_font: Font,
|
||||||
pub buffer_font_size: Pixels,
|
pub buffer_font_size: Pixels,
|
||||||
pub buffer_line_height: BufferLineHeight,
|
pub buffer_line_height: BufferLineHeight,
|
||||||
|
@ -120,6 +121,12 @@ impl settings::Settings for ThemeSettings {
|
||||||
|
|
||||||
let mut this = Self {
|
let mut this = Self {
|
||||||
ui_font_size: defaults.ui_font_size.unwrap_or(16.).into(),
|
ui_font_size: defaults.ui_font_size.unwrap_or(16.).into(),
|
||||||
|
ui_font: Font {
|
||||||
|
family: "Helvetica".into(),
|
||||||
|
features: Default::default(),
|
||||||
|
weight: Default::default(),
|
||||||
|
style: Default::default(),
|
||||||
|
},
|
||||||
buffer_font: Font {
|
buffer_font: Font {
|
||||||
family: defaults.buffer_font_family.clone().unwrap().into(),
|
family: defaults.buffer_font_family.clone().unwrap().into(),
|
||||||
features: defaults.buffer_font_features.clone().unwrap(),
|
features: defaults.buffer_font_features.clone().unwrap(),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use gpui::{Div, Render};
|
use gpui::{Div, Render};
|
||||||
use theme2::ActiveTheme;
|
use settings2::Settings;
|
||||||
|
use theme2::{ActiveTheme, ThemeSettings};
|
||||||
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use crate::{h_stack, v_stack, KeyBinding, Label, LabelSize, StyledExt, TextColor};
|
use crate::{h_stack, v_stack, KeyBinding, Label, LabelSize, StyledExt, TextColor};
|
||||||
|
@ -34,9 +35,10 @@ impl Render for TextTooltip {
|
||||||
type Element = Div<Self>;
|
type Element = Div<Self>;
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||||
|
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
|
||||||
v_stack()
|
v_stack()
|
||||||
.elevation_2(cx)
|
.elevation_2(cx)
|
||||||
.font("Zed Sans")
|
.font(ui_font)
|
||||||
.text_ui_sm()
|
.text_ui_sm()
|
||||||
.text_color(cx.theme().colors().text)
|
.text_color(cx.theme().colors().text)
|
||||||
.py_1()
|
.py_1()
|
||||||
|
|
|
@ -206,13 +206,14 @@ impl Render for Workspace {
|
||||||
.child(self.editor_1.clone())],
|
.child(self.editor_1.clone())],
|
||||||
SplitDirection::Horizontal,
|
SplitDirection::Horizontal,
|
||||||
);
|
);
|
||||||
|
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.relative()
|
.relative()
|
||||||
.size_full()
|
.size_full()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
.font("Zed Sans")
|
.font(ui_font)
|
||||||
.gap_0()
|
.gap_0()
|
||||||
.justify_start()
|
.justify_start()
|
||||||
.items_start()
|
.items_start()
|
||||||
|
|
|
@ -67,7 +67,7 @@ use std::{
|
||||||
sync::{atomic::AtomicUsize, Arc},
|
sync::{atomic::AtomicUsize, Arc},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
use theme2::ActiveTheme;
|
use theme2::{ActiveTheme, ThemeSettings};
|
||||||
pub use toolbar::{ToolbarItemLocation, ToolbarItemView};
|
pub use toolbar::{ToolbarItemLocation, ToolbarItemView};
|
||||||
use ui::{h_stack, Button, ButtonVariant, KeyBinding, Label, TextColor, TextTooltip};
|
use ui::{h_stack, Button, ButtonVariant, KeyBinding, Label, TextColor, TextTooltip};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
@ -3714,6 +3714,7 @@ impl Render for Workspace {
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||||
let mut context = KeyContext::default();
|
let mut context = KeyContext::default();
|
||||||
context.add("Workspace");
|
context.add("Workspace");
|
||||||
|
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
|
||||||
|
|
||||||
self.add_workspace_actions_listeners(div())
|
self.add_workspace_actions_listeners(div())
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle)
|
||||||
|
@ -3722,7 +3723,7 @@ impl Render for Workspace {
|
||||||
.size_full()
|
.size_full()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
.font("Zed Sans")
|
.font(ui_font)
|
||||||
.gap_0()
|
.gap_0()
|
||||||
.justify_start()
|
.justify_start()
|
||||||
.items_start()
|
.items_start()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue