2019-05-03 00:29:04 +02:00
|
|
|
// Copyright (c) Microsoft Corporation.
|
|
|
|
// Licensed under the MIT license.
|
|
|
|
|
|
|
|
namespace Microsoft.Terminal.TerminalControl
|
|
|
|
{
|
|
|
|
delegate void TitleChangedEventArgs(String newTitle);
|
|
|
|
delegate void ScrollPositionChangedEventArgs(Int32 viewTop, Int32 viewHeight, Int32 bufferLength);
|
2019-08-20 00:59:01 +02:00
|
|
|
|
|
|
|
runtimeclass CopyToClipboardEventArgs
|
|
|
|
{
|
|
|
|
String Text { get; };
|
|
|
|
String Html { get; };
|
2019-11-13 21:13:22 +01:00
|
|
|
String Rtf { get; };
|
2019-08-20 00:59:01 +02:00
|
|
|
}
|
2019-05-03 00:29:04 +02:00
|
|
|
|
|
|
|
runtimeclass PasteFromClipboardEventArgs
|
|
|
|
{
|
|
|
|
void HandleClipboardData(String data);
|
|
|
|
}
|
|
|
|
|
2019-08-17 00:43:51 +02:00
|
|
|
[default_interface] runtimeclass TermControl : Windows.UI.Xaml.Controls.UserControl
|
2019-05-03 00:29:04 +02:00
|
|
|
{
|
|
|
|
TermControl();
|
2019-06-28 19:55:46 +02:00
|
|
|
TermControl(Microsoft.Terminal.Settings.IControlSettings settings, Microsoft.Terminal.TerminalConnection.ITerminalConnection connection);
|
2019-05-03 00:29:04 +02:00
|
|
|
|
|
|
|
static Windows.Foundation.Point GetProposedDimensions(Microsoft.Terminal.Settings.IControlSettings settings, UInt32 dpi);
|
|
|
|
|
|
|
|
void UpdateSettings(Microsoft.Terminal.Settings.IControlSettings newSettings);
|
|
|
|
|
|
|
|
event TitleChangedEventArgs TitleChanged;
|
2019-08-20 00:59:01 +02:00
|
|
|
event Windows.Foundation.TypedEventHandler<TermControl, CopyToClipboardEventArgs> CopyToClipboard;
|
2019-05-03 00:29:04 +02:00
|
|
|
event Windows.Foundation.TypedEventHandler<TermControl, PasteFromClipboardEventArgs> PasteFromClipboard;
|
|
|
|
|
2019-11-25 23:22:29 +01:00
|
|
|
// This is an event handler forwarder for the underlying connection.
|
|
|
|
// We expose this and ConnectionState here so that it might eventually be data bound.
|
|
|
|
event Windows.Foundation.TypedEventHandler<TermControl, IInspectable> ConnectionStateChanged;
|
|
|
|
Microsoft.Terminal.TerminalConnection.ConnectionState ConnectionState { get; };
|
|
|
|
|
2019-05-03 00:29:04 +02:00
|
|
|
String Title { get; };
|
2019-08-17 00:43:51 +02:00
|
|
|
|
|
|
|
Boolean CopySelectionToClipboard(Boolean trimTrailingWhitespace);
|
2019-06-25 21:17:02 +02:00
|
|
|
void PasteTextFromClipboard();
|
2019-05-03 00:29:04 +02:00
|
|
|
void Close();
|
Enable resizing the panes with the keyboard. (#1207)
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.
2019-07-10 15:27:12 +02:00
|
|
|
Windows.Foundation.Size CharacterDimensions { get; };
|
|
|
|
Windows.Foundation.Size MinimumSize { get; };
|
2019-05-03 00:29:04 +02:00
|
|
|
|
|
|
|
void ScrollViewport(Int32 viewTop);
|
2019-05-23 22:39:29 +02:00
|
|
|
void KeyboardScrollViewport(Int32 viewTop);
|
2019-05-03 00:29:04 +02:00
|
|
|
Int32 GetScrollOffset();
|
2019-05-15 15:21:14 +02:00
|
|
|
Int32 GetViewHeight();
|
2019-05-03 00:29:04 +02:00
|
|
|
event ScrollPositionChangedEventArgs ScrollPositionChanged;
|
2019-09-30 15:18:05 +02:00
|
|
|
|
Search - add search box control and implement search experience (#3590)
<!-- 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)? -->
This is the PR for feature Search: #605
This PR includes the newly introduced SearchBoxControl in TermControl dir, which is the search bar for the search experience. And the codes that enable Search in Windows Terminal.
<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? -->
The PR that migrates the Conhost search module: https://github.com/microsoft/terminal/pull/3279
Spec (still actively updating): https://github.com/microsoft/terminal/pull/3299
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [x] Closes #605
* [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [ ] Requires documentation to be 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 -->
These functionalities are included in the search experience.
1. Search in Terminal text buffer.
2. Automatic wrap-around.
3. Search up or down switch by clicking different buttons.
4. Search case sensitively/insensitively by clicking a button. S. Move the search box to the top/bottom by clicking a button.
6. Close by clicking 'X'.
7. Open search by ctrl + F.
When the searchbox is open, the user could still interact with the terminal by clicking the terminal input area.
While I already have the search functionalities, currently there are still some known to-do works and I will keep updating my PR:
1. Optimize the search box UI, this includes:
1) Theme adaptation. The search box background and font color
should change according to the theme,
2) Add background. Currently the elements in search box are all
transparent. However, we need a background.
3) Move button should be highlighted once clicked.
2. Accessibility: search process should be able to performed without mouse. Once the search box is focused, the user should be able to navigate between all interactive elements on the searchbox using keyboard.
<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
To test:
1. checkout this branch.
2. Build the project.
3. Start Windows Terminal and press Ctrl+F
4. The search box should appear on the top right corner.
2019-12-17 16:52:37 +01:00
|
|
|
void CreateSearchBoxControl();
|
|
|
|
|
2019-09-30 15:18:05 +02:00
|
|
|
void AdjustFontSize(Int32 fontSizeDelta);
|
2019-11-25 18:35:10 +01:00
|
|
|
void ResetFontSize();
|
2019-05-03 00:29:04 +02:00
|
|
|
}
|
|
|
|
}
|