@@ -1188,10 +1188,18 @@ export default class AcodeX {
11881188 }
11891189 //this.$terminal.focus();
11901190 this . _updateTerminalHeight ( ) ;
1191+ const baseFontSize = Number ( this . settings . fontSize ) || FONT_SIZE ;
1192+ const minFontSize = Math . max ( 1 , baseFontSize - 10 ) ;
1193+ const maxFontSize = Math . max ( baseFontSize + 16 , 32 ) ;
11911194 this . selectionManager = new SelectionCore (
11921195 this . $terminal ,
11931196 this . $terminalContainer ,
11941197 this . settings ,
1198+ {
1199+ minFontSize,
1200+ maxFontSize,
1201+ onFontSizeChange : ( size ) => this . applyTerminalFontSize ( size ) ,
1202+ } ,
11951203 ) ;
11961204 } ;
11971205 this . socket . onclose = async ( event ) => {
@@ -1285,20 +1293,15 @@ export default class AcodeX {
12851293 }
12861294 if ( e . ctrlKey && e . key === "+" ) {
12871295 // Ctrl + Plus(+)
1288- this . $terminal . options . fontSize = this . $terminal . options . fontSize + 1 ;
1289- this . $terminal . refresh ( 0 , this . $terminal . rows - 1 ) ;
1290- this . settings . fontSize = this . $terminal . options . fontSize ;
1291- appSettings . update ( false ) ;
1296+ const newFontSize = this . $terminal . options . fontSize + 1 ;
1297+ this . applyTerminalFontSize ( newFontSize ) ;
12921298 return false ;
12931299 }
12941300 if ( e . ctrlKey && e . key === "-" ) {
12951301 // Ctrl + Minus(-)
12961302 const newFontSize = this . $terminal . options . fontSize - 1 ;
1297- if ( newFontSize < 1 ) return ;
1298- this . $terminal . options . fontSize = newFontSize ;
1299- this . $terminal . refresh ( 0 , this . $terminal . rows - 1 ) ;
1300- this . settings . fontSize = this . $terminal . options . fontSize ;
1301- appSettings . update ( false ) ;
1303+ if ( newFontSize < 1 ) return false ;
1304+ this . applyTerminalFontSize ( newFontSize ) ;
13021305 return false ;
13031306 }
13041307 if ( e . ctrlKey && e . shiftKey && ( e . key === "c" || e . key === "C" ) ) {
@@ -1759,6 +1762,25 @@ export default class AcodeX {
17591762 }
17601763 }
17611764
1765+ applyTerminalFontSize ( fontSize ) {
1766+ if ( ! this . $terminal ) return ;
1767+
1768+ const parsedFontSize = Number ( fontSize ) ;
1769+ if ( Number . isNaN ( parsedFontSize ) ) return ;
1770+
1771+ const minFontSize = 1 ;
1772+ const clampedFontSize = Math . max ( minFontSize , parsedFontSize ) ;
1773+
1774+ if ( this . $terminal . options . fontSize === clampedFontSize ) return ;
1775+
1776+ this . $terminal . options . fontSize = clampedFontSize ;
1777+ if ( typeof this . $terminal . refresh === "function" ) {
1778+ this . $terminal . refresh ( 0 , this . $terminal . rows - 1 ) ;
1779+ }
1780+ this . settings . fontSize = clampedFontSize ;
1781+ appSettings . update ( false ) ;
1782+ }
1783+
17621784 async _getLastSessionName ( ) {
17631785 try {
17641786 // Read the JSON file
@@ -2659,11 +2681,7 @@ export default class AcodeX {
26592681 }
26602682 break ;
26612683 case "fontSize" :
2662- if ( this . $terminal ) {
2663- this . $terminal . options . fontSize = value ;
2664- }
2665- this . settings [ key ] = value ;
2666- appSettings . update ( ) ;
2684+ this . applyTerminalFontSize ( value ) ;
26672685 break ;
26682686 case "fontFamily" :
26692687 try {
@@ -2761,6 +2779,9 @@ export default class AcodeX {
27612779
27622780 default :
27632781 this . settings [ key ] = value ;
2782+ if ( key === "selectionHaptics" && this . selectionManager ) {
2783+ this . selectionManager . options . hapticFeedback = ! ! value ;
2784+ }
27642785 appSettings . update ( ) ;
27652786 }
27662787 }
0 commit comments