From 4e2471b42faf9d9df5f6775b7556c1dc11d061ae Mon Sep 17 00:00:00 2001 From: Prakshitha Malla Date: Fri, 29 May 2026 01:24:29 +0530 Subject: [PATCH] feat: add interactive terminal font size zoom controller #113 --- ui/app.js | 38 ++++++++++++++++++++++++++++++++++++++ ui/index.html | 16 ++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/ui/app.js b/ui/app.js index 5dd09d3..f1761de 100644 --- a/ui/app.js +++ b/ui/app.js @@ -57,6 +57,7 @@ let state = { sessionId: null, lastSaveTimestamp: 0, runningScripts: {}, // { termId: { run_id } } +terminalFontSize: parseInt(localStorage.getItem('terminal-font-size')) || 13, }; const RUN_BUTTON_IDLE_HTML = `Run`; @@ -1774,6 +1775,43 @@ function closeModal() { // ─── Event Bindings ──────────────────────────────────────── function bindEvents() { + // ─── TERMINAL TEXT SIZE ZOOM PANEL ENGINE (#113) ─── + const btnZoomIn = document.getElementById('btn-zoom-in'); + const btnZoomOut = document.getElementById('btn-zoom-out'); + const zoomDisplay = document.getElementById('terminal-zoom-display'); + const terminalBody = document.getElementById('terminal-body'); + + // Sync rendering on startup routine + const applyTerminalFontSize = () => { + if (terminalBody) { + terminalBody.style.fontSize = `${state.terminalFontSize}px`; + } + if (zoomDisplay) { + zoomDisplay.textContent = `${state.terminalFontSize}px`; + } + localStorage.setItem('terminal-font-size', state.terminalFontSize); + }; + + // Initialize preference configurations instantly on event hook cycle + applyTerminalFontSize(); + + if (btnZoomIn) { + btnZoomIn.addEventListener('click', () => { + if (state.terminalFontSize < 20) { // Strict upper bounds constraint + state.terminalFontSize++; + applyTerminalFontSize(); + } + }); + } + + if (btnZoomOut) { + btnZoomOut.addEventListener('click', () => { + if (state.terminalFontSize > 11) { // Strict lower bounds constraint + state.terminalFontSize--; + applyTerminalFontSize(); + } + }); + } // Terminal Search const cliSearchInput = document.getElementById('cli-search-input'); if (cliSearchInput) { diff --git a/ui/index.html b/ui/index.html index 5ade3af..96e5179 100644 --- a/ui/index.html +++ b/ui/index.html @@ -182,6 +182,21 @@

Scripts

+
+ + 13px + +
+ +