From 22f6d6e7f306c2b546e2afac623608a3d4cdf773 Mon Sep 17 00:00:00 2001 From: luah5 <128280019+luah5@users.noreply.github.com> Date: Wed, 22 Mar 2023 21:15:33 +0000 Subject: [PATCH 1/2] Add zooming in shortcut and disable customize toolbar button --- .../Features/WindowCommands/ViewCommands.swift | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CodeEdit/Features/WindowCommands/ViewCommands.swift b/CodeEdit/Features/WindowCommands/ViewCommands.swift index 44e44b2b16..4867a33f06 100644 --- a/CodeEdit/Features/WindowCommands/ViewCommands.swift +++ b/CodeEdit/Features/WindowCommands/ViewCommands.swift @@ -8,16 +8,31 @@ import SwiftUI struct ViewCommands: Commands { + private var prefs: AppPreferencesModel = .shared + var body: some Commands { CommandGroup(after: .toolbar) { Button("Show Command Palette") { NSApp.sendAction(#selector(CodeEditWindowController.openCommandPalette(_:)), to: nil, from: nil) } - .keyboardShortcut("p", modifiers: [.shift, .command]) + .keyboardShortcut("p") + + Button("Zoom in") { + prefs.preferences.textEditing.font.size += 1 + } + .keyboardShortcut("+") + + Button("Zoom out") { + if !(prefs.preferences.textEditing.font.size <= 1) { + prefs.preferences.textEditing.font.size -= 1 + } + } + .keyboardShortcut("-") Button("Customize Toolbar...") { } + .disabled(true) } } } From 38c79cfeabce9b113aaa99d2aeda28ae10c8450e Mon Sep 17 00:00:00 2001 From: luah5 <128280019+luah5@users.noreply.github.com> Date: Thu, 23 Mar 2023 06:16:24 +0000 Subject: [PATCH 2/2] Revert a change --- CodeEdit/Features/WindowCommands/ViewCommands.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CodeEdit/Features/WindowCommands/ViewCommands.swift b/CodeEdit/Features/WindowCommands/ViewCommands.swift index 4867a33f06..4990319ff4 100644 --- a/CodeEdit/Features/WindowCommands/ViewCommands.swift +++ b/CodeEdit/Features/WindowCommands/ViewCommands.swift @@ -15,7 +15,7 @@ struct ViewCommands: Commands { Button("Show Command Palette") { NSApp.sendAction(#selector(CodeEditWindowController.openCommandPalette(_:)), to: nil, from: nil) } - .keyboardShortcut("p") + .keyboardShortcut("p", modifiers: [.shift, .command]) Button("Zoom in") { prefs.preferences.textEditing.font.size += 1