Merge branch 'main' into theme-improvements

This commit is contained in:
Nate Butler 2022-07-19 20:12:02 -04:00
commit bcc554a3db
76 changed files with 4053 additions and 1557 deletions

View file

@ -79,18 +79,25 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
cx.add_global_action(move |_: &IncreaseBufferFontSize, cx| {
cx.update_global::<Settings, _, _>(|settings, cx| {
settings.buffer_font_size = (settings.buffer_font_size + 1.0).max(MIN_FONT_SIZE);
if let Some(terminal_font_size) = settings.terminal_overrides.font_size.as_mut() {
*terminal_font_size = (*terminal_font_size + 1.0).max(MIN_FONT_SIZE);
}
cx.refresh_windows();
});
});
cx.add_global_action(move |_: &DecreaseBufferFontSize, cx| {
cx.update_global::<Settings, _, _>(|settings, cx| {
settings.buffer_font_size = (settings.buffer_font_size - 1.0).max(MIN_FONT_SIZE);
if let Some(terminal_font_size) = settings.terminal_overrides.font_size.as_mut() {
*terminal_font_size = (*terminal_font_size - 1.0).max(MIN_FONT_SIZE);
}
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;
settings.terminal_overrides.font_size = settings.terminal_defaults.font_size;
cx.refresh_windows();
});
});
@ -102,14 +109,14 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
let app_state = app_state.clone();
move |_: &mut Workspace, _: &OpenSettings, cx: &mut ViewContext<Workspace>| {
open_config_file(&SETTINGS_PATH, app_state.clone(), cx, || {
let header = Assets.load("settings/header-comments.json").unwrap();
let json = Assets.load("settings/default.json").unwrap();
let header = str::from_utf8(header.as_ref()).unwrap();
let json = str::from_utf8(json.as_ref()).unwrap();
let mut content = Rope::new();
content.push(header);
content.push(json);
content
str::from_utf8(
Assets
.load("settings/initial_user_settings.json")
.unwrap()
.as_ref(),
)
.unwrap()
.into()
});
}
});
@ -209,7 +216,7 @@ pub fn initialize_workspace(
cx.emit(workspace::Event::PaneAdded(workspace.active_pane().clone()));
let theme_names = app_state.themes.list().collect();
let language_names = app_state.languages.language_names();
let language_names = &languages::LANGUAGE_NAMES;
workspace.project().update(cx, |project, cx| {
let action_names = cx.all_action_names().collect::<Vec<_>>();