mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
Make the commit editor's font size independently configurable (#56077)
- Add a separate `git_commit_buffer_font_size` setting, defaulting to `12px` (the previous default before it was changed to use the buffer font size) - Add in-memory buffer font size overrides for zooming the commit modal and in-panel editor Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Added a `git_commit_buffer_font_size` setting and made the in-panel and modal commit message editors zoomable.
This commit is contained in:
parent
f78f6da255
commit
da66f95237
7 changed files with 159 additions and 61 deletions
|
|
@ -71,6 +71,8 @@
|
||||||
"agent_ui_font_size": null,
|
"agent_ui_font_size": null,
|
||||||
// The default font size for user messages in the agent panel.
|
// The default font size for user messages in the agent panel.
|
||||||
"agent_buffer_font_size": 12,
|
"agent_buffer_font_size": 12,
|
||||||
|
// The default font size for the commit editor in the git panel and commit modal.
|
||||||
|
"git_commit_buffer_font_size": 12,
|
||||||
// How much to fade out unused code.
|
// How much to fade out unused code.
|
||||||
"unnecessary_code_fade": 0.3,
|
"unnecessary_code_fade": 0.3,
|
||||||
// Active pane styling settings.
|
// Active pane styling settings.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::branch_picker::{self, BranchList};
|
use crate::branch_picker::{self, BranchList};
|
||||||
use crate::git_panel::{
|
use crate::git_panel::{
|
||||||
GitPanel, commit_message_editor, commit_title_exceeds_limit, panel_editor_style,
|
GitPanel, commit_message_editor, commit_title_exceeds_limit, git_commit_editor_style,
|
||||||
};
|
};
|
||||||
use crate::git_panel_settings::GitPanelSettings;
|
use crate::git_panel_settings::GitPanelSettings;
|
||||||
use git::repository::CommitOptions;
|
use git::repository::CommitOptions;
|
||||||
|
|
@ -10,6 +10,7 @@ use settings::Settings;
|
||||||
use ui::{
|
use ui::{
|
||||||
ContextMenu, KeybindingHint, PopoverMenu, PopoverMenuHandle, SplitButton, Tooltip, prelude::*,
|
ContextMenu, KeybindingHint, PopoverMenu, PopoverMenuHandle, SplitButton, Tooltip, prelude::*,
|
||||||
};
|
};
|
||||||
|
use zed_actions::{DecreaseBufferFontSize, IncreaseBufferFontSize, ResetBufferFontSize};
|
||||||
|
|
||||||
use editor::{Editor, EditorElement};
|
use editor::{Editor, EditorElement};
|
||||||
use gpui::*;
|
use gpui::*;
|
||||||
|
|
@ -228,8 +229,9 @@ impl CommitModal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn commit_editor_element(&self, window: &mut Window, cx: &mut Context<Self>) -> EditorElement {
|
fn commit_editor_element(&self, _window: &mut Window, cx: &mut Context<Self>) -> EditorElement {
|
||||||
let editor_style = panel_editor_style(true, window, cx);
|
let settings = theme_settings::ThemeSettings::get_global(cx);
|
||||||
|
let editor_style = git_commit_editor_style(settings.git_commit_buffer_font_size(cx), cx);
|
||||||
EditorElement::new(&self.commit_editor, editor_style)
|
EditorElement::new(&self.commit_editor, editor_style)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -533,6 +535,39 @@ impl CommitModal {
|
||||||
self.branch_list_handle.toggle(window, cx);
|
self.branch_list_handle.toggle(window, cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn increase_font_size(
|
||||||
|
&mut self,
|
||||||
|
action: &IncreaseBufferFontSize,
|
||||||
|
window: &mut Window,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
self.git_panel.update(cx, |git_panel, cx| {
|
||||||
|
git_panel.increase_font_size(action, window, cx);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn decrease_font_size(
|
||||||
|
&mut self,
|
||||||
|
action: &DecreaseBufferFontSize,
|
||||||
|
window: &mut Window,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
self.git_panel.update(cx, |git_panel, cx| {
|
||||||
|
git_panel.decrease_font_size(action, window, cx);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn reset_font_size(
|
||||||
|
&mut self,
|
||||||
|
action: &ResetBufferFontSize,
|
||||||
|
window: &mut Window,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
self.git_panel.update(cx, |git_panel, cx| {
|
||||||
|
git_panel.reset_font_size(action, window, cx);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for CommitModal {
|
impl Render for CommitModal {
|
||||||
|
|
@ -561,6 +596,9 @@ impl Render for CommitModal {
|
||||||
.on_action(cx.listener(Self::dismiss))
|
.on_action(cx.listener(Self::dismiss))
|
||||||
.on_action(cx.listener(Self::on_commit))
|
.on_action(cx.listener(Self::on_commit))
|
||||||
.on_action(cx.listener(Self::on_amend))
|
.on_action(cx.listener(Self::on_amend))
|
||||||
|
.on_action(cx.listener(Self::increase_font_size))
|
||||||
|
.on_action(cx.listener(Self::decrease_font_size))
|
||||||
|
.on_action(cx.listener(Self::reset_font_size))
|
||||||
.when(!DisableAiSettings::get_global(cx).disable_ai, |this| {
|
.when(!DisableAiSettings::get_global(cx).disable_ai, |this| {
|
||||||
this.on_action(cx.listener(|this, _: &GenerateCommitMessage, _, cx| {
|
this.on_action(cx.listener(|this, _: &GenerateCommitMessage, _, cx| {
|
||||||
this.git_panel.update(cx, |panel, cx| {
|
this.git_panel.update(cx, |panel, cx| {
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ use project::{
|
||||||
use prompt_store::{BuiltInPrompt, PromptId, PromptStore, RULES_FILE_NAMES};
|
use prompt_store::{BuiltInPrompt, PromptId, PromptStore, RULES_FILE_NAMES};
|
||||||
use proto::RpcError;
|
use proto::RpcError;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use settings::{Settings, SettingsStore, StatusStyle};
|
use settings::{Settings, SettingsStore, StatusStyle, update_settings_file};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
@ -87,6 +87,7 @@ use workspace::{
|
||||||
dock::{DockPosition, Panel, PanelEvent},
|
dock::{DockPosition, Panel, PanelEvent},
|
||||||
notifications::{DetachAndPromptErr, ErrorMessagePrompt, NotificationId, NotifyResultExt},
|
notifications::{DetachAndPromptErr, ErrorMessagePrompt, NotificationId, NotifyResultExt},
|
||||||
};
|
};
|
||||||
|
use zed_actions::{DecreaseBufferFontSize, IncreaseBufferFontSize, ResetBufferFontSize};
|
||||||
|
|
||||||
actions!(
|
actions!(
|
||||||
git_panel,
|
git_panel,
|
||||||
|
|
@ -3456,6 +3457,54 @@ impl GitPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn increase_font_size(
|
||||||
|
&mut self,
|
||||||
|
action: &IncreaseBufferFontSize,
|
||||||
|
_: &mut Window,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
self.handle_font_size_action(action.persist, px(1.0), cx);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn decrease_font_size(
|
||||||
|
&mut self,
|
||||||
|
action: &DecreaseBufferFontSize,
|
||||||
|
_: &mut Window,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
self.handle_font_size_action(action.persist, px(-1.0), cx);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_font_size_action(&mut self, persist: bool, delta: Pixels, cx: &mut Context<Self>) {
|
||||||
|
if persist {
|
||||||
|
update_settings_file(self.fs.clone(), cx, move |settings, cx| {
|
||||||
|
let git_commit_buffer_font_size =
|
||||||
|
ThemeSettings::get_global(cx).git_commit_buffer_font_size(cx) + delta;
|
||||||
|
|
||||||
|
let _ = settings.theme.git_commit_buffer_font_size.insert(
|
||||||
|
f32::from(theme_settings::clamp_font_size(git_commit_buffer_font_size)).into(),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
theme_settings::adjust_git_commit_buffer_font_size(cx, |size| size + delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn reset_font_size(
|
||||||
|
&mut self,
|
||||||
|
action: &ResetBufferFontSize,
|
||||||
|
_: &mut Window,
|
||||||
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
if action.persist {
|
||||||
|
update_settings_file(self.fs.clone(), cx, move |settings, _| {
|
||||||
|
settings.theme.git_commit_buffer_font_size = None;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
theme_settings::reset_git_commit_buffer_font_size(cx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn toggle_directory(&mut self, key: &TreeKey, window: &mut Window, cx: &mut Context<Self>) {
|
fn toggle_directory(&mut self, key: &TreeKey, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
if let Some(state) = self.view_mode.tree_state_mut() {
|
if let Some(state) = self.view_mode.tree_state_mut() {
|
||||||
let expanded = state.expanded_dirs.entry(key.clone()).or_insert(true);
|
let expanded = state.expanded_dirs.entry(key.clone()).or_insert(true);
|
||||||
|
|
@ -4555,7 +4604,9 @@ impl GitPanel {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Option<impl IntoElement> {
|
) -> Option<impl IntoElement> {
|
||||||
let active_repository = self.active_repository.clone()?;
|
let active_repository = self.active_repository.clone()?;
|
||||||
let panel_editor_style = panel_editor_style(true, window, cx);
|
let settings = ThemeSettings::get_global(cx);
|
||||||
|
let panel_editor_style =
|
||||||
|
git_commit_editor_style(settings.git_commit_buffer_font_size(cx), cx);
|
||||||
let enable_coauthors = self.render_co_authors(cx);
|
let enable_coauthors = self.render_co_authors(cx);
|
||||||
let editor_focus_handle = self.commit_editor.focus_handle(cx);
|
let editor_focus_handle = self.commit_editor.focus_handle(cx);
|
||||||
let branch = active_repository.read(cx).branch.clone();
|
let branch = active_repository.read(cx).branch.clone();
|
||||||
|
|
@ -6626,6 +6677,9 @@ impl Render for GitPanel {
|
||||||
})
|
})
|
||||||
.on_action(cx.listener(Self::toggle_sort_by_path))
|
.on_action(cx.listener(Self::toggle_sort_by_path))
|
||||||
.on_action(cx.listener(Self::toggle_tree_view))
|
.on_action(cx.listener(Self::toggle_tree_view))
|
||||||
|
.on_action(cx.listener(Self::increase_font_size))
|
||||||
|
.on_action(cx.listener(Self::decrease_font_size))
|
||||||
|
.on_action(cx.listener(Self::reset_font_size))
|
||||||
.on_action(cx.listener(Self::activate_changes_tab))
|
.on_action(cx.listener(Self::activate_changes_tab))
|
||||||
.on_action(cx.listener(Self::activate_history_tab))
|
.on_action(cx.listener(Self::activate_history_tab))
|
||||||
.size_full()
|
.size_full()
|
||||||
|
|
@ -6790,42 +6844,20 @@ pub fn panel_editor_container(_window: &mut Window, cx: &mut App) -> Div {
|
||||||
.bg(cx.theme().colors().editor_background)
|
.bg(cx.theme().colors().editor_background)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn panel_editor_style(monospace: bool, window: &Window, cx: &App) -> EditorStyle {
|
pub(crate) fn git_commit_editor_style(font_size: gpui::Pixels, cx: &App) -> EditorStyle {
|
||||||
let settings = ThemeSettings::get_global(cx);
|
let settings = ThemeSettings::get_global(cx);
|
||||||
|
|
||||||
let (font_family, font_fallbacks, font_features, font_size, font_weight, line_height) =
|
|
||||||
if monospace {
|
|
||||||
let font_size = settings.buffer_font_size(cx);
|
|
||||||
(
|
|
||||||
settings.buffer_font.family.clone(),
|
|
||||||
settings.buffer_font.fallbacks.clone(),
|
|
||||||
settings.buffer_font.features.clone(),
|
|
||||||
AbsoluteLength::from(font_size),
|
|
||||||
settings.buffer_font.weight,
|
|
||||||
font_size * settings.buffer_line_height.value(),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
(
|
|
||||||
settings.ui_font.family.clone(),
|
|
||||||
settings.ui_font.fallbacks.clone(),
|
|
||||||
settings.ui_font.features.clone(),
|
|
||||||
AbsoluteLength::from(TextSize::Small.rems(cx)),
|
|
||||||
settings.ui_font.weight,
|
|
||||||
window.line_height(),
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
EditorStyle {
|
EditorStyle {
|
||||||
background: cx.theme().colors().editor_background,
|
background: cx.theme().colors().editor_background,
|
||||||
local_player: cx.theme().players().local(),
|
local_player: cx.theme().players().local(),
|
||||||
text: TextStyle {
|
text: TextStyle {
|
||||||
color: cx.theme().colors().text,
|
color: cx.theme().colors().text,
|
||||||
font_family,
|
font_family: settings.buffer_font.family.clone(),
|
||||||
font_fallbacks,
|
font_fallbacks: settings.buffer_font.fallbacks.clone(),
|
||||||
font_features,
|
font_features: settings.buffer_font.features.clone(),
|
||||||
font_size,
|
font_size: AbsoluteLength::from(font_size),
|
||||||
font_weight,
|
font_weight: settings.buffer_font.weight,
|
||||||
line_height: line_height.into(),
|
line_height: (font_size * settings.buffer_line_height.value()).into(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
syntax: cx.theme().syntax().clone(),
|
syntax: cx.theme().syntax().clone(),
|
||||||
|
|
@ -9150,25 +9182,4 @@ mod tests {
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[gpui::test]
|
|
||||||
async fn test_panel_editor_style_uses_buffer_font_size(cx: &mut TestAppContext) {
|
|
||||||
init_test(cx);
|
|
||||||
|
|
||||||
cx.update(|cx| {
|
|
||||||
SettingsStore::update_global(cx, |store, cx| {
|
|
||||||
store.update_user_settings(cx, |settings| {
|
|
||||||
settings.theme.buffer_font_size = Some(20.0.into());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
cx.add_window(|window, cx| {
|
|
||||||
let style = panel_editor_style(true, window, cx);
|
|
||||||
|
|
||||||
assert_eq!(style.text.font_size.to_pixels(window.rem_size()), px(20.0));
|
|
||||||
|
|
||||||
Editor::single_line(window, cx)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -977,6 +977,7 @@ impl VsCodeSettings {
|
||||||
buffer_font_features: None,
|
buffer_font_features: None,
|
||||||
agent_ui_font_size: None,
|
agent_ui_font_size: None,
|
||||||
agent_buffer_font_size: None,
|
agent_buffer_font_size: None,
|
||||||
|
git_commit_buffer_font_size: None,
|
||||||
markdown_preview_font_family: None,
|
markdown_preview_font_family: None,
|
||||||
markdown_preview_code_font_family: None,
|
markdown_preview_code_font_family: None,
|
||||||
markdown_preview_theme: None,
|
markdown_preview_theme: None,
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,7 @@ pub struct ThemeSettingsContent {
|
||||||
pub agent_ui_font_size: Option<FontSize>,
|
pub agent_ui_font_size: Option<FontSize>,
|
||||||
/// The font size for user messages in the agent panel.
|
/// The font size for user messages in the agent panel.
|
||||||
pub agent_buffer_font_size: Option<FontSize>,
|
pub agent_buffer_font_size: Option<FontSize>,
|
||||||
|
pub git_commit_buffer_font_size: Option<FontSize>,
|
||||||
/// The name of a font to use for rendering in the markdown preview.
|
/// The name of a font to use for rendering in the markdown preview.
|
||||||
/// Falls back to the UI font if unset.
|
/// Falls back to the UI font if unset.
|
||||||
pub markdown_preview_font_family: Option<FontFamilyName>,
|
pub markdown_preview_font_family: Option<FontFamilyName>,
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ pub struct ThemeSettings {
|
||||||
agent_ui_font_size: Option<Pixels>,
|
agent_ui_font_size: Option<Pixels>,
|
||||||
/// The agent buffer font size. Determines the size of user messages in the agent panel.
|
/// The agent buffer font size. Determines the size of user messages in the agent panel.
|
||||||
agent_buffer_font_size: Option<Pixels>,
|
agent_buffer_font_size: Option<Pixels>,
|
||||||
|
git_commit_buffer_font_size: Option<Pixels>,
|
||||||
/// The font family to use for rendering in the markdown preview.
|
/// The font family to use for rendering in the markdown preview.
|
||||||
/// Falls back to the UI font family if unset.
|
/// Falls back to the UI font family if unset.
|
||||||
markdown_preview_font_family: Option<SharedString>,
|
markdown_preview_font_family: Option<SharedString>,
|
||||||
|
|
@ -118,6 +119,11 @@ pub struct AgentBufferFontSize(Pixels);
|
||||||
|
|
||||||
impl Global for AgentBufferFontSize {}
|
impl Global for AgentBufferFontSize {}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct GitCommitBufferFontSize(Pixels);
|
||||||
|
|
||||||
|
impl Global for GitCommitBufferFontSize {}
|
||||||
|
|
||||||
/// Represents the selection of a theme, which can be either static or dynamic.
|
/// Represents the selection of a theme, which can be either static or dynamic.
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
|
|
@ -410,6 +416,14 @@ impl ThemeSettings {
|
||||||
.unwrap_or_else(|| self.buffer_font_size(cx))
|
.unwrap_or_else(|| self.buffer_font_size(cx))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn git_commit_buffer_font_size(&self, cx: &App) -> Pixels {
|
||||||
|
cx.try_global::<GitCommitBufferFontSize>()
|
||||||
|
.map(|size| size.0)
|
||||||
|
.or(self.git_commit_buffer_font_size)
|
||||||
|
.map(clamp_font_size)
|
||||||
|
.unwrap_or_else(|| self.buffer_font_size(cx))
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the font family to use in the markdown preview,
|
/// Returns the font family to use in the markdown preview,
|
||||||
/// falling back to the UI font family when unset.
|
/// falling back to the UI font family when unset.
|
||||||
pub fn markdown_preview_font_family(&self) -> &SharedString {
|
pub fn markdown_preview_font_family(&self) -> &SharedString {
|
||||||
|
|
@ -458,6 +472,10 @@ impl ThemeSettings {
|
||||||
self.agent_buffer_font_size
|
self.agent_buffer_font_size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn git_commit_buffer_font_size_settings(&self) -> Option<Pixels> {
|
||||||
|
self.git_commit_buffer_font_size
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the buffer's line height.
|
/// Returns the buffer's line height.
|
||||||
pub fn line_height(&self) -> f32 {
|
pub fn line_height(&self) -> f32 {
|
||||||
f32::max(self.buffer_line_height.value(), MIN_LINE_HEIGHT)
|
f32::max(self.buffer_line_height.value(), MIN_LINE_HEIGHT)
|
||||||
|
|
@ -609,6 +627,22 @@ pub fn reset_agent_buffer_font_size(cx: &mut App) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn adjust_git_commit_buffer_font_size(cx: &mut App, f: impl FnOnce(Pixels) -> Pixels) {
|
||||||
|
let git_commit_buffer_font_size = ThemeSettings::get_global(cx).git_commit_buffer_font_size(cx);
|
||||||
|
let adjusted_size = cx
|
||||||
|
.try_global::<GitCommitBufferFontSize>()
|
||||||
|
.map_or(git_commit_buffer_font_size, |adjusted_size| adjusted_size.0);
|
||||||
|
cx.set_global(GitCommitBufferFontSize(clamp_font_size(f(adjusted_size))));
|
||||||
|
cx.refresh_windows();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reset_git_commit_buffer_font_size(cx: &mut App) {
|
||||||
|
if cx.has_global::<GitCommitBufferFontSize>() {
|
||||||
|
cx.remove_global::<GitCommitBufferFontSize>();
|
||||||
|
cx.refresh_windows();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Ensures font size is within the valid range.
|
/// Ensures font size is within the valid range.
|
||||||
pub fn clamp_font_size(size: Pixels) -> Pixels {
|
pub fn clamp_font_size(size: Pixels) -> Pixels {
|
||||||
size.clamp(MIN_FONT_SIZE, MAX_FONT_SIZE)
|
size.clamp(MIN_FONT_SIZE, MAX_FONT_SIZE)
|
||||||
|
|
@ -658,6 +692,7 @@ impl settings::Settings for ThemeSettings {
|
||||||
buffer_line_height: content.buffer_line_height.unwrap().into(),
|
buffer_line_height: content.buffer_line_height.unwrap().into(),
|
||||||
agent_ui_font_size: content.agent_ui_font_size.map(|s| s.into_gpui()),
|
agent_ui_font_size: content.agent_ui_font_size.map(|s| s.into_gpui()),
|
||||||
agent_buffer_font_size: content.agent_buffer_font_size.map(|s| s.into_gpui()),
|
agent_buffer_font_size: content.agent_buffer_font_size.map(|s| s.into_gpui()),
|
||||||
|
git_commit_buffer_font_size: content.git_commit_buffer_font_size.map(|s| s.into_gpui()),
|
||||||
markdown_preview_font_family: content
|
markdown_preview_font_family: content
|
||||||
.markdown_preview_font_family
|
.markdown_preview_font_family
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,14 @@ pub use crate::schema::{
|
||||||
};
|
};
|
||||||
use crate::settings::adjust_buffer_font_size;
|
use crate::settings::adjust_buffer_font_size;
|
||||||
pub use crate::settings::{
|
pub use crate::settings::{
|
||||||
AgentBufferFontSize, AgentUiFontSize, BufferLineHeight, FontFamilyName, IconThemeName,
|
AgentBufferFontSize, AgentUiFontSize, BufferLineHeight, FontFamilyName,
|
||||||
IconThemeSelection, ThemeAppearanceMode, ThemeName, ThemeSelection, ThemeSettings,
|
GitCommitBufferFontSize, IconThemeName, IconThemeSelection, ThemeAppearanceMode, ThemeName,
|
||||||
adjust_agent_buffer_font_size, adjust_agent_ui_font_size, adjust_ui_font_size,
|
ThemeSelection, ThemeSettings, adjust_agent_buffer_font_size, adjust_agent_ui_font_size,
|
||||||
adjusted_font_size, appearance_to_mode, clamp_font_size, default_theme,
|
adjust_git_commit_buffer_font_size, adjust_ui_font_size, adjusted_font_size,
|
||||||
observe_buffer_font_size_adjustment, reset_agent_buffer_font_size, reset_agent_ui_font_size,
|
appearance_to_mode, clamp_font_size, default_theme, observe_buffer_font_size_adjustment,
|
||||||
reset_buffer_font_size, reset_ui_font_size, set_icon_theme, set_mode, set_theme, setup_ui_font,
|
reset_agent_buffer_font_size, reset_agent_ui_font_size, reset_buffer_font_size,
|
||||||
|
reset_git_commit_buffer_font_size, reset_ui_font_size, set_icon_theme, set_mode, set_theme,
|
||||||
|
setup_ui_font,
|
||||||
};
|
};
|
||||||
pub use theme::UiDensity;
|
pub use theme::UiDensity;
|
||||||
|
|
||||||
|
|
@ -87,6 +89,8 @@ pub fn init(themes_to_load: LoadThemes, cx: &mut App) {
|
||||||
let mut prev_ui_font_size_settings = settings.ui_font_size_settings();
|
let mut prev_ui_font_size_settings = settings.ui_font_size_settings();
|
||||||
let mut prev_agent_ui_font_size_settings = settings.agent_ui_font_size_settings();
|
let mut prev_agent_ui_font_size_settings = settings.agent_ui_font_size_settings();
|
||||||
let mut prev_agent_buffer_font_size_settings = settings.agent_buffer_font_size_settings();
|
let mut prev_agent_buffer_font_size_settings = settings.agent_buffer_font_size_settings();
|
||||||
|
let mut prev_git_commit_buffer_font_size_settings =
|
||||||
|
settings.git_commit_buffer_font_size_settings();
|
||||||
let mut prev_theme_name = settings.theme.name(SystemAppearance::global(cx).0);
|
let mut prev_theme_name = settings.theme.name(SystemAppearance::global(cx).0);
|
||||||
let mut prev_icon_theme_name = settings.icon_theme.name(SystemAppearance::global(cx).0);
|
let mut prev_icon_theme_name = settings.icon_theme.name(SystemAppearance::global(cx).0);
|
||||||
let mut prev_theme_overrides = (
|
let mut prev_theme_overrides = (
|
||||||
|
|
@ -101,6 +105,7 @@ pub fn init(themes_to_load: LoadThemes, cx: &mut App) {
|
||||||
let ui_font_size_settings = settings.ui_font_size_settings();
|
let ui_font_size_settings = settings.ui_font_size_settings();
|
||||||
let agent_ui_font_size_settings = settings.agent_ui_font_size_settings();
|
let agent_ui_font_size_settings = settings.agent_ui_font_size_settings();
|
||||||
let agent_buffer_font_size_settings = settings.agent_buffer_font_size_settings();
|
let agent_buffer_font_size_settings = settings.agent_buffer_font_size_settings();
|
||||||
|
let git_commit_buffer_font_size_settings = settings.git_commit_buffer_font_size_settings();
|
||||||
let theme_name = settings.theme.name(SystemAppearance::global(cx).0);
|
let theme_name = settings.theme.name(SystemAppearance::global(cx).0);
|
||||||
let icon_theme_name = settings.icon_theme.name(SystemAppearance::global(cx).0);
|
let icon_theme_name = settings.icon_theme.name(SystemAppearance::global(cx).0);
|
||||||
let theme_overrides = (
|
let theme_overrides = (
|
||||||
|
|
@ -128,6 +133,11 @@ pub fn init(themes_to_load: LoadThemes, cx: &mut App) {
|
||||||
reset_agent_buffer_font_size(cx);
|
reset_agent_buffer_font_size(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if git_commit_buffer_font_size_settings != prev_git_commit_buffer_font_size_settings {
|
||||||
|
prev_git_commit_buffer_font_size_settings = git_commit_buffer_font_size_settings;
|
||||||
|
reset_git_commit_buffer_font_size(cx);
|
||||||
|
}
|
||||||
|
|
||||||
if theme_name != prev_theme_name || theme_overrides != prev_theme_overrides {
|
if theme_name != prev_theme_name || theme_overrides != prev_theme_overrides {
|
||||||
prev_theme_name = theme_name;
|
prev_theme_name = theme_name;
|
||||||
prev_theme_overrides = theme_overrides;
|
prev_theme_overrides = theme_overrides;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue