Add "Reset Zoom" action and application menu item

This commit is contained in:
Max Brunsfeld
2022-05-27 13:06:12 -07:00
parent 4a5317b6e4
commit e1a05d451f
4 changed files with 16 additions and 0 deletions
+4
View File
@@ -164,6 +164,10 @@ pub fn menus() -> Vec<Menu<'static>> {
name: "Zoom Out",
action: Box::new(super::DecreaseBufferFontSize),
},
MenuItem::Action {
name: "Reset Zoom",
action: Box::new(super::ResetBufferFontSize),
},
MenuItem::Separator,
MenuItem::Action {
name: "Project Browser",
+7
View File
@@ -43,6 +43,7 @@ actions!(
OpenKeymap,
IncreaseBufferFontSize,
DecreaseBufferFontSize,
ResetBufferFontSize,
InstallCommandLineInterface,
]
);
@@ -72,6 +73,12 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
cx.refresh_windows();
});
});
cx.add_global_action(move |_: &ResetBufferFontSize, cx| {
cx.update_global::<Settings, _, _>(|settings, cx| {
settings.buffer_font_size = settings.default_buffer_font_size;
cx.refresh_windows();
});
});
cx.add_global_action(move |_: &InstallCommandLineInterface, cx| {
cx.spawn(|cx| async move { install_cli(&cx).await.context("error creating CLI symlink") })
.detach_and_log_err(cx);