Skip to content
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 the ability to interact with subtrees of panes #11153

Merged
28 commits merged into from
Sep 28, 2021

Conversation

Rosefield
Copy link
Contributor

@Rosefield Rosefield commented Sep 6, 2021

This commit adds the ability to interact with subtrees of panes.

Have you ever thought that you don't have enough regression testing to
do? Boy do I have the PR for you! This breaks all kinds of assumptions
about what is or is not focused, largely complicated by the fact that a
pane is not a proper control. I did my best to cover as many cases as I
could, but I wouldn't be surprised if there are some things broken that
I am unaware of.

Done:

  • Add parent and child movement directions to move up and down the
    tree respectively
  • When a parent pane is selected it will have borders all around it in
    addition to any borders the children have.
  • Fix focus, swap, split, zoom, toggle orientation, resize, and move to
    all handle interacting with more than one pane.
  • Similarly the actions for font size changing, closing, read-only, clearing
    buffer, and changing color scheme will distribute to all children.
  • This technically leaves control focus on the original control in the
    focused subtree because panes aren't proper controls themselves. This
    is also used to make sure we go back down the same path with the
    child movement.
  • You can zoom a parent pane, and click between different zoomed
    sub-panes and it won't unzoom you until you use moveFocus or another
    action. This wasn't explicitly programmed behavior so it is probably
    buggy (I've quashed a couple at least). It is a natural consequence of
    showing multiple terminals and allowing you to focus a terminal and a
    parent separately, since changing the active pane directly does not
    unzoom. This also means there can be a disconnect between what pane is
    zoomed and what pane is active.

Validation Steps Performed

Tested focus movement, swapping, moving panes, and zooming.

Closes #10733

- Add `parent` and `child` movement directions to move up and down the tree respectively
- When a parent pane is selected it will have borders all around it in addition to any borders the children have.
- Fix focus, swap, split, zoom, and move to all handle interacting with more than one pane.
- This technically leaves control focus on the first control in the focused subtree because panes aren't proper controls themselves.
@@ -646,13 +720,13 @@ std::pair<Pane::PanePoint, Pane::PanePoint> Pane::_GetOffsetsForPane(const PaneP

if (_splitState == SplitState::Horizontal)
{
secondOffset.y += (1 - _desiredSplitPosition) * parentOffset.scaleY;
secondOffset.y += _desiredSplitPosition * parentOffset.scaleY;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this is a bug in preview that directional movement will be broken during startup if you use splits that aren't 50%, but amplified with #11046 by removing the actual size logic.

…the parent. this allows us to maintain focus on the correct terminal and also go back down the correct path with the child navigation.
…t overwrite them if the two parents are related.
@github-actions

This comment has been minimized.

@DHowett
Copy link
Member

DHowett commented Sep 7, 2021

OH MY GOD IT IS HAPPENING DOT GIF

@zadjii-msft
Copy link
Member

for the record this is incredible. My apologies if this takes us a while to get to - we've got quite the backlog building up (which is a good thing), there's just too much amazing stuff landing all in this one release

@Rosefield
Copy link
Contributor Author

No worries, I know I have like 6 open PRs right now in addition to all the work everyone else is doing.

@zadjii-msft zadjii-msft added the Needs-Discussion Something that requires a team discussion before we can proceed label Sep 7, 2021
@carlos-zamora
Copy link
Member

No comments so far, but I still have to review Pane.cpp and TerminalTab.cpp (which are the big ones haha). I'll come back to this on Thursday (taking tomorrow off).

Don't forget to update the docs repo though.

Rosefield added a commit to Rosefield/terminal-1 that referenced this pull request Sep 7, 2021
@zadjii-msft zadjii-msft removed the Needs-Discussion Something that requires a team discussion before we can proceed label Sep 8, 2021
@zadjii-msft zadjii-msft self-assigned this Sep 9, 2021
@DHowett
Copy link
Member

DHowett commented Sep 10, 2021

Videos removed from body of future commit message


(some focus issues were fixed after these videos were taken)

2021-09-05.21-12-16.mp4

Also splitting and toggling

2021-09-05.21-18-52.mp4

Lastly resizing

2021-09-05.21-34-05.mp4

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. labels Sep 10, 2021
@DHowett
Copy link
Member

DHowett commented Sep 10, 2021

largely complicated by the fact that a
pane is not a proper control

(We do want to do this at some point -- there was a refactor in progress to make pane clearer/less clear/make it a control -- we just haven't landed it. If you are interested in horriffic, terrible upheaval and working on such a change . . . I wouldn't call it out-of-scope!)

@Rosefield
Copy link
Contributor Author

As much as I enjoy breaking things, I've read through the leaf/parent pane refactor PR before and I'm not quite in the mood for that much responsibility. That and reconciling it with my wake of carnage through pane.cpp from the last 2 months.

@DHowett
Copy link
Member

DHowett commented Sep 14, 2021

Whoops. I just launched Terminal into space by trying to move to the parent pane of the tab's root pane.

(Also, alt+[] are great bindings for parent/child. We may eventually choose to bind them by default, but probably not today!)

@Rosefield
Copy link
Contributor Author

Oops. When I added the previous child focus tracking I forgot that I needed to start checking for null.

…t-subtree-panes

 Conflicts:
	src/cascadia/TerminalApp/Pane.cpp
	src/cascadia/TerminalApp/TerminalTab.cpp
- font size changing, closing, read-only, clear buffer, changing color scheme all updated for parent panes
- Make the WalkTree function more ergonomic to use, so in the default case you don't have to return a bool
@carlos-zamora
Copy link
Member

Also it looks like clearing all of the shader effects buffers and recreating everything after resizing works better, but still not perfectly

Huh, is there any kind of stack I could get you or anything I can do to help? Repros 100% of the time on my machine, surprisingly.

@Rosefield
Copy link
Contributor Author

I think I found how the retro effects get broken in #11153 (comment) and then in #11153 (comment) I tried to fix it, but found that there were still cases where ResizeBuffers was still failing with the error that not all references were released.

@Rosefield
Copy link
Contributor Author

Rosefield commented Sep 24, 2021

With adding an additional retry for setting up the shader effects things work, but it is a rather brutish approach Rosefield@dab423f so I'm just leaving it off branch until someone else confirms that that is an acceptable fix (I suspect not).

Specifically, just the changes in StartPaint Rosefield@dab423f#diff-f80115eef2c2d285291b034c54555b50f683b1bf7e2d0a2c86392d28ad5ffc9cR1320-R1345 were not enough and the ResizeBuffers call would still fail if sometimes -> the _framecaptureBuffer gets released -> _PaintTerminalEffects fails because the buffer is a nullptr. My guess is that the failure is a resize + enable terminal effects on the same frame because the terminal hadn't rendered since before it was resized by the parent movement and I just forced a redraw when changing the terminal effects.

@Rosefield
Copy link
Contributor Author

I can actually get this bug to reproduce on the preview build.

Repro steps:

  1. on a pane enable visual effects
  2. disable visual effects on the same pane
  3. split the pane
  4. you can no longer turn on visual effects on the first pane.
2021-09-24.17-44-29.mp4

…t-subtree-panes

 Conflicts:
	src/cascadia/TerminalApp/Pane.cpp
…otherwise they hold onto buffer references that break resizing
@Rosefield
Copy link
Contributor Author

With the last commit I think I invalidate my previous comment(s), and found a minimal change that fixes the retro effects issue completely.

@Rosefield
Copy link
Contributor Author

Made color schemes preview on all panes.

@Rosefield
Copy link
Contributor Author

Also any idea why clang-format might be crashing? Mildly annoying that when I actually remember to format it doesn't always succeed at doing so.

image

@zadjii-msft
Copy link
Member

any idea why clang-format might be crashing

Woah, never seen that before. I'd guess it's just out of memory? But really no idea 🤷

miniksa added a commit that referenced this pull request Sep 28, 2021
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this in today's bug bash. The crash, retro effects bug, and previewable color scheme bug got fixed! Works excellent! Thank you!!

@carlos-zamora carlos-zamora removed their assignment Sep 28, 2021
@carlos-zamora carlos-zamora added the AutoMerge Marked for automatic merge by the bot when requirements are met label Sep 28, 2021
@ghost
Copy link

ghost commented Sep 28, 2021

Hello @carlos-zamora!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 4329731 into microsoft:main Sep 28, 2021
@Rosefield Rosefield deleted the feature/gh10733-select-subtree-panes branch September 28, 2021 19:16
@ghost
Copy link

ghost commented Oct 20, 2021

🎉Windows Terminal Preview v1.12.2922.0 has been released which incorporates this pull request.:tada:

Handy links:

ghost pushed a commit that referenced this pull request Dec 8, 2021
Some changes I had sitting around after working on #11153 that weren't
appropriate to put in that pr. Each commit should be  independent if
particular ones are unwanted.

Slight overlap with #11305. There is some more code removal that can be
done after that is merged, specifically `AttachPane` can be deleted once
`SplitPane` handles adding multiple panes at once correctly.

## Details
- Makes `WalkTree` more useful, and closer to a real iterator. Add a
  convenient `_FindPane` built on top of that.
- Coalesces `PrecalculateAutoSplit` and `PreCalculateCanSplit` since
  they are basically identical logic. 
- `Pane::Relayout` functionally did nothing because sizing was switched
  to `star` sizing at some point in the past, so it was just deleted.

## Validation 
Quick smoke test to make sure automatic splitting works, focus movement
still works correctly.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to select and interact with subtrees of panes
4 participants