Add the ability to split a pane and put the new pane first.#11145
Add the ability to split a pane and put the new pane first.#111456 commits merged intomicrosoft:mainfrom
Conversation
src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h
Show resolved
Hide resolved
|
Don't forget to update the docs repo. |
zadjii-msft
left a comment
There was a problem hiding this comment.
Meh, my comment is nitpicking over internal data structures, which doesn't terribly matter.
| { | ||
| JSON_MAPPINGS(3) = { | ||
| JSON_MAPPINGS(7) = { | ||
| pair_type{ "vertical", ValueType::Vertical }, |
There was a problem hiding this comment.
So you might be able to make some of this code easier! We could get rid of SplitState::Horizontal and Vertical, but leave the serializations there. So you'd have
pair_type{ "vertical", ValueType::Right },
pair_type{ "horizontal", ValueType::Down },Then we wouldn't need to keep those legacy enum values internally, but we could keep them in the json deserialization.
There was a problem hiding this comment.
Oh, but we do use SplitState::Horizontal/Vertical for the actual internal "which way is this pane's divider". Hmm. Then maybe it makes more sense to have two types
- one for "which direction has a user asked to split this pane in" ("up"/"down"/"left"/"right", "auto", "horizontal"=="down", "vertical"="right")
- the other is "which direction is this pane's divider" (
Horizontal,Vertical)
There was a problem hiding this comment.
Would this end up with us serializing "right" as "horizontal" accidentally? That's why I didn't do that in the first place. If that isn't a problem I could split this into SplitDirection and SplitState.
There was a problem hiding this comment.
I did the refactor to make a separate SplitDirection that is used for SplitPaneArgs, and then an internal to pane SplitState that the direction gets converted to. I confirmed that SplitDirection deserializes "horizontal" and "vertical" as "down" and "right" directions appropriately.
There was a problem hiding this comment.
Also confirmed that a user setting for a vertical hotkey overrides (but displays as) a right split.
There was a problem hiding this comment.
I need to remember to not get enticed by "small" refactoring in the future since the changes are always bigger than I expect them to be.
|
|
||
| // Pane Management | ||
| { "command": "closePane", "keys": "ctrl+shift+w" }, | ||
| { "command": { "action": "splitPane", "split": "up" } }, |
There was a problem hiding this comment.
May want to stick these under "SplitPaneParentCommandName" instead, so they show up in the nested split pane commands
There was a problem hiding this comment.
Instead or in addition to?
There was a problem hiding this comment.
I replaced the current split horizontal/vertical with down/right, and added those as options to the extra menu below.
src/cascadia/TerminalApp/Pane.cpp
Outdated
| if (splitType == SplitState::Up || splitType == SplitState::Left) | ||
| { | ||
| std::swap(_firstChild, _secondChild); | ||
| } |
There was a problem hiding this comment.
Wow this is really the entire meat of this PR isn't it. So simple
There was a problem hiding this comment.
10 lines of actual code changes, 200 lines of boilerplate and refactoring :)
There was a problem hiding this comment.
I forgot about all of the unit tests that needed to be updated, so that is an extra 200 lines of refactoring changes.
…orizontal/vertical map properly. Updated one of the command tests to actually check the directional versions map correctly.
|
I /think/ I fixed all of the tests related to this. It is hard to tell because when running locally there were a number of other tests that were failing that were completely unrelated. This might as well be an entirely new PR at this point so re-review at your leisure. |
|
Does the azure build run with particular compiler settings? Trying to build locally I have no problems. |
|
Oh, the azure builds applies the pr changes on top of |
|
@msftbot merge this in 5 minutes |
|
Hello @carlos-zamora! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
DHowett
left a comment
There was a problem hiding this comment.
I didn't review this before it merged, but I have this to say: I would have had not a single additional comment, and the refactoring in here is absolute goodness. Thank you.
|
🎉 Handy links: |
Summary of the Pull Request
Adds directional modifiers for SplitState and convert those to the appropriate horizontal/vertical when splitting a pane.
References
PR Checklist
Detailed Description of the Pull Request / Additional comments
"vertical" and "horizontal" splits were removed from
defaults.json, but code was added to parse those asrightanddownrespectively. It is also the case that if a user has a custom hotkey forsplit: verticalit will override the default forsplit: right.Validation Steps Performed
Split the pane using each of the new directional movements