From a7160ac739ec74169aa063794b02fa7583ece0df Mon Sep 17 00:00:00 2001 From: luah5 Date: Fri, 12 Jan 2024 19:46:19 +0000 Subject: [PATCH 1/2] add menu for font size --- .../WindowCommands/ViewCommands.swift | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/CodeEdit/Features/WindowCommands/ViewCommands.swift b/CodeEdit/Features/WindowCommands/ViewCommands.swift index dc557c77d4..51eac96b44 100644 --- a/CodeEdit/Features/WindowCommands/ViewCommands.swift +++ b/CodeEdit/Features/WindowCommands/ViewCommands.swift @@ -45,26 +45,35 @@ struct ViewCommands: Commands { } .keyboardShortcut("p", modifiers: [.shift, .command]) - Button("Increase font size") { - if !(editorFontSize >= 288) { - editorFontSize += 1 - } - if !(terminalFontSize >= 288) { - terminalFontSize += 1 + Menu("Font Size") { + Button("Increase") { + if !(editorFontSize >= 288) { + editorFontSize += 1 + } + if !(terminalFontSize >= 288) { + terminalFontSize += 1 + } } - } - .keyboardShortcut("+") - .disabled(windowController == nil) + .keyboardShortcut("+") - Button("Decrease font size") { - if !(editorFontSize <= 1) { - editorFontSize -= 1 + Button("Decrease") { + if !(editorFontSize <= 1) { + editorFontSize -= 1 + } + if !(terminalFontSize <= 1) { + terminalFontSize -= 1 + } } - if !(terminalFontSize <= 1) { - terminalFontSize -= 1 + .keyboardShortcut("-") + + Divider() + + Button("Reset") { + editorFontSize = 12 + terminalFontSize = 12 } + .keyboardShortcut("0", modifiers: [.command, .control]) } - .keyboardShortcut("-") .disabled(windowController == nil) Button("Customize Toolbar...") { @@ -149,3 +158,4 @@ extension ViewCommands { } } } +// swiftlint:enable shorthand_operator From a3e445f3587440948848253baca183fcfcd5e74b Mon Sep 17 00:00:00 2001 From: luah5 <128280019+luah5@users.noreply.github.com> Date: Fri, 12 Jan 2024 20:02:29 +0000 Subject: [PATCH 2/2] fix swiftlint --- CodeEdit/Features/WindowCommands/ViewCommands.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/CodeEdit/Features/WindowCommands/ViewCommands.swift b/CodeEdit/Features/WindowCommands/ViewCommands.swift index 51eac96b44..685c5360eb 100644 --- a/CodeEdit/Features/WindowCommands/ViewCommands.swift +++ b/CodeEdit/Features/WindowCommands/ViewCommands.swift @@ -158,4 +158,3 @@ extension ViewCommands { } } } -// swiftlint:enable shorthand_operator