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