diff --git a/src/cm/commandRegistry.js b/src/cm/commandRegistry.js index 01838010f..498d09d26 100644 --- a/src/cm/commandRegistry.js +++ b/src/cm/commandRegistry.js @@ -503,17 +503,31 @@ function registerCoreCommands() { return true; }, }); + addCommand({ + name: "increaseUiZoom", + description: "Increase UI zoom", + readOnly: true, + requiresView: false, + run: () => adjustUiZoom(10), + }); + addCommand({ + name: "decreaseUiZoom", + description: "Decrease UI zoom", + readOnly: true, + requiresView: false, + run: () => adjustUiZoom(-10), + }); addCommand({ name: "increaseFontSize", - description: "Increase font size", - readOnly: false, + description: "Increase editor font size", + readOnly: true, requiresView: false, run: () => adjustFontSize(1), }); addCommand({ name: "decreaseFontSize", - description: "Decrease font size", - readOnly: false, + description: "Decrease editor font size", + readOnly: true, requiresView: false, run: () => adjustFontSize(-1), }); @@ -1307,12 +1321,20 @@ async function openInAppBrowserCommand() { function adjustFontSize(delta) { const current = settings?.value?.fontSize || "12px"; const numeric = Number.parseInt(current, 10) || 12; - const next = Math.max(1, numeric + delta); + const next = Math.min(72, Math.max(6, numeric + delta)); settings.value.fontSize = `${next}px`; settings.update(false); return true; } +function adjustUiZoom(delta) { + const current = Number(settings?.value?.uiZoom) || 100; + const next = Math.min(160, Math.max(70, current + delta)); + settings.value.uiZoom = next; + settings.update(false); + return true; +} + function parseKeyString(keyString) { if (!keyString) return []; return String(keyString) @@ -1356,10 +1378,12 @@ function buildResolvedKeyBindingsSnapshot() { function toCodeMirrorKey(combo) { if (!combo) return null; - const parts = combo - .split("-") - .map((part) => part.trim()) - .filter(Boolean); + const parts = combo.endsWith("-") + ? [...combo.slice(0, -1).split("-").filter(Boolean), "-"] + : combo + .split("-") + .map((part) => part.trim()) + .filter(Boolean); const modifiers = []; let key = null; diff --git a/src/components/terminal/terminal.js b/src/components/terminal/terminal.js index 2ebf7d50b..6a043c85b 100644 --- a/src/components/terminal/terminal.js +++ b/src/components/terminal/terminal.js @@ -12,6 +12,7 @@ import { WebLinksAddon } from "@xterm/addon-web-links"; import { WebglAddon } from "@xterm/addon-webgl"; import { Terminal as Xterm } from "@xterm/xterm"; import { + executeCommand, getResolvedKeyBindings, getResolvedKeyBindingsVersion, } from "cm/commandRegistry"; @@ -347,7 +348,7 @@ export default class TerminalComponent { const parsedBindings = []; - Object.values(getResolvedKeyBindings()).forEach((binding) => { + Object.entries(getResolvedKeyBindings()).forEach(([name, binding]) => { if (!binding.key) return; // Skip editor-only keybindings in terminal @@ -357,8 +358,11 @@ export default class TerminalComponent { const keys = binding.key.split("|"); keys.forEach((keyCombo) => { - const parts = keyCombo.split("-"); + const parts = keyCombo.endsWith("-") + ? [...keyCombo.slice(0, -1).split("-").filter(Boolean), "-"] + : keyCombo.split("-"); const parsed = { + name, ctrl: false, shift: false, alt: false, @@ -414,62 +418,54 @@ export default class TerminalComponent { return false; } - // Check for Ctrl+= or Ctrl++ (increase font size) - if (event.ctrlKey && (event.key === "+" || event.key === "=")) { + // Keep terminal font zoom local. Shift variants are handled by app keybindings below. + if ( + event.ctrlKey && + !event.shiftKey && + !event.altKey && + !event.metaKey && + (event.key === "+" || event.key === "=") + ) { event.preventDefault(); this.increaseFontSize(); return false; } - // Check for Ctrl+- (decrease font size) - if (event.ctrlKey && event.key === "-") { + if ( + event.ctrlKey && + !event.shiftKey && + !event.altKey && + !event.metaKey && + event.key === "-" + ) { event.preventDefault(); this.decreaseFontSize(); return false; } - // Only intercept specific app-wide keybindings, let terminal handle the rest if (event.ctrlKey || event.altKey || event.metaKey) { - // Skip modifier-only keys if (["Control", "Alt", "Meta", "Shift"].includes(event.key)) { return true; } - // Get parsed app keybindings const appKeybindings = this.parseAppKeybindings(); - - // Check if this is an app-specific keybinding - const isAppKeybinding = appKeybindings.some( + const eventKey = event.key === "_" ? "-" : event.key.toLowerCase(); + const binding = appKeybindings.find( (binding) => binding.ctrl === event.ctrlKey && binding.shift === event.shiftKey && binding.alt === event.altKey && binding.meta === event.metaKey && - binding.key === event.key.toLowerCase(), + binding.key === eventKey, ); - if (isAppKeybinding) { - const appEvent = new KeyboardEvent("keydown", { - key: event.key, - ctrlKey: event.ctrlKey, - shiftKey: event.shiftKey, - altKey: event.altKey, - metaKey: event.metaKey, - bubbles: true, - cancelable: true, - }); - - // Dispatch to document so it gets picked up by the app's keyboard handler - document.dispatchEvent(appEvent); - - // Return false to prevent terminal from processing this key + if (binding && executeCommand(binding.name)) { return false; } - - // For all other modifier combinations, let the terminal handle them - return true; } + if (event.ctrlKey || event.altKey || event.metaKey) return true; + // Return true to allow normal processing for other keys return true; }); diff --git a/src/lang/ar-ye.json b/src/lang/ar-ye.json index 61e2c75f3..badff67b7 100644 --- a/src/lang/ar-ye.json +++ b/src/lang/ar-ye.json @@ -723,5 +723,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/be-by.json b/src/lang/be-by.json index b55a36f8a..c70f7c03c 100644 --- a/src/lang/be-by.json +++ b/src/lang/be-by.json @@ -725,5 +725,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/bn-bd.json b/src/lang/bn-bd.json index c47372ce4..b4f677755 100644 --- a/src/lang/bn-bd.json +++ b/src/lang/bn-bd.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/cs-cz.json b/src/lang/cs-cz.json index bd85b2d23..c2459c344 100644 --- a/src/lang/cs-cz.json +++ b/src/lang/cs-cz.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/de-de.json b/src/lang/de-de.json index 649cb5bcc..de439f5a5 100644 --- a/src/lang/de-de.json +++ b/src/lang/de-de.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/en-us.json b/src/lang/en-us.json index 7afdbe784..431fcfa97 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -88,6 +88,7 @@ "tab size": "Tab size", "text wrap": "Text wrap / Word wrap", "theme": "Theme", + "ui zoom": "UI zoom", "unable to delete file": "unable to delete file", "unable to open file": "Sorry, unable to open file", "unable to open folder": "Sorry, unable to open folder", @@ -650,6 +651,7 @@ "settings-info-app-side-buttons": "Show extra action buttons beside the editor.", "settings-info-app-sponsor-sidebar": "Show the sponsor entry in the sidebar.", "settings-info-app-touch-move-threshold": "Minimum movement before a touch drag is detected.", + "settings-info-app-ui-zoom": "Scale text across the Acode interface.", "settings-info-app-vibrate-on-tap": "Enable haptic feedback for taps and controls.", "settings-info-editor-autosave": "Save changes automatically after a delay.", "settings-info-editor-color-preview": "Preview color values inline in the editor.", diff --git a/src/lang/es-sv.json b/src/lang/es-sv.json index 95940af2b..0e2fd34be 100644 --- a/src/lang/es-sv.json +++ b/src/lang/es-sv.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/fr-fr.json b/src/lang/fr-fr.json index 8fa02be5b..eaca49f5d 100644 --- a/src/lang/fr-fr.json +++ b/src/lang/fr-fr.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/he-il.json b/src/lang/he-il.json index 0a50d14b3..1d3d487e9 100644 --- a/src/lang/he-il.json +++ b/src/lang/he-il.json @@ -725,5 +725,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/hi-in.json b/src/lang/hi-in.json index e86614e33..c15d7ea3a 100644 --- a/src/lang/hi-in.json +++ b/src/lang/hi-in.json @@ -725,5 +725,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/hu-hu.json b/src/lang/hu-hu.json index 6b7aaa74c..4a9e4ad53 100644 --- a/src/lang/hu-hu.json +++ b/src/lang/hu-hu.json @@ -724,5 +724,7 @@ "close tabs to left": "Balra lévő lapok bezárása", "close other tabs": "Többi lap bezárása", "auto close tags": "Címkék automatikus lezárása", - "settings-info-editor-auto-close-tags": "HTML, XML, Vue, Angular és PHP-sablonfájlokban a záró címkék automatikus beillesztése." + "settings-info-editor-auto-close-tags": "HTML, XML, Vue, Angular és PHP-sablonfájlokban a záró címkék automatikus beillesztése.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/id-id.json b/src/lang/id-id.json index f16c2419a..ff86cb1c7 100644 --- a/src/lang/id-id.json +++ b/src/lang/id-id.json @@ -725,5 +725,7 @@ "close tabs to left": "Tutup Kiri", "close other tabs": "Tutup Lainnya", "auto close tags": "Penutup tag otomatis", - "settings-info-editor-auto-close-tags": "Menyisipkan tag penutup di berkas HTML, XML, Vue, Angular, dan templat PHP secara otomatis." + "settings-info-editor-auto-close-tags": "Menyisipkan tag penutup di berkas HTML, XML, Vue, Angular, dan templat PHP secara otomatis.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/ir-fa.json b/src/lang/ir-fa.json index 14183a9e4..50d85ef67 100644 --- a/src/lang/ir-fa.json +++ b/src/lang/ir-fa.json @@ -725,5 +725,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/it-it.json b/src/lang/it-it.json index 4e9ae8f0c..114125dc0 100644 --- a/src/lang/it-it.json +++ b/src/lang/it-it.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/ja-jp.json b/src/lang/ja-jp.json index a7064f19b..9dc2d5ec1 100644 --- a/src/lang/ja-jp.json +++ b/src/lang/ja-jp.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/ko-kr.json b/src/lang/ko-kr.json index 5ae7a483b..848b645e1 100644 --- a/src/lang/ko-kr.json +++ b/src/lang/ko-kr.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/ml-in.json b/src/lang/ml-in.json index 4d2569065..fd7d4dfe7 100644 --- a/src/lang/ml-in.json +++ b/src/lang/ml-in.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/mm-unicode.json b/src/lang/mm-unicode.json index 8ccde8ab6..b0f5b21ea 100644 --- a/src/lang/mm-unicode.json +++ b/src/lang/mm-unicode.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/mm-zawgyi.json b/src/lang/mm-zawgyi.json index 5ba55464b..e6bb03fb0 100644 --- a/src/lang/mm-zawgyi.json +++ b/src/lang/mm-zawgyi.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/pl-pl.json b/src/lang/pl-pl.json index 5f7d432cf..847f07f1b 100644 --- a/src/lang/pl-pl.json +++ b/src/lang/pl-pl.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/pt-br.json b/src/lang/pt-br.json index d50eeaa6f..eae43272a 100644 --- a/src/lang/pt-br.json +++ b/src/lang/pt-br.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/pu-in.json b/src/lang/pu-in.json index 125fdc795..506523cf6 100644 --- a/src/lang/pu-in.json +++ b/src/lang/pu-in.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/ru-ru.json b/src/lang/ru-ru.json index e80989061..3eb467537 100644 --- a/src/lang/ru-ru.json +++ b/src/lang/ru-ru.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/tl-ph.json b/src/lang/tl-ph.json index aa1c28f8b..bc33bf689 100644 --- a/src/lang/tl-ph.json +++ b/src/lang/tl-ph.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/tr-tr.json b/src/lang/tr-tr.json index 87a8ba3a3..161260ac2 100644 --- a/src/lang/tr-tr.json +++ b/src/lang/tr-tr.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/uk-ua.json b/src/lang/uk-ua.json index 6f6a0ff0d..02bd215b2 100644 --- a/src/lang/uk-ua.json +++ b/src/lang/uk-ua.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/uz-uz.json b/src/lang/uz-uz.json index 269df5d32..a21eac915 100644 --- a/src/lang/uz-uz.json +++ b/src/lang/uz-uz.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/vi-vn.json b/src/lang/vi-vn.json index 1d0a4f519..8f61d169e 100644 --- a/src/lang/vi-vn.json +++ b/src/lang/vi-vn.json @@ -725,5 +725,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/zh-cn.json b/src/lang/zh-cn.json index d3ab1bb60..cb4cfa9e0 100644 --- a/src/lang/zh-cn.json +++ b/src/lang/zh-cn.json @@ -724,5 +724,7 @@ "close tabs to left": "关闭左侧标签页", "close other tabs": "关闭其他标签页", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/zh-hant.json b/src/lang/zh-hant.json index 5a63e5b12..e546ab526 100644 --- a/src/lang/zh-hant.json +++ b/src/lang/zh-hant.json @@ -724,5 +724,7 @@ "close tabs to left": "關閉左側標籤頁", "close other tabs": "關閉其他標籤頁", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lang/zh-tw.json b/src/lang/zh-tw.json index d5b400365..14171dbd5 100644 --- a/src/lang/zh-tw.json +++ b/src/lang/zh-tw.json @@ -724,5 +724,7 @@ "close tabs to left": "Close Left", "close other tabs": "Close Others", "auto close tags": "Auto close tags", - "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files." + "settings-info-editor-auto-close-tags": "Automatically insert closing tags in HTML, XML, Vue, Angular, and PHP template files.", + "ui zoom": "UI zoom", + "settings-info-app-ui-zoom": "Scale text across the Acode interface." } diff --git a/src/lib/applySettings.js b/src/lib/applySettings.js index e3b6cbd5e..8a76c2360 100644 --- a/src/lib/applySettings.js +++ b/src/lib/applySettings.js @@ -23,6 +23,7 @@ export default { }); system.setInputType(appSettings.value.keyboardMode); + appSettings.applyUiZoomSetting(); // Keep native context menu enabled globally; editor manager scopes disabling to CodeMirror focus. system.setNativeContextMenuDisabled(false); }, diff --git a/src/lib/editorManager.js b/src/lib/editorManager.js index cc2ec4afa..eb9e05152 100644 --- a/src/lib/editorManager.js +++ b/src/lib/editorManager.js @@ -393,7 +393,7 @@ async function EditorManager($header, $body) { keys: ["indentGuides"], compartments: [indentGuidesCompartment], build() { - const enabled = appSettings?.value?.indentGuides ?? true; + const enabled = appSettings?.value?.indentGuides ?? false; if (!enabled) return []; return indentGuides({ highlightActiveGuide: true, diff --git a/src/lib/keyBindings.js b/src/lib/keyBindings.js index 103fb4aa6..d351985e8 100644 --- a/src/lib/keyBindings.js +++ b/src/lib/keyBindings.js @@ -268,6 +268,18 @@ const APP_BINDING_CONFIG = [ action: "open-log-file", readOnly: true, }, + { + name: "increaseFontSize", + description: "Increase editor font size", + key: "Ctrl-+|Ctrl-=", + readOnly: true, + }, + { + name: "decreaseFontSize", + description: "Decrease editor font size", + key: "Ctrl--", + readOnly: true, + }, { name: "openPluginsPage", description: "Open plugins page", @@ -651,7 +663,10 @@ function parseKeyParts(combo) { const modifiers = new Set(); let baseKey = ""; if (!combo) return { modifiers, baseKey }; - for (const rawPart of combo.split("-")) { + const parts = combo.endsWith("-") + ? [...combo.slice(0, -1).split("-").filter(Boolean), "-"] + : combo.split("-"); + for (const rawPart of parts) { const part = rawPart.trim(); if (!part) continue; const normalized = part.charAt(0).toUpperCase() + part.slice(1); diff --git a/src/lib/settings.js b/src/lib/settings.js index 4beddd844..42b161921 100644 --- a/src/lib/settings.js +++ b/src/lib/settings.js @@ -26,6 +26,10 @@ class Settings { #defaultSettings; #oldSettings; #initialized = false; + #uiZoomBaseFontSize = { + root: null, + body: null, + }; #on = { update: [], "update:after": [], @@ -124,6 +128,7 @@ class Settings { host: "localhost", search: this.#searchSettings, lang: "en-us", + uiZoom: 100, fontSize: "12px", editorTheme: "one_dark", textWrap: true, @@ -179,7 +184,7 @@ class Settings { showSponsorSidebarApp: true, showAnnotations: false, lintGutter: true, - indentGuides: true, + indentGuides: false, rainbowBrackets: true, pluginsDisabled: {}, // pluginId: true/false lsp: { @@ -370,6 +375,10 @@ class Settings { this.applyAnimationSetting(); break; + case "uiZoom": + this.applyUiZoomSetting(); + break; + case "lang": this.applyLangSetting(); break; @@ -396,6 +405,40 @@ class Settings { } } + applyUiZoomSetting() { + const zoom = Number(this.value.uiZoom) || 100; + const clamped = Math.min(160, Math.max(70, zoom)); + if (clamped === 100) { + document.documentElement.style.fontSize = ""; + document.body.style.fontSize = ""; + if (window.root) { + window.root.style.zoom = ""; + window.root.style.width = ""; + window.root.style.height = ""; + } + return; + } + + const rootFontSize = + this.#uiZoomBaseFontSize.root || + Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || + 14; + const bodyFontSize = + this.#uiZoomBaseFontSize.body || + Number.parseFloat(getComputedStyle(document.body).fontSize) || + rootFontSize; + + this.#uiZoomBaseFontSize.root = rootFontSize; + this.#uiZoomBaseFontSize.body = bodyFontSize; + document.documentElement.style.fontSize = `${(rootFontSize * clamped) / 100}px`; + document.body.style.fontSize = `${(bodyFontSize * clamped) / 100}px`; + if (window.root) { + window.root.style.zoom = ""; + window.root.style.width = ""; + window.root.style.height = ""; + } + } + async applyLangSetting() { const value = this.value.lang; lang.set(value); diff --git a/src/settings/appSettings.js b/src/settings/appSettings.js index 9734dee3b..c2284cbce 100644 --- a/src/settings/appSettings.js +++ b/src/settings/appSettings.js @@ -61,6 +61,25 @@ export default function otherSettings() { info: strings["settings-info-app-fullscreen"], category: categories.interface, }, + { + key: "uiZoom", + text: strings["ui zoom"] || "UI zoom", + value: values.uiZoom, + valueText: (value) => `${value}%`, + prompt: strings["ui zoom"] || "UI zoom", + promptType: "number", + promptOptions: { + test(value) { + if (!/^\d+$/.test(String(value).trim())) return false; + const zoom = Number(value); + return zoom >= 70 && zoom <= 160; + }, + }, + info: + strings["settings-info-app-ui-zoom"] || + "Scale text across the Acode interface.", + category: categories.interface, + }, { key: "keyboardMode", text: strings["keyboard mode"], @@ -413,6 +432,12 @@ export default function otherSettings() { system.setInputType(value); break; + case "uiZoom": + value = Number(value); + if (!Number.isInteger(value)) return; + value = Math.min(160, Math.max(70, value)); + break; + case "fullscreen": if (value) acode.exec("enable-fullscreen"); else acode.exec("disable-fullscreen"); diff --git a/src/settings/editorSettings.js b/src/settings/editorSettings.js index f346522b1..2a466c7b4 100644 --- a/src/settings/editorSettings.js +++ b/src/settings/editorSettings.js @@ -171,7 +171,7 @@ export default function editorSettings() { { key: "indentGuides", text: strings["indent guides"] || "Indent guides", - checkbox: values.indentGuides ?? true, + checkbox: values.indentGuides ?? false, info: strings["settings-info-editor-indent-guides"], category: categories.guidesIndicators, },