-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add keyboard shortcuts to increase and decrease font size #2700
Add keyboard shortcuts to increase and decrease font size #2700
Conversation
I've combined the |
Does the feature get called Font Size, or would it be Zoom? |
Thats a good question. I just left it as font size since that is how zooming works for the terminal control. I know there's future plans to possibly support non terminal panes so maybe zoom would be a better term. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a tiny bit worried about the choice of default keybinding here - ctrl+shift+plus/ctrl+shift+minus might be better.
Otherwise, lets just get the merge fixed and lets
@@ -398,6 +398,13 @@ void CascadiaSettings::_CreateDefaultKeybindings() | |||
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab8, | |||
KeyChord{ KeyModifiers::Alt | KeyModifiers::Ctrl, | |||
static_cast<int>('9') }); | |||
|
|||
keyBindings.SetKeyBinding(ShortcutAction::IncreaseFontSize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only reservation is that as of #2515, the default keybindings aren't set here anymore. They should instead be included in src\cascadia\TerminalApp\defaults.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting conundrum here @zadjii-msft. To adjust text size / zoom using the mouse is ctrl + scroll. It would therefore, make sense if zoom via the keyboard was also ctrl + +/-.
What would also make THAT even more consistent with mouse scroll actions was if also ctrl + shift + +/- adjusted blur, but I may be pushing my luck here ... or am I? 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it looks like there's no VT encoding for Ctrl-+, so it's free to be bound! Problem, though: Ctrl+- emits ^_
.
We also do need to be considerate of the fact that + is Shift+-...
Perhaps we should follow suit with other zoomable things and make Ctrl+= the "zoom in" binding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Ctrl+Shift+- emits ^_
in putty and conhost, but Ctrl+- only emits ^_
in putty. Perhaps the right behavior is that Ctrl alone doesn't do anything and is free to be bound for both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, like this then?
Key Chord | Keys + Mouse | Action |
---|---|---|
ctrl + =/- | ctrl + mouse scroll up/down | Zoom in/out |
ctrl+shift + +/_ | ctrl + shift + mouse scroll up/down | Blur more/less |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the bindings to defaults.json
as
{ "command": "decreaseFontSize", "keys": ["ctrl+-"] },
{ "command": "increaseFontSize", "keys": ["ctrl+="] }
If a different default is decided I'll be happy to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment indicating the requested changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to block on a simple tabs-> spaces thing, but this is the only nit preventing me from signing off.
@@ -209,6 +209,8 @@ | |||
{ "command": "switchToTab5", "keys": ["ctrl+alt+6"] }, | |||
{ "command": "switchToTab6", "keys": ["ctrl+alt+7"] }, | |||
{ "command": "switchToTab7", "keys": ["ctrl+alt+8"] }, | |||
{ "command": "switchToTab8", "keys": ["ctrl+alt+9"] } | |||
{ "command": "switchToTab8", "keys": ["ctrl+alt+9"] }, | |||
{ "command": "decreaseFontSize", "keys": ["ctrl+-"] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ "command": "decreaseFontSize", "keys": ["ctrl+-"] }, | |
{ "command": "decreaseFontSize", "keys": ["ctrl+-"] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Shouldn't have to tell me this 😅. Fixed.
{ "command": "switchToTab8", "keys": ["ctrl+alt+9"] } | ||
{ "command": "switchToTab8", "keys": ["ctrl+alt+9"] }, | ||
{ "command": "decreaseFontSize", "keys": ["ctrl+-"] }, | ||
{ "command": "increaseFontSize", "keys": ["ctrl+="] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ "command": "increaseFontSize", "keys": ["ctrl+="] } | |
{ "command": "increaseFontSize", "keys": ["ctrl+="] } |
So, is this ready to be merge? |
@dsafa - Thanks soooo much for implementing this feature :) Been wanting to get around to doing this myself - glad you got there first 😁 |
)" This reverts commit 083be43.
🎉 Handy links: |
Summary of the Pull Request
This hooks up the already existing shortcut actions for increasing and decreasing font size so that keyboard shortcuts can be used. Also adds default shortcuts
ctrl+=
andctrl+-
for increasing and decreasing font size.References
A previous PR was done for this feature but was closed and never completed: #1740 . This is a continuation of that work.
PR Checklist
Detailed Description of the Pull Request / Additional comments
There were already actions
increaseFontSize
anddecreaseFontSize
that existed but without anything to handle them. The handler shares existing functionality for adjusting font size that already exists with ctrl and scrolling.Validation Steps Performed
profiles.json
fordecreaseFontSize
andincreaseFontSize
1. Deleteprofiles.json
and let terminal generate a default one.2. Verified that the default keybindings are created.No longer needed withdefaults.json