From e52dd6d95f4ad199a0bd6714909eaafde4703063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ng=C3=B4=20Qu=E1=BB=91c=20=C4=90=E1=BA=A1t?= Date: Tue, 31 Mar 2026 14:20:18 +0700 Subject: [PATCH] feat: add Cmd+/Cmd- editor font zoom --- TablePro/TableProApp.swift | 12 ++++++++++++ TablePro/Theme/ThemeEngine.swift | 12 ++++++++++++ docs/features/keyboard-shortcuts.mdx | 7 +++++++ 3 files changed, 31 insertions(+) diff --git a/TablePro/TableProApp.swift b/TablePro/TableProApp.swift index 72fa4a771..2519cc345 100644 --- a/TablePro/TableProApp.swift +++ b/TablePro/TableProApp.swift @@ -393,6 +393,18 @@ struct AppMenuCommands: Commands { } .optionalKeyboardShortcut(shortcut(for: .closeResultTab)) .disabled(!appState.isConnected) + + Divider() + + Button("Zoom In") { + ThemeEngine.shared.adjustEditorFontSize(by: 1) + } + .keyboardShortcut("=", modifiers: .command) + + Button("Zoom Out") { + ThemeEngine.shared.adjustEditorFontSize(by: -1) + } + .keyboardShortcut("-", modifiers: .command) } // Tab navigation shortcuts — native macOS window tabs diff --git a/TablePro/Theme/ThemeEngine.swift b/TablePro/Theme/ThemeEngine.swift index 82b0c3a1f..63dd555f1 100644 --- a/TablePro/Theme/ThemeEngine.swift +++ b/TablePro/Theme/ThemeEngine.swift @@ -199,6 +199,18 @@ internal final class ThemeEngine { availableThemes = ThemeStorage.loadAllThemes() } + // MARK: - Editor Font Size Zoom + + func adjustEditorFontSize(by delta: Int) { + var theme = activeTheme + let newSize = max(9, min(24, theme.fonts.editorFontSize + delta)) + guard newSize != theme.fonts.editorFontSize else { return } + theme.fonts.editorFontSize = newSize + activeTheme = theme + editorFonts = EditorFontCache(from: theme.fonts) + notifyThemeDidChange() + } + // MARK: - Font Cache Reload (accessibility) func reloadFontCaches() { diff --git a/docs/features/keyboard-shortcuts.mdx b/docs/features/keyboard-shortcuts.mdx index 90a17b3a1..7fa4f42d6 100644 --- a/docs/features/keyboard-shortcuts.mdx +++ b/docs/features/keyboard-shortcuts.mdx @@ -190,6 +190,13 @@ TablePro is keyboard-driven. Most actions have shortcuts, and most menu shortcut | Next Result | `Cmd+Opt+]` | | Close Result Tab | `Cmd+Shift+W` | +### Editor Zoom + +| Action | Shortcut | +|--------|----------| +| Zoom In | `Cmd+=` | +| Zoom Out | `Cmd+-` | + ### AI | Action | Shortcut | Description |