Swordfish90 / cool-retro-term

A good looking terminal emulator which mimics the old cathode display...
22.4k stars 855 forks source link

Enhancement: Profiles should preserve font scaling and window dimensions #825

Open kcbrown opened 1 year ago

kcbrown commented 1 year ago

It's not uncommon for the use of a profile to include specific dimensional requirements. For instance, one may wish to emulate an 80x24 terminal like a VT-100. Or one might have other terminal size requirements.

In all of those cases, it's highly desirable for the profile to include the necessary attributes to maintain the dimensions and the font properties of the emulated terminal.

This code change accomplishes precisely that (note that it depends on the fix for https://github.com/Swordfish90/cool-retro-term/issues/824 to properly change the window size once the profile has been loaded):

diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml
index 424f0bd..9f7737d 100644
--- a/app/qml/ApplicationSettings.qml
+++ b/app/qml/ApplicationSettings.qml
@@ -272,6 +272,9 @@ QtObject {
             "margin": _margin,
             "blinkingCursor": blinkingCursor,
             "frameMargin": _frameMargin,
+            "fontScaling": fontScaling,
+            "width": width,
+            "height": height,
         }
         return settings
     }
@@ -377,12 +380,17 @@ QtObject {
                 !== undefined ? settings.fontName : fontNames[rasterization]
         fontWidth = settings.fontWidth !== undefined ? settings.fontWidth : fontWidth

+        fontScaling = settings.fontScaling !== undefined ? settings.fontScaling : fontScaling
+        width = settings.width !== undefined ? settings.width : width
+        height = settings.height !== undefined ? settings.height : height
+
         _margin = settings.margin !== undefined ? settings.margin : _margin
         _frameMargin = settings.frameMargin !== undefined ? settings.frameMargin : _frameMargin

         blinkingCursor = settings.blinkingCursor !== undefined ? settings.blinkingCursor : blinkingCursor

         handleFontChanged()
+        initializedSettings()
     }

     function storeCustomProfiles() {