<!-- 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 Add functionality to move a pane to another tab. If the tab index is greater than the number of current tabs a new tab will be created with the pane as its root. Similarly, if the last pane on a tab is moved to another tab, the original tab will be closed. This is largely complete, but I know that I'm messing around with things that I am unfamiliar with, and would like to avoid footguns where possible. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References #4587 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #7075 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [x] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [x] Schema updated. * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- 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 Things done: - Moving a pane to a new tab appears to work. Moving a pane to an existing tab mostly works. Moving a pane back to its original tab appears to work. - Set up {Attach,Detach}Pane methods to add or remove a pane from a pane. Detach is slightly different than Close in that we want to persist the tree structure and terminal controls. - Add `Detached` event on a pane that can be subscribed to to remove other event handlers if desired. - Added simple WalkTree abstraction for one-off recursion use cases that calls a provided function on each pane in order (and optionally terminates early). - Fixed an in-prod bug with closing panes. Specifically, if you have a tree (1; 2 3) and close the 1 pane, then 3 will lose its borders because of these lines clearing the border on both children https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/Pane.cpp#L1197-L1201 . To do: - Right now I have `TerminalTab` as a friend class of `Pane` so I can access some extra properties in my `WalkTree` callbacks, but there is probably a better choice for the abstraction boundary. Next Steps: - In a future PR Drag & Drop handlers could be added that utilize the Attach/Detach infrastructure to provide a better UI. - Similarly once this is working, it should be possible to convert an entire tab into a pane on an existing tab (Tab::DetachRoot on original tab followed by Tab::AttachPane on the target tab). - Its been 10 years, I just really want to use concepts already. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Manual testing by creating pane(s), and moving them between tabs and creating new tabs and destroying tabs by moving the last remaining pane.
305 lines
7.7 KiB
Plaintext
305 lines
7.7 KiB
Plaintext
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
namespace Microsoft.Terminal.Settings.Model
|
|
{
|
|
interface IActionArgs
|
|
{
|
|
Boolean Equals(IActionArgs other);
|
|
String GenerateName();
|
|
IActionArgs Copy();
|
|
UInt64 Hash();
|
|
};
|
|
|
|
interface IActionEventArgs
|
|
{
|
|
Boolean Handled;
|
|
IActionArgs ActionArgs { get; };
|
|
};
|
|
|
|
enum ResizeDirection
|
|
{
|
|
None = 0,
|
|
Left,
|
|
Right,
|
|
Up,
|
|
Down
|
|
};
|
|
|
|
enum FocusDirection
|
|
{
|
|
None = 0,
|
|
Left,
|
|
Right,
|
|
Up,
|
|
Down,
|
|
Previous
|
|
};
|
|
|
|
enum SplitState
|
|
{
|
|
Automatic = -1,
|
|
None = 0,
|
|
Vertical = 1,
|
|
Horizontal = 2
|
|
};
|
|
|
|
enum SplitType
|
|
{
|
|
Manual = 0,
|
|
Duplicate = 1
|
|
};
|
|
|
|
enum SettingsTarget
|
|
{
|
|
SettingsFile = 0,
|
|
DefaultsFile,
|
|
AllFiles,
|
|
SettingsUI
|
|
};
|
|
|
|
enum MoveTabDirection
|
|
{
|
|
None = 0,
|
|
Forward,
|
|
Backward
|
|
};
|
|
|
|
enum FindMatchDirection
|
|
{
|
|
None = 0,
|
|
Next,
|
|
Previous
|
|
};
|
|
|
|
enum CommandPaletteLaunchMode
|
|
{
|
|
Action = 0,
|
|
CommandLine
|
|
};
|
|
|
|
enum TabSwitcherMode
|
|
{
|
|
MostRecentlyUsed,
|
|
InOrder,
|
|
Disabled,
|
|
};
|
|
|
|
enum DesktopBehavior
|
|
{
|
|
Any,
|
|
ToCurrent,
|
|
OnCurrent,
|
|
};
|
|
|
|
enum MonitorBehavior
|
|
{
|
|
Any,
|
|
ToCurrent,
|
|
ToMouse,
|
|
};
|
|
|
|
[default_interface] runtimeclass NewTerminalArgs {
|
|
NewTerminalArgs();
|
|
NewTerminalArgs(Int32 profileIndex);
|
|
NewTerminalArgs Copy();
|
|
|
|
String Commandline;
|
|
String StartingDirectory;
|
|
String TabTitle;
|
|
Windows.Foundation.IReference<Windows.UI.Color> TabColor;
|
|
String Profile; // Either a GUID or a profile's name if the GUID isn't a match
|
|
// ProfileIndex can be null (for "use the default"), so this needs to be
|
|
// a IReference, so it's nullable
|
|
Windows.Foundation.IReference<Int32> ProfileIndex { get; };
|
|
|
|
Windows.Foundation.IReference<Boolean> SuppressApplicationTitle;
|
|
|
|
String ColorScheme;
|
|
|
|
Boolean Equals(NewTerminalArgs other);
|
|
String GenerateName();
|
|
String ToCommandline();
|
|
UInt64 Hash();
|
|
};
|
|
|
|
[default_interface] runtimeclass ActionEventArgs : IActionEventArgs
|
|
{
|
|
ActionEventArgs();
|
|
ActionEventArgs(IActionArgs args);
|
|
};
|
|
|
|
[default_interface] runtimeclass CopyTextArgs : IActionArgs
|
|
{
|
|
Boolean SingleLine { get; };
|
|
Windows.Foundation.IReference<Microsoft.Terminal.Control.CopyFormat> CopyFormatting { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass NewTabArgs : IActionArgs
|
|
{
|
|
NewTabArgs(NewTerminalArgs terminalArgs);
|
|
NewTerminalArgs TerminalArgs { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass MovePaneArgs : IActionArgs
|
|
{
|
|
MovePaneArgs(UInt32 tabIndex);
|
|
UInt32 TabIndex;
|
|
};
|
|
|
|
[default_interface] runtimeclass SwitchToTabArgs : IActionArgs
|
|
{
|
|
SwitchToTabArgs(UInt32 tabIndex);
|
|
UInt32 TabIndex;
|
|
};
|
|
|
|
[default_interface] runtimeclass ResizePaneArgs : IActionArgs
|
|
{
|
|
ResizeDirection ResizeDirection { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass MoveFocusArgs : IActionArgs
|
|
{
|
|
MoveFocusArgs(FocusDirection direction);
|
|
FocusDirection FocusDirection { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass SwapPaneArgs : IActionArgs
|
|
{
|
|
SwapPaneArgs(FocusDirection direction);
|
|
FocusDirection Direction { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass AdjustFontSizeArgs : IActionArgs
|
|
{
|
|
Int32 Delta { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass SendInputArgs : IActionArgs
|
|
{
|
|
String Input { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass SplitPaneArgs : IActionArgs
|
|
{
|
|
SplitPaneArgs(SplitType splitMode, SplitState split, Double size, NewTerminalArgs terminalArgs);
|
|
SplitPaneArgs(SplitState split, Double size, NewTerminalArgs terminalArgs);
|
|
SplitPaneArgs(SplitState split, NewTerminalArgs terminalArgs);
|
|
SplitPaneArgs(SplitType splitMode);
|
|
|
|
SplitState SplitStyle { get; };
|
|
NewTerminalArgs TerminalArgs { get; };
|
|
SplitType SplitMode { get; };
|
|
Double SplitSize { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass OpenSettingsArgs : IActionArgs
|
|
{
|
|
OpenSettingsArgs(SettingsTarget target);
|
|
SettingsTarget Target { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass SetColorSchemeArgs : IActionArgs
|
|
{
|
|
SetColorSchemeArgs(String name);
|
|
String SchemeName { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass SetTabColorArgs : IActionArgs
|
|
{
|
|
Windows.Foundation.IReference<Windows.UI.Color> TabColor { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass RenameTabArgs : IActionArgs
|
|
{
|
|
String Title { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass ExecuteCommandlineArgs : IActionArgs
|
|
{
|
|
ExecuteCommandlineArgs(String commandline);
|
|
String Commandline;
|
|
};
|
|
|
|
[default_interface] runtimeclass CloseOtherTabsArgs : IActionArgs
|
|
{
|
|
CloseOtherTabsArgs(UInt32 tabIndex);
|
|
Windows.Foundation.IReference<UInt32> Index { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass CloseTabsAfterArgs : IActionArgs
|
|
{
|
|
CloseTabsAfterArgs(UInt32 tabIndex);
|
|
Windows.Foundation.IReference<UInt32> Index { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass CloseTabArgs : IActionArgs
|
|
{
|
|
CloseTabArgs(UInt32 tabIndex);
|
|
Windows.Foundation.IReference<UInt32> Index { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass MoveTabArgs : IActionArgs
|
|
{
|
|
MoveTabArgs(MoveTabDirection direction);
|
|
MoveTabDirection Direction { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass ScrollUpArgs : IActionArgs
|
|
{
|
|
Windows.Foundation.IReference<UInt32> RowsToScroll { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass ScrollDownArgs : IActionArgs
|
|
{
|
|
Windows.Foundation.IReference<UInt32> RowsToScroll { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass ToggleCommandPaletteArgs : IActionArgs
|
|
{
|
|
CommandPaletteLaunchMode LaunchMode { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass FindMatchArgs : IActionArgs
|
|
{
|
|
FindMatchArgs(FindMatchDirection direction);
|
|
FindMatchDirection Direction { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass NewWindowArgs : IActionArgs
|
|
{
|
|
NewWindowArgs(NewTerminalArgs terminalArgs);
|
|
NewTerminalArgs TerminalArgs { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass PrevTabArgs : IActionArgs
|
|
{
|
|
Windows.Foundation.IReference<TabSwitcherMode> SwitcherMode;
|
|
};
|
|
|
|
[default_interface] runtimeclass NextTabArgs : IActionArgs
|
|
{
|
|
Windows.Foundation.IReference<TabSwitcherMode> SwitcherMode;
|
|
};
|
|
|
|
[default_interface] runtimeclass RenameWindowArgs : IActionArgs
|
|
{
|
|
String Name { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass GlobalSummonArgs : IActionArgs
|
|
{
|
|
String Name { get; };
|
|
DesktopBehavior Desktop { get; };
|
|
MonitorBehavior Monitor { get; };
|
|
Boolean ToggleVisibility { get; };
|
|
UInt32 DropdownDuration { get; };
|
|
};
|
|
|
|
[default_interface] runtimeclass FocusPaneArgs : IActionArgs
|
|
{
|
|
FocusPaneArgs(UInt32 Id);
|
|
UInt32 Id { get; };
|
|
};
|
|
}
|