[PR #1207] [MERGED] Enable resizing the panes with the keyboard. #24527

Open
opened 2026-01-31 09:03:50 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/1207
Author: @zadjii-msft
Created: 6/11/2019
Status: Merged
Merged: 7/10/2019
Merged by: @zadjii-msft

Base: masterHead: dev/migrie/f/991-resizable-panes


📝 Commits (10+)

  • 83f1a3b Add the keybinding for panes back
  • 4840542 Start working on resizable panes. This sorta works as you increase the 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
  • aa16bc3 Panes can now be a variable percent of their parent
  • 81c1f0b Add keybindings and code for handling resizing panes
  • 9d7857a Excessive doc commenting
  • ec2cca9 Try fixing resizing to 0
  • 356d3bf Merge remote-tracking branch 'origin/master' into dev/migrie/f/991-resizable-panes
  • 770cf96 This fixes resizing two panes, but not n panes
  • c101054 Prevent a kinetic dissasembly during resize
  • a365503 runformat

📊 Changes

13 files changed (+465 additions, -20 deletions)

View changed files

📝 src/cascadia/TerminalApp/App.cpp (+34 -0)
📝 src/cascadia/TerminalApp/App.h (+2 -0)
📝 src/cascadia/TerminalApp/AppKeyBindings.cpp (+13 -0)
📝 src/cascadia/TerminalApp/AppKeyBindings.h (+1 -0)
📝 src/cascadia/TerminalApp/AppKeyBindings.idl (+14 -0)
📝 src/cascadia/TerminalApp/AppKeyBindingsSerialization.cpp (+8 -0)
📝 src/cascadia/TerminalApp/Pane.cpp (+264 -18)
📝 src/cascadia/TerminalApp/Pane.h (+46 -1)
📝 src/cascadia/TerminalApp/Tab.cpp (+24 -0)
📝 src/cascadia/TerminalApp/Tab.h (+2 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+53 -1)
📝 src/cascadia/TerminalControl/TermControl.h (+2 -0)
📝 src/cascadia/TerminalControl/TermControl.idl (+2 -0)

📄 Description

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::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.

Validation Steps Performed

Opened a bunch of panes and tried moving them with the keybindings


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/1207 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 6/11/2019 **Status:** ✅ Merged **Merged:** 7/10/2019 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `master` ← **Head:** `dev/migrie/f/991-resizable-panes` --- ### 📝 Commits (10+) - [`83f1a3b`](https://github.com/microsoft/terminal/commit/83f1a3b32b17b598a6abd833540e8074e03db5d2) Add the keybinding for panes back - [`4840542`](https://github.com/microsoft/terminal/commit/4840542652c9ec6cb1849aef5c1538ed5d7ba47b) Start working on resizable panes. This sorta works as you increase the 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 - [`aa16bc3`](https://github.com/microsoft/terminal/commit/aa16bc38a53623dbb6e71e5da6bcb20f8e43dda0) Panes can now be a variable percent of their parent - [`81c1f0b`](https://github.com/microsoft/terminal/commit/81c1f0ba441d73d4dc1378d743dd08e181f5cf57) Add keybindings and code for handling resizing panes - [`9d7857a`](https://github.com/microsoft/terminal/commit/9d7857ab869c6e710d24691ce6939b0e9a92d47a) Excessive doc commenting - [`ec2cca9`](https://github.com/microsoft/terminal/commit/ec2cca90037692d2623eb1bb398e1f947589be13) Try fixing resizing to 0 - [`356d3bf`](https://github.com/microsoft/terminal/commit/356d3bf2ad8988c21376ad8502ff18fad01b2523) Merge remote-tracking branch 'origin/master' into dev/migrie/f/991-resizable-panes - [`770cf96`](https://github.com/microsoft/terminal/commit/770cf962838a994f62b080016946e977dc364b3b) This fixes resizing two panes, but not n panes - [`c101054`](https://github.com/microsoft/terminal/commit/c1010542b43f956899caa2aad642a63cde102db8) Prevent a kinetic dissasembly during resize - [`a365503`](https://github.com/microsoft/terminal/commit/a36550316a9db11a3fb83c8a36e1600a6935ce92) runformat ### 📊 Changes **13 files changed** (+465 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/App.cpp` (+34 -0) 📝 `src/cascadia/TerminalApp/App.h` (+2 -0) 📝 `src/cascadia/TerminalApp/AppKeyBindings.cpp` (+13 -0) 📝 `src/cascadia/TerminalApp/AppKeyBindings.h` (+1 -0) 📝 `src/cascadia/TerminalApp/AppKeyBindings.idl` (+14 -0) 📝 `src/cascadia/TerminalApp/AppKeyBindingsSerialization.cpp` (+8 -0) 📝 `src/cascadia/TerminalApp/Pane.cpp` (+264 -18) 📝 `src/cascadia/TerminalApp/Pane.h` (+46 -1) 📝 `src/cascadia/TerminalApp/Tab.cpp` (+24 -0) 📝 `src/cascadia/TerminalApp/Tab.h` (+2 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+53 -1) 📝 `src/cascadia/TerminalControl/TermControl.h` (+2 -0) 📝 `src/cascadia/TerminalControl/TermControl.idl` (+2 -0) </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Adds the ability to resize panes with the keyboard. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #991 * [x] I work here * [ ] Tests added/passed - this box makes me cry * [x] I actually kinda just went for this one. <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments 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. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Opened a bunch of panes and tried moving them with the keybindings --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:03:50 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24527