c089ae0c57
## Summary of the Pull Request **Naive implementation** of exporting the text buffer of the current pane into a text file triggered from the tab context menu. **Disclaimer: this is not an export of the command history,** but rather just a text buffer dumped into a file when asked explicitly. ## References Should provide partial solution for #642. ## Detailed Description of the Pull Request / Additional comments The logic is following: * Open a file save picker * The location is Downloads folder (should be always accessible) * The suggest name of the file equals to the pane's title * The allowed file formats list contains .txt only * If no file selected stop * Lock terminal * Read all lines till the cursor * Format each line by removing trailing white-spaces and adding CRLF if not wrapped * Asynchronously write to selected file * Show confirmation As the action is relatively fast didn't add a progress bar or any other UX. As the buffer is relatively small, holding it entirely in the memory rather than writing line by line to disk.
74 lines
3.3 KiB
Plaintext
74 lines
3.3 KiB
Plaintext
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
import "IMouseWheelListener.idl";
|
|
import "IControlSettings.idl";
|
|
import "IDirectKeyListener.idl";
|
|
import "EventArgs.idl";
|
|
import "ICoreState.idl";
|
|
|
|
namespace Microsoft.Terminal.Control
|
|
{
|
|
|
|
[default_interface] runtimeclass TermControl : Windows.UI.Xaml.Controls.UserControl,
|
|
IDirectKeyListener,
|
|
IMouseWheelListener,
|
|
ICoreState
|
|
{
|
|
TermControl(IControlSettings settings,
|
|
Microsoft.Terminal.TerminalConnection.ITerminalConnection connection);
|
|
|
|
static Windows.Foundation.Size GetProposedDimensions(IControlSettings settings, UInt32 dpi);
|
|
|
|
void UpdateSettings();
|
|
|
|
Microsoft.Terminal.Control.IControlSettings Settings;
|
|
Microsoft.Terminal.Control.IControlAppearance UnfocusedAppearance;
|
|
|
|
event FontSizeChangedEventArgs FontSizeChanged;
|
|
event Windows.Foundation.TypedEventHandler<Object, TitleChangedEventArgs> TitleChanged;
|
|
event Windows.Foundation.TypedEventHandler<Object, CopyToClipboardEventArgs> CopyToClipboard;
|
|
event Windows.Foundation.TypedEventHandler<Object, PasteFromClipboardEventArgs> PasteFromClipboard;
|
|
event Windows.Foundation.TypedEventHandler<Object, OpenHyperlinkEventArgs> OpenHyperlink;
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> SetTaskbarProgress;
|
|
event Windows.Foundation.TypedEventHandler<Object, NoticeEventArgs> RaiseNotice;
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> WarningBell;
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> HidePointerCursor;
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> RestorePointerCursor;
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> TabColorChanged;
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> ReadOnlyChanged;
|
|
event Windows.Foundation.TypedEventHandler<Object, Object> FocusFollowMouseRequested;
|
|
|
|
event Windows.Foundation.TypedEventHandler<TermControl, Windows.UI.Xaml.RoutedEventArgs> Initialized;
|
|
// 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<Object, IInspectable> ConnectionStateChanged;
|
|
|
|
Boolean CopySelectionToClipboard(Boolean singleLine, Windows.Foundation.IReference<CopyFormat> formats);
|
|
void PasteTextFromClipboard();
|
|
void Close();
|
|
Windows.Foundation.Size CharacterDimensions { get; };
|
|
Windows.Foundation.Size MinimumSize { get; };
|
|
Single SnapDimensionToGrid(Boolean widthOrHeight, Single dimension);
|
|
|
|
void ScrollViewport(Int32 viewTop);
|
|
|
|
void CreateSearchBoxControl();
|
|
|
|
void SearchMatch(Boolean goForward);
|
|
|
|
void AdjustFontSize(Int32 fontSizeDelta);
|
|
void ResetFontSize();
|
|
|
|
void ToggleShaderEffects();
|
|
void SendInput(String input);
|
|
|
|
void BellLightOn();
|
|
|
|
Boolean ReadOnly { get; };
|
|
void ToggleReadOnly();
|
|
|
|
String ReadEntireBuffer();
|
|
}
|
|
}
|