Enable resizing the panes with the keyboard.#1207
Conversation
…e size, but doesn't resize down. I also had to remove the seperator. I think I need to have the resize event start from the top, then recurse down
* Works for both vertical and horizontal splits * seperator is visible too * resizing the window works right
If you add keybindings for resizing, like so:
```json
{
"command" : "resizePaneDown",
"keys" :
[
"alt+shift+down"
]
},
{
"command" : "resizePaneLeft",
"keys" :
[
"alt+shift+left"
]
},
{
"command" : "resizePaneRight",
"keys" :
[
"alt+shift+right"
]
},
{
"command" : "resizePaneUp",
"keys" :
[
"alt+shift+up"
]
},
```
Then you can now resize the panes, 5% at a time.
We correctly traverse the tree to find the separator that's closest to the
focused pane (depth-wise), but also the correct direction.
I need the padding fix however
…sizable-panes # Conflicts: # src/cascadia/TerminalApp/AppKeyBindings.cpp # src/cascadia/TerminalApp/AppKeyBindings.h # src/cascadia/TerminalApp/AppKeyBindingsSerialization.cpp
|
If you have this layout: and you resize |
Yup. Pretty neat :) |
|
@DHowett-MSFT you bet it does :) |
But that might always have been broken
Also add comments
|
@adiviness @DHowett-MSFT @miniksa Can I get a second on this at some point? I'll have another PR to follow this one for moving pane focus |
miniksa
left a comment
There was a problem hiding this comment.
I see a few things and there are a few open comments still in here from other folks.
…sizable-panes # Conflicts: # src/cascadia/TerminalApp/App.cpp
DHowett-MSFT
left a comment
There was a problem hiding this comment.
Sorry we took so long!
…sizable-panes # Conflicts: # src/cascadia/TerminalApp/App.cpp
Adds the ability to resize panes with the keyboard.
This is accomplished by making the Column/RowDefinitions for a Pane use `GridLengthHelper::FromPixels` to set their size. We store a pair of floats that represents the relative amount that each pane takes out of the parent pane. When the window is resized, we use that percentage to figure out the new size of each child in pixels, and manually size each column.
Then, when the user presses the keybindings for resizePane{Left/Right/Up/Down}, we'll adjust those percentages, and resize the rows/cols as appropriate.
Currently, each pane adjusts the width/height by 5% of the total size at a time. I am not in love with this, but it works for now. I think when we get support for keybindings with arbitrary arg blobs, then we could do either a percent movement, or a number of characters at a time. The number of characters one would be trickier, because we'd have to get the focused control, and get the number of pixels per character, as adjacent panes might not have the same font sizes.
|
🎉 Handy links: |
Summary of the Pull Request
Adds the ability to resize panes with the keyboard.
PR Checklist
Detailed Description of the Pull Request / Additional comments
This is accomplished by making the Column/RowDefinitions for a Pane use
GridLengthHelper::FromPixelsto set their size. We store a pair of floats that represents the relative amount that each pane takes out of the parent pane. When the window is resized, we use that percentage to figure out the new size of each child in pixels, and manually size each column.Then, when the user presses the keybindings for resizePane{Left/Right/Up/Down}, we'll adjust those percentages, and resize the rows/cols as appropriate.
Currently, each pane adjusts the width/height by 5% of the total size at a time. I am not in love with this, but it works for now. I think when we get support for keybindings with arbitrary arg blobs, then we could do either a percent movement, or a number of characters at a time. The number of characters one would be trickier, because we'd have to get the focused control, and get the number of pixels per character, as adjacent panes might not have the same font sizes.
Validation Steps Performed
Opened a bunch of panes and tried moving them with the keybindings