mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-11 04:38:24 -06:00
feat: add option to enable zoom with ctrl + scroll (#19127)
This PR adds a new global setting `scrollToZoom` that allows users to enable font zooming with scrolling. When disabled, **this setting prevents accidental font size changes** that can occur when users scroll while holding the Ctrl key. Note: after disabling this setting, users may still change font size using `Ctrl+` and `Ctrl-` keyboard shortcuts. Other Ctrl+Scroll functionality (like transparency adjustments) remains unaffected. ## Validation Steps Performed - Verified the setting can be toggled in the Settings UI (Interaction tab) - Confirmed that when disabled, holding Ctrl and scrolling no longer changes font size - Validated that the setting persists across terminal restarts --- Note: I used the existing `FocusFollowMouse` setting as a reference for implementing this. Closes #11710 Closes #3793 Closes #11906 Closes #3990
This commit is contained in:
parent
7b841628df
commit
a04e410a39
@ -2376,6 +2376,11 @@
|
|||||||
"description": "When set to true, the terminal will focus the pane on mouse hover.",
|
"description": "When set to true, the terminal will focus the pane on mouse hover.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"experimental.scrollToZoom": {
|
||||||
|
"default": true,
|
||||||
|
"description": "When set to true, holding the Ctrl key while scrolling will increase or decrease the terminal font size.",
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"compatibility.allowHeadless": {
|
"compatibility.allowHeadless": {
|
||||||
"default": false,
|
"default": false,
|
||||||
"description": "When set to true, Windows Terminal will run in the background. This allows globalSummon and quakeMode actions to work even when no windows are open.",
|
"description": "When set to true, Windows Terminal will run in the background. This allows globalSummon and quakeMode actions to work even when no windows are open.",
|
||||||
|
|||||||
@ -519,7 +519,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||||||
{
|
{
|
||||||
_mouseTransparencyHandler(delta);
|
_mouseTransparencyHandler(delta);
|
||||||
}
|
}
|
||||||
else if (ctrlPressed)
|
else if (ctrlPressed && _core->Settings().ScrollToZoom())
|
||||||
{
|
{
|
||||||
_mouseZoomHandler(delta);
|
_mouseZoomHandler(delta);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,6 +60,7 @@ namespace Microsoft.Terminal.Control
|
|||||||
Boolean CopyOnSelect { get; };
|
Boolean CopyOnSelect { get; };
|
||||||
Microsoft.Terminal.Control.CopyFormat CopyFormatting { get; };
|
Microsoft.Terminal.Control.CopyFormat CopyFormatting { get; };
|
||||||
Boolean FocusFollowMouse { get; };
|
Boolean FocusFollowMouse { get; };
|
||||||
|
Boolean ScrollToZoom { get; };
|
||||||
|
|
||||||
String Commandline { get; };
|
String Commandline { get; };
|
||||||
String StartingDirectory { get; };
|
String StartingDirectory { get; };
|
||||||
|
|||||||
@ -83,6 +83,12 @@
|
|||||||
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
|
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
|
||||||
</local:SettingContainer>
|
</local:SettingContainer>
|
||||||
|
|
||||||
|
<!-- Enable Font Size Changes with Scrolling -->
|
||||||
|
<local:SettingContainer x:Uid="Globals_ScrollToZoom">
|
||||||
|
<ToggleSwitch IsOn="{x:Bind ViewModel.ScrollToZoom, Mode=TwoWay}"
|
||||||
|
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
|
||||||
|
</local:SettingContainer>
|
||||||
|
|
||||||
<!-- Detect URLs -->
|
<!-- Detect URLs -->
|
||||||
<local:SettingContainer x:Uid="Globals_DetectURLs">
|
<local:SettingContainer x:Uid="Globals_DetectURLs">
|
||||||
<ToggleSwitch IsOn="{x:Bind ViewModel.DetectURLs, Mode=TwoWay}"
|
<ToggleSwitch IsOn="{x:Bind ViewModel.DetectURLs, Mode=TwoWay}"
|
||||||
|
|||||||
@ -25,6 +25,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimPaste);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimPaste);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SnapToGridOnResize);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SnapToGridOnResize);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, FocusFollowMouse);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, FocusFollowMouse);
|
||||||
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ScrollToZoom);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DetectURLs);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DetectURLs);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SearchWebDefaultQueryUrl);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SearchWebDefaultQueryUrl);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WordDelimiters);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WordDelimiters);
|
||||||
|
|||||||
@ -22,6 +22,7 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, TrimPaste);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, TrimPaste);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, SnapToGridOnResize);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, SnapToGridOnResize);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, FocusFollowMouse);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, FocusFollowMouse);
|
||||||
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, ScrollToZoom);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, DetectURLs);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, DetectURLs);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(String, SearchWebDefaultQueryUrl);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(String, SearchWebDefaultQueryUrl);
|
||||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(String, WordDelimiters);
|
PERMANENT_OBSERVABLE_PROJECTED_SETTING(String, WordDelimiters);
|
||||||
|
|||||||
@ -1736,6 +1736,10 @@
|
|||||||
<value>Automatically focus pane on mouse hover</value>
|
<value>Automatically focus pane on mouse hover</value>
|
||||||
<comment>Header for a control to toggle the "focus follow mouse" setting. When enabled, hovering over a pane puts it in focus.</comment>
|
<comment>Header for a control to toggle the "focus follow mouse" setting. When enabled, hovering over a pane puts it in focus.</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Globals_ScrollToZoom.Header" xml:space="preserve">
|
||||||
|
<value>Adjust terminal font size by scrolling while holding the Ctrl key</value>
|
||||||
|
<comment>Header for a control to toggle font size changes with scrolling. When enabled, holding the Ctrl key while scrolling will increase or decrease the terminal font size.</comment>
|
||||||
|
</data>
|
||||||
<data name="Globals_DisableAnimationsReversed.Header" xml:space="preserve">
|
<data name="Globals_DisableAnimationsReversed.Header" xml:space="preserve">
|
||||||
<value>Pane animations</value>
|
<value>Pane animations</value>
|
||||||
<comment>Header for a control to toggle animations on panes. "Enabled" value enables the animations.</comment>
|
<comment>Header for a control to toggle animations on panes. "Enabled" value enables the animations.</comment>
|
||||||
|
|||||||
@ -90,6 +90,7 @@ namespace Microsoft.Terminal.Settings.Model
|
|||||||
INHERITABLE_SETTING(Boolean, DisableAnimations);
|
INHERITABLE_SETTING(Boolean, DisableAnimations);
|
||||||
INHERITABLE_SETTING(String, StartupActions);
|
INHERITABLE_SETTING(String, StartupActions);
|
||||||
INHERITABLE_SETTING(Boolean, FocusFollowMouse);
|
INHERITABLE_SETTING(Boolean, FocusFollowMouse);
|
||||||
|
INHERITABLE_SETTING(Boolean, ScrollToZoom);
|
||||||
INHERITABLE_SETTING(WindowingMode, WindowingBehavior);
|
INHERITABLE_SETTING(WindowingMode, WindowingBehavior);
|
||||||
INHERITABLE_SETTING(Boolean, TrimBlockSelection);
|
INHERITABLE_SETTING(Boolean, TrimBlockSelection);
|
||||||
INHERITABLE_SETTING(Boolean, DetectURLs);
|
INHERITABLE_SETTING(Boolean, DetectURLs);
|
||||||
|
|||||||
@ -24,6 +24,7 @@ Author(s):
|
|||||||
X(hstring, WordDelimiters, "wordDelimiters", DEFAULT_WORD_DELIMITERS) \
|
X(hstring, WordDelimiters, "wordDelimiters", DEFAULT_WORD_DELIMITERS) \
|
||||||
X(bool, CopyOnSelect, "copyOnSelect", false) \
|
X(bool, CopyOnSelect, "copyOnSelect", false) \
|
||||||
X(bool, FocusFollowMouse, "focusFollowMouse", false) \
|
X(bool, FocusFollowMouse, "focusFollowMouse", false) \
|
||||||
|
X(bool, ScrollToZoom, "experimental.scrollToZoom", true) \
|
||||||
X(winrt::Microsoft::Terminal::Control::GraphicsAPI, GraphicsAPI, "rendering.graphicsAPI") \
|
X(winrt::Microsoft::Terminal::Control::GraphicsAPI, GraphicsAPI, "rendering.graphicsAPI") \
|
||||||
X(bool, DisablePartialInvalidation, "rendering.disablePartialInvalidation", false) \
|
X(bool, DisablePartialInvalidation, "rendering.disablePartialInvalidation", false) \
|
||||||
X(bool, SoftwareRendering, "rendering.software", false) \
|
X(bool, SoftwareRendering, "rendering.software", false) \
|
||||||
|
|||||||
@ -367,6 +367,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|||||||
_CopyOnSelect = globalSettings.CopyOnSelect();
|
_CopyOnSelect = globalSettings.CopyOnSelect();
|
||||||
_CopyFormatting = globalSettings.CopyFormatting();
|
_CopyFormatting = globalSettings.CopyFormatting();
|
||||||
_FocusFollowMouse = globalSettings.FocusFollowMouse();
|
_FocusFollowMouse = globalSettings.FocusFollowMouse();
|
||||||
|
_ScrollToZoom = globalSettings.ScrollToZoom();
|
||||||
_GraphicsAPI = globalSettings.GraphicsAPI();
|
_GraphicsAPI = globalSettings.GraphicsAPI();
|
||||||
_DisablePartialInvalidation = globalSettings.DisablePartialInvalidation();
|
_DisablePartialInvalidation = globalSettings.DisablePartialInvalidation();
|
||||||
_SoftwareRendering = globalSettings.SoftwareRendering();
|
_SoftwareRendering = globalSettings.SoftwareRendering();
|
||||||
|
|||||||
@ -94,6 +94,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|||||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, CopyOnSelect, false);
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, CopyOnSelect, false);
|
||||||
INHERITABLE_SETTING(Model::TerminalSettings, Microsoft::Terminal::Control::CopyFormat, CopyFormatting, 0);
|
INHERITABLE_SETTING(Model::TerminalSettings, Microsoft::Terminal::Control::CopyFormat, CopyFormatting, 0);
|
||||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, FocusFollowMouse, false);
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, FocusFollowMouse, false);
|
||||||
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, ScrollToZoom, true);
|
||||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, AllowVtChecksumReport, false);
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, AllowVtChecksumReport, false);
|
||||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, TrimBlockSelection, true);
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, TrimBlockSelection, true);
|
||||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, DetectURLs, true);
|
INHERITABLE_SETTING(Model::TerminalSettings, bool, DetectURLs, true);
|
||||||
|
|||||||
@ -42,6 +42,7 @@
|
|||||||
X(winrt::hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS) \
|
X(winrt::hstring, WordDelimiters, DEFAULT_WORD_DELIMITERS) \
|
||||||
X(bool, CopyOnSelect, false) \
|
X(bool, CopyOnSelect, false) \
|
||||||
X(bool, FocusFollowMouse, false) \
|
X(bool, FocusFollowMouse, false) \
|
||||||
|
X(bool, ScrollToZoom, true) \
|
||||||
X(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>, TabColor, nullptr) \
|
X(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>, TabColor, nullptr) \
|
||||||
X(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>, StartingTabColor, nullptr) \
|
X(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>, StartingTabColor, nullptr) \
|
||||||
X(bool, TrimBlockSelection, true) \
|
X(bool, TrimBlockSelection, true) \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user