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:
Cole Miller authored and GitHub committed 2026-05-21 22:16:01 +00:00
1 parent f78f6da255
commit da66f95237
7 files changed
+159 -61

No files matched your search

+41 -3
View File
@@ -1,6 +1,6 @@
use crate::branch_picker::{self, BranchList};
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 git::repository::CommitOptions;
@@ -10,6 +10,7 @@ use settings::Settings;
use ui::{
ContextMenu, KeybindingHint, PopoverMenu, PopoverMenuHandle, SplitButton, Tooltip, prelude::*,
};
use zed_actions::{DecreaseBufferFontSize, IncreaseBufferFontSize, ResetBufferFontSize};
use editor::{Editor, EditorElement};
use gpui::*;
@@ -228,8 +229,9 @@ impl CommitModal {
}
}
fn commit_editor_element(&self, window: &mut Window, cx: &mut Context<Self>) -> EditorElement {
let editor_style = panel_editor_style(true, window, cx);
fn commit_editor_element(&self, _window: &mut Window, cx: &mut Context<Self>) -> EditorElement {
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)
}
@@ -533,6 +535,39 @@ impl CommitModal {
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 {
@@ -561,6 +596,9 @@ impl Render for CommitModal {
.on_action(cx.listener(Self::dismiss))
.on_action(cx.listener(Self::on_commit))
.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| {
this.on_action(cx.listener(|this, _: &GenerateCommitMessage, _, cx| {
this.git_panel.update(cx, |panel, cx| {