mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-13 09:41:02 +00:00
Compare commits
4 Commits
dev/duhowe
...
dev/lhecke
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdd181b44b | ||
|
|
ad19d2c967 | ||
|
|
5f311506dc | ||
|
|
22c509f426 |
2
.github/ISSUE_TEMPLATE/Bug_Report.yml
vendored
2
.github/ISSUE_TEMPLATE/Bug_Report.yml
vendored
@@ -22,7 +22,7 @@ body:
|
||||
- type: input
|
||||
attributes:
|
||||
label: Windows build number
|
||||
placeholder: "10.0.22621.0"
|
||||
placeholder: "10.0.26100.0"
|
||||
description: |
|
||||
Please run `ver` or `[Environment]::OSVersion`.
|
||||
validations:
|
||||
|
||||
2
.github/actions/spelling/expect/expect.txt
vendored
2
.github/actions/spelling/expect/expect.txt
vendored
@@ -86,6 +86,7 @@ autoscrolling
|
||||
Autowrap
|
||||
AVerify
|
||||
awch
|
||||
AZCOPY
|
||||
azurecr
|
||||
AZZ
|
||||
backgrounded
|
||||
@@ -1416,6 +1417,7 @@ propvar
|
||||
propvariant
|
||||
propvarutil
|
||||
psa
|
||||
PSCRED
|
||||
PSECURITY
|
||||
pseudoconsole
|
||||
pseudoterminal
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"Microsoft.VisualStudio.Component.CodeMap",
|
||||
"Microsoft.VisualStudio.Component.VC.CoreIde",
|
||||
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||
"Microsoft.VisualStudio.Component.Windows11SDK.22621",
|
||||
"Microsoft.VisualStudio.Component.Windows11SDK.26100",
|
||||
"Microsoft.VisualStudio.ComponentGroup.MSIX.Packaging",
|
||||
"Microsoft.VisualStudio.ComponentGroup.WindowsAppSDK.Cs",
|
||||
"Microsoft.ComponentGroup.Blend",
|
||||
|
||||
@@ -359,7 +359,7 @@ winget configure .config\configuration.winget
|
||||
app](https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development)
|
||||
to locally install and run Windows Terminal
|
||||
* You must have [PowerShell 7 or later](https://github.com/PowerShell/PowerShell/releases/latest) installed
|
||||
* You must have the [Windows 11 (10.0.22621.0)
|
||||
* You must have the [Windows 11 (10.0.26100.0)
|
||||
SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/)
|
||||
installed
|
||||
* You must have at least [VS
|
||||
|
||||
@@ -25,7 +25,7 @@ variables:
|
||||
extends:
|
||||
template: templates-v2/pipeline-onebranch-full-release-build.yml
|
||||
parameters:
|
||||
official: false
|
||||
official: true
|
||||
branding: Canary
|
||||
buildTerminal: true
|
||||
pgoBuildMode: None # BODGY - OneBranch is on VS 17.10, which is known to be the worst
|
||||
@@ -44,7 +44,6 @@ extends:
|
||||
symbolExpiryTime: 15
|
||||
symbolPublishingSubscription: $(SymbolPublishingServiceConnection)
|
||||
symbolPublishingProject: $(SymbolPublishingProject)
|
||||
buildPlatforms: [x64]
|
||||
${{ if eq(true, parameters.publishToAzure) }}:
|
||||
extraPublishJobs:
|
||||
- template: build/pipelines/templates-v2/job-deploy-to-azure-storage.yml@self
|
||||
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
${{ else }}:
|
||||
OutputBuildPlatform: ${{ platform }}
|
||||
variables:
|
||||
MakeAppxPath: 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\MakeAppx.exe'
|
||||
MakeAppxPath: 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\MakeAppx.exe'
|
||||
Terminal.BinDir: $(Build.SourcesDirectory)/bin/$(OutputBuildPlatform)/$(BuildConfiguration)
|
||||
# Azure DevOps abhors a vacuum
|
||||
# If these are blank, expansion will fail later on... which will result in direct substitution of the variable *names*
|
||||
@@ -115,10 +115,6 @@ jobs:
|
||||
clean: true
|
||||
submodules: true
|
||||
persistCredentials: True
|
||||
- template: steps-install-powershell-modules.yml
|
||||
parameters:
|
||||
modules: [Az.Accounts, Az.Storage, Az.Network, Az.Resources, Az.Compute]
|
||||
|
||||
|
||||
# This generates either nothing for BuildTargetParameter, or /t:X;Y;Z, to control targets later.
|
||||
- pwsh: |-
|
||||
|
||||
@@ -75,17 +75,13 @@ jobs:
|
||||
}
|
||||
displayName: "Wrangle Unpackaged builds into place, rename"
|
||||
|
||||
- template: steps-install-powershell-modules.yml
|
||||
parameters:
|
||||
modules: [Az.Accounts, Az.Storage, Az.Network, Az.Resources, Az.Compute]
|
||||
|
||||
- task: AzureFileCopy@6
|
||||
- task: AzurePowerShell@5
|
||||
displayName: Publish to Storage Account
|
||||
inputs:
|
||||
sourcePath: _out/*
|
||||
Destination: AzureBlob
|
||||
azureSubscription: ${{ parameters.subscription }}
|
||||
storage: ${{ parameters.storageAccount }}
|
||||
ContainerName: ${{ parameters.storageContainer }}
|
||||
AdditionalArgumentsForBlobCopy: "--content-type application/octet-stream"
|
||||
|
||||
azurePowerShellVersion: LatestVersion
|
||||
pwsh: true
|
||||
ScriptType: InlineScript
|
||||
Inline: |-
|
||||
$Env:AZCOPY_AUTO_LOGIN_TYPE="PSCRED"
|
||||
& AzCopy copy "_out\*" "https://${{ parameters.storageAccount }}.blob.core.windows.net/${{ parameters.storageContainer }}/" --content-type application/octet-stream
|
||||
|
||||
@@ -52,10 +52,6 @@ jobs:
|
||||
itemPattern: '**/*.pdb'
|
||||
targetPath: '$(Build.SourcesDirectory)/bin'
|
||||
|
||||
- template: steps-install-powershell-modules.yml
|
||||
parameters:
|
||||
modules: [Az.Accounts, Az.Storage, Az.Network, Az.Resources, Az.Compute]
|
||||
|
||||
# Transit the Azure token from the Service Connection into a secret variable for the rest of the pipeline to use.
|
||||
- task: AzurePowerShell@5
|
||||
displayName: Generate an Azure Token
|
||||
|
||||
@@ -78,7 +78,9 @@ extends:
|
||||
template: v2/Microsoft.NonOfficial.yml@templates
|
||||
parameters:
|
||||
featureFlags:
|
||||
WindowsHostVersion: 1ESWindows2022
|
||||
WindowsHostVersion:
|
||||
Version: 2022
|
||||
Network: R1
|
||||
platform:
|
||||
name: 'windows_undocked'
|
||||
product: 'Windows Terminal'
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
steps:
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: Use NuGet 6.6.1
|
||||
inputs:
|
||||
versionSpec: 6.6.1
|
||||
- ${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
|
||||
- pwsh: |-
|
||||
Write-Host "Assuming NuGet is already installed..."
|
||||
& nuget.exe help
|
||||
displayName: Assume NuGet is fine
|
||||
|
||||
- ${{ else }}:
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: Use NuGet 6.6.1
|
||||
inputs:
|
||||
versionSpec: 6.6.1
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
parameters:
|
||||
- name: modules
|
||||
type: object
|
||||
default: []
|
||||
|
||||
steps:
|
||||
- pwsh: |-
|
||||
Register-PSResourceRepository -Name TerminalDependencies -Uri https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies/nuget/v2 -Trusted -ErrorAction:Ignore
|
||||
Install-PSResource -Repository TerminalDependencies -Name ${{ join(',',parameters.modules) }} -Debug -Verbose -Confirm:$false -AcceptLicense -TrustRepository -Reinstall
|
||||
displayName: Install Modules for PowerShell 7+
|
||||
|
||||
- powershell: |-
|
||||
Register-PSResourceRepository -Name TerminalDependencies -Uri https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies/nuget/v2 -Trusted -ErrorAction:Ignore
|
||||
Install-PSResource -Repository TerminalDependencies -Name ${{ join(',',parameters.modules) }} -Debug -Verbose -Confirm:$false -AcceptLicense -TrustRepository -Reinstall
|
||||
displayName: Install Modules for PowerShell 5.1
|
||||
@@ -22,7 +22,7 @@ Param(
|
||||
[Parameter(HelpMessage="Path to makeappx.exe")]
|
||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||
[string]
|
||||
$MakeAppxPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\MakeAppx.exe"
|
||||
$MakeAppxPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\MakeAppx.exe"
|
||||
)
|
||||
|
||||
If ($null -Eq (Get-Item $MakeAppxPath -EA:SilentlyContinue)) {
|
||||
|
||||
@@ -16,7 +16,7 @@ Param(
|
||||
[Parameter(HelpMessage="Path to makepri.exe")]
|
||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||
[string]
|
||||
$MakePriPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\MakePri.exe"
|
||||
$MakePriPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\MakePri.exe"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
@@ -17,7 +17,7 @@ Param(
|
||||
[Parameter(HelpMessage="Path to makepri.exe")]
|
||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||
[string]
|
||||
$MakePriPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\MakePri.exe"
|
||||
$MakePriPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\MakePri.exe"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
@@ -25,7 +25,7 @@ Param(
|
||||
[Parameter(HelpMessage="Path to makeappx.exe", ParameterSetName='Layout')]
|
||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||
[string]
|
||||
$MakeAppxPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\MakeAppx.exe",
|
||||
$MakeAppxPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\MakeAppx.exe",
|
||||
|
||||
[Parameter(HelpMessage="Include the portable mode marker file by default", ParameterSetName='AppX')]
|
||||
[Parameter(HelpMessage="Include the portable mode marker file by default", ParameterSetName='Layout')]
|
||||
|
||||
@@ -8,7 +8,7 @@ Param(
|
||||
[Parameter(HelpMessage="Path to Windows Kit")]
|
||||
[ValidateScript({Test-Path $_ -Type Leaf})]
|
||||
[string]
|
||||
$WindowsKitPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0"
|
||||
$WindowsKitPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<ProjectGuid>{96274800-9574-423E-892A-909FBE2AC8BE}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>EchoCon</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.26100.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.22621.0" />
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26100.0" />
|
||||
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug" MinVersion="14.0.27023.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
||||
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug.UWPDesktop" MinVersion="14.0.27027.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
||||
</Dependencies>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<uap:SupportedUsers>multiple</uap:SupportedUsers>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.22621.0" />
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26100.0" />
|
||||
</Dependencies>
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
|
||||
@@ -1831,9 +1831,23 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
}
|
||||
|
||||
FILETIME lastWriteTime;
|
||||
FILETIME localFileTime;
|
||||
SYSTEMTIME lastWriteSystemTime;
|
||||
if (!GetFileTime(file.get(), nullptr, nullptr, &lastWriteTime) ||
|
||||
!FileTimeToSystemTime(&lastWriteTime, &lastWriteSystemTime))
|
||||
|
||||
// Get the last write time in UTC
|
||||
if (!GetFileTime(file.get(), nullptr, nullptr, &lastWriteTime))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert UTC FILETIME to local FILETIME
|
||||
if (!FileTimeToLocalFileTime(&lastWriteTime, &localFileTime))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert local FILETIME to SYSTEMTIME
|
||||
if (!FileTimeToSystemTime(&localFileTime, &lastWriteSystemTime))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<Description>TAEF Packaged Cwa FullTrust Application Host Process</Description>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.22621.0" />
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.18362.0" MaxVersionTested="10.0.26100.0" />
|
||||
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug" MinVersion="14.0.27023.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
||||
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug.UWPDesktop" MinVersion="14.0.27027.1" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
||||
</Dependencies>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Label="Globals">
|
||||
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0.22621.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">10.0.26100.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion Condition="'$(WindowsTargetPlatformMinVersion)' == ''">10.0.18362.0</WindowsTargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -112,6 +112,20 @@ COLORREF RenderSettings::GetColorTableEntry(const size_t tableIndex) const
|
||||
return _colorTable.at(tableIndex);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Restores all of the xterm-addressable colors to the ones saved in SaveDefaultSettings.
|
||||
void RenderSettings::RestoreDefaultIndexed256ColorTable()
|
||||
{
|
||||
std::copy_n(_defaultColorTable.begin(), 256, _colorTable.begin());
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Restores a color table entry to the value saved in SaveDefaultSettings.
|
||||
void RenderSettings::RestoreDefaultColorTableEntry(const size_t tableIndex)
|
||||
{
|
||||
_colorTable.at(tableIndex) = _defaultColorTable.at(tableIndex);
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Sets the position in the color table for the given color alias and updates the color.
|
||||
// Arguments:
|
||||
@@ -159,6 +173,11 @@ size_t RenderSettings::GetColorAliasIndex(const ColorAlias alias) const noexcept
|
||||
return gsl::at(_colorAliasIndices, static_cast<size_t>(alias));
|
||||
}
|
||||
|
||||
void RenderSettings::RestoreDefaultColorAliasIndex(const ColorAlias alias) noexcept
|
||||
{
|
||||
gsl::at(_colorAliasIndices, static_cast<size_t>(alias)) = gsl::at(_defaultColorAliasIndices, static_cast<size_t>(alias));
|
||||
}
|
||||
|
||||
// Routine Description:
|
||||
// - Calculates the RGB colors of a given text attribute, using the current
|
||||
// color table configuration and active render settings.
|
||||
|
||||
@@ -37,10 +37,13 @@ namespace Microsoft::Console::Render
|
||||
void ResetColorTable() noexcept;
|
||||
void SetColorTableEntry(const size_t tableIndex, const COLORREF color);
|
||||
COLORREF GetColorTableEntry(const size_t tableIndex) const;
|
||||
void RestoreDefaultIndexed256ColorTable();
|
||||
void RestoreDefaultColorTableEntry(const size_t tableIndex);
|
||||
void SetColorAlias(const ColorAlias alias, const size_t tableIndex, const COLORREF color);
|
||||
COLORREF GetColorAlias(const ColorAlias alias) const;
|
||||
void SetColorAliasIndex(const ColorAlias alias, const size_t tableIndex) noexcept;
|
||||
size_t GetColorAliasIndex(const ColorAlias alias) const noexcept;
|
||||
void RestoreDefaultColorAliasIndex(const ColorAlias alias) noexcept;
|
||||
std::pair<COLORREF, COLORREF> GetAttributeColors(const TextAttribute& attr) const noexcept;
|
||||
std::pair<COLORREF, COLORREF> GetAttributeColorsWithAlpha(const TextAttribute& attr) const noexcept;
|
||||
COLORREF GetAttributeUnderlineColor(const TextAttribute& attr) const noexcept;
|
||||
|
||||
@@ -78,8 +78,11 @@ public:
|
||||
virtual void TabSet(const VTParameter setType) = 0; // DECST8C
|
||||
virtual void SetColorTableEntry(const size_t tableIndex, const DWORD color) = 0; // OSCSetColorTable
|
||||
virtual void RequestColorTableEntry(const size_t tableIndex) = 0; // OSCGetColorTable
|
||||
virtual void SetXtermColorResource(const size_t resource, const DWORD color) = 0; // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor, OSCResetCursorColor
|
||||
virtual void ResetColorTable() = 0; // OSCResetColorTable
|
||||
virtual void ResetColorTableEntry(const size_t tableIndex) = 0; // OSCResetColorTable
|
||||
virtual void SetXtermColorResource(const size_t resource, const DWORD color) = 0; // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor
|
||||
virtual void RequestXtermColorResource(const size_t resource) = 0; // OSCGetDefaultForeground, OSCGetDefaultBackground, OSCGetCursorColor
|
||||
virtual void ResetXtermColorResource(const size_t resource) = 0; // OSCResetForegroundColor, OSCResetBackgroundColor, OSCResetCursorColor, OSCResetHighlightColor
|
||||
virtual void AssignColor(const DispatchTypes::ColorItem item, const VTInt fgIndex, const VTInt bgIndex) = 0; // DECAC
|
||||
|
||||
virtual void EraseInDisplay(const DispatchTypes::EraseType eraseType) = 0; // ED
|
||||
|
||||
@@ -3292,6 +3292,40 @@ void AdaptDispatch::RequestColorTableEntry(const size_t tableIndex)
|
||||
}
|
||||
}
|
||||
|
||||
void AdaptDispatch::ResetColorTable()
|
||||
{
|
||||
_renderSettings.RestoreDefaultIndexed256ColorTable();
|
||||
if (_renderer)
|
||||
{
|
||||
// This is pessimistic because it's unlikely that the frame or background changed,
|
||||
// but let's tell the renderer that both changed anyway.
|
||||
_renderer->TriggerRedrawAll(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Restores a single color table entry to its default user-specified value
|
||||
// Arguments:
|
||||
// - tableIndex: The VT color table index
|
||||
void AdaptDispatch::ResetColorTableEntry(const size_t tableIndex)
|
||||
{
|
||||
_renderSettings.RestoreDefaultColorTableEntry(tableIndex);
|
||||
|
||||
if (_renderer)
|
||||
{
|
||||
// If we're updating the background color, we need to let the renderer
|
||||
// know, since it may want to repaint the window background to match.
|
||||
const auto backgroundIndex = _renderSettings.GetColorAliasIndex(ColorAlias::DefaultBackground);
|
||||
const auto backgroundChanged = (tableIndex == backgroundIndex);
|
||||
|
||||
// Similarly for the frame color, the tab may need to be repainted.
|
||||
const auto frameIndex = _renderSettings.GetColorAliasIndex(ColorAlias::FrameBackground);
|
||||
const auto frameChanged = (tableIndex == frameIndex);
|
||||
|
||||
_renderer->TriggerRedrawAll(backgroundChanged, frameChanged);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Sets one Xterm Color Resource such as Default Foreground, Background, Cursor
|
||||
void AdaptDispatch::SetXtermColorResource(const size_t resource, const DWORD color)
|
||||
@@ -3338,6 +3372,25 @@ void AdaptDispatch::RequestXtermColorResource(const size_t resource)
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Restores to the original user-provided value one Xterm Color Resource such as Default Foreground, Background, Cursor
|
||||
void AdaptDispatch::ResetXtermColorResource(const size_t resource)
|
||||
{
|
||||
assert(resource >= 10);
|
||||
const auto mappingIndex = resource - 10;
|
||||
const auto& oscMapping = XtermResourceColorTableMappings.at(mappingIndex);
|
||||
if (oscMapping.ColorTableIndex > 0)
|
||||
{
|
||||
if (oscMapping.AliasIndex >= 0)
|
||||
{
|
||||
// If this color reset applies to an aliased color, point the alias back at the original color
|
||||
_renderSettings.RestoreDefaultColorAliasIndex(static_cast<ColorAlias>(oscMapping.AliasIndex));
|
||||
}
|
||||
|
||||
ResetColorTableEntry(oscMapping.ColorTableIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// DECAC - Assigns the foreground and background color indexes that should be
|
||||
// used for a given aspect of the user interface.
|
||||
|
||||
@@ -133,8 +133,11 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
void SetColorTableEntry(const size_t tableIndex,
|
||||
const DWORD color) override; // OSCSetColorTable
|
||||
void RequestColorTableEntry(const size_t tableIndex) override; // OSCGetColorTable
|
||||
void SetXtermColorResource(const size_t resource, const DWORD color) override; // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor, OSCResetCursorColor
|
||||
void ResetColorTable() override; // OSCResetColorTable
|
||||
void ResetColorTableEntry(const size_t tableIndex) override; // OSCResetColorTable
|
||||
void SetXtermColorResource(const size_t resource, const DWORD color) override; // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor
|
||||
void RequestXtermColorResource(const size_t resource) override; // OSCGetDefaultForeground, OSCGetDefaultBackground, OSCGetCursorColor
|
||||
void ResetXtermColorResource(const size_t resource) override; // OSCResetForegroundColor, OSCResetBackgroundColor, OSCResetCursorColor, OSCResetHighlightColor
|
||||
void AssignColor(const DispatchTypes::ColorItem item, const VTInt fgIndex, const VTInt bgIndex) override; // DECAC
|
||||
|
||||
void WindowManipulation(const DispatchTypes::WindowManipulationType function,
|
||||
|
||||
@@ -71,8 +71,11 @@ public:
|
||||
void TabSet(const VTParameter /*setType*/) override {} // DECST8C
|
||||
void SetColorTableEntry(const size_t /*tableIndex*/, const DWORD /*color*/) override {} // OSCSetColorTable
|
||||
void RequestColorTableEntry(const size_t /*tableIndex*/) override {} // OSCGetColorTable
|
||||
void SetXtermColorResource(const size_t /*resource*/, const DWORD /*color*/) override {} // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor, OSCResetCursorColor
|
||||
void ResetColorTable() override {} // OSCResetColorTable
|
||||
void ResetColorTableEntry(const size_t /*tableIndex*/) override {} // OSCResetColorTable
|
||||
void SetXtermColorResource(const size_t /*resource*/, const DWORD /*color*/) override {} // OSCSetDefaultForeground, OSCSetDefaultBackground, OSCSetCursorColor
|
||||
void RequestXtermColorResource(const size_t /*resource*/) override {} // OSCGetDefaultForeground, OSCGetDefaultBackground, OSCGetCursorColor
|
||||
void ResetXtermColorResource(const size_t /*resource*/) override {} // OSCResetForegroundColor, OSCResetBackgroundColor, OSCResetCursorColor, OSCResetHighlightColor
|
||||
void AssignColor(const DispatchTypes::ColorItem /*item*/, const VTInt /*fgIndex*/, const VTInt /*bgIndex*/) override {} // DECAC
|
||||
|
||||
void EraseInDisplay(const DispatchTypes::EraseType /* eraseType*/) override {} // ED
|
||||
|
||||
@@ -810,10 +810,40 @@ bool OutputStateMachineEngine::ActionOscDispatch(const size_t parameter, const s
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::ResetCursorColor:
|
||||
case OscActionCodes::ResetColor:
|
||||
{
|
||||
// The reset codes for xterm dynamic resources are the set codes + 100
|
||||
_dispatch->SetXtermColorResource(parameter - 100u, INVALID_COLOR);
|
||||
if (string.empty())
|
||||
{
|
||||
_dispatch->ResetColorTable();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto&& c : til::split_iterator{ string, L';' })
|
||||
{
|
||||
if (const auto index{ til::parse_unsigned<size_t>(c, 10) }; index)
|
||||
{
|
||||
_dispatch->ResetColorTableEntry(*index);
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE: xterm stops at the first unparseable index whereas VTE keeps going.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::ResetForegroundColor:
|
||||
case OscActionCodes::ResetBackgroundColor:
|
||||
case OscActionCodes::ResetCursorColor:
|
||||
case OscActionCodes::ResetHighlightColor:
|
||||
{
|
||||
// NOTE: xterm ignores the request if there's any parameters whereas VTE resets the provided index and ignores the rest
|
||||
if (string.empty())
|
||||
{
|
||||
// The reset codes for xterm dynamic resources are the set codes + 100
|
||||
_dispatch->ResetXtermColorResource(parameter - 100u);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OscActionCodes::Hyperlink:
|
||||
|
||||
@@ -214,9 +214,11 @@ namespace Microsoft::Console::VirtualTerminal
|
||||
SetHighlightColor = 17,
|
||||
DECSWT_SetWindowTitle = 21,
|
||||
SetClipboard = 52,
|
||||
ResetForegroundColor = 110, // Not implemented
|
||||
ResetBackgroundColor = 111, // Not implemented
|
||||
ResetColor = 104,
|
||||
ResetForegroundColor = 110,
|
||||
ResetBackgroundColor = 111,
|
||||
ResetCursorColor = 112,
|
||||
ResetHighlightColor = 117,
|
||||
FinalTermAction = 133,
|
||||
VsCodeAction = 633,
|
||||
ITerm2Action = 1337,
|
||||
|
||||
@@ -1163,7 +1163,8 @@ public:
|
||||
_hyperlinkMode{ false },
|
||||
_options{ s_cMaxOptions, static_cast<DispatchTypes::GraphicsOptions>(s_uiGraphicsCleared) }, // fill with cleared option
|
||||
_colorTable{},
|
||||
_setColorTableEntry{ false }
|
||||
_setColorTableEntry{ false },
|
||||
_resetAllColors{ false }
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1390,6 +1391,16 @@ public:
|
||||
_colorTableEntriesRequested.push_back(tableIndex);
|
||||
}
|
||||
|
||||
void ResetColorTable() noexcept override
|
||||
{
|
||||
_resetAllColors = true;
|
||||
}
|
||||
|
||||
void ResetColorTableEntry(const size_t tableIndex) noexcept override
|
||||
{
|
||||
_colorTableEntriesReset.push_back(tableIndex);
|
||||
}
|
||||
|
||||
void SetXtermColorResource(const size_t resource, const DWORD color) override
|
||||
{
|
||||
_xtermResourcesChanged.push_back(resource);
|
||||
@@ -1401,6 +1412,11 @@ public:
|
||||
_xtermResourcesRequested.push_back(resource);
|
||||
}
|
||||
|
||||
void ResetXtermColorResource(const size_t resource) override
|
||||
{
|
||||
_xtermResourcesReset.push_back(resource);
|
||||
}
|
||||
|
||||
void SetClipboard(wil::zwstring_view content) noexcept override
|
||||
{
|
||||
_copyContent = content;
|
||||
@@ -1476,8 +1492,11 @@ public:
|
||||
std::vector<size_t> _xtermResourcesChanged;
|
||||
std::vector<DWORD> _xtermResourceValues;
|
||||
std::vector<size_t> _xtermResourcesRequested;
|
||||
std::vector<size_t> _xtermResourcesReset;
|
||||
bool _setColorTableEntry;
|
||||
std::vector<size_t> _colorTableEntriesRequested;
|
||||
bool _resetAllColors;
|
||||
std::vector<size_t> _colorTableEntriesReset;
|
||||
bool _hyperlinkMode;
|
||||
std::wstring _copyContent;
|
||||
std::wstring _uri;
|
||||
@@ -3221,6 +3240,79 @@ class StateMachineExternalTest final
|
||||
pDispatch->ClearState();
|
||||
}
|
||||
|
||||
TEST_METHOD(TestOscXtermResourceReset)
|
||||
{
|
||||
auto dispatch = std::make_unique<StatefulDispatch>();
|
||||
auto pDispatch = dispatch.get();
|
||||
auto engine = std::make_unique<OutputStateMachineEngine>(std::move(dispatch));
|
||||
StateMachine mach(std::move(engine));
|
||||
|
||||
mach.ProcessString(L"\033]110\033\\");
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesChanged.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesRequested.size());
|
||||
VERIFY_ARE_EQUAL(1u, pDispatch->_xtermResourcesReset.size());
|
||||
VERIFY_ARE_EQUAL(10u, pDispatch->_xtermResourcesReset[0]);
|
||||
pDispatch->ClearState();
|
||||
|
||||
mach.ProcessString(L"\033]111;\033\\"); // dangling ;
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesChanged.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesRequested.size());
|
||||
VERIFY_ARE_EQUAL(1u, pDispatch->_xtermResourcesReset.size());
|
||||
VERIFY_ARE_EQUAL(11u, pDispatch->_xtermResourcesReset[0]);
|
||||
pDispatch->ClearState();
|
||||
|
||||
mach.ProcessString(L"\033]111;110\033\\");
|
||||
// NOTE: this is xterm behavior - ignore the entire sequence if any params exist
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesChanged.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesRequested.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesReset.size());
|
||||
pDispatch->ClearState();
|
||||
}
|
||||
|
||||
TEST_METHOD(TestOscColorTableReset)
|
||||
{
|
||||
auto dispatch = std::make_unique<StatefulDispatch>();
|
||||
auto pDispatch = dispatch.get();
|
||||
auto engine = std::make_unique<OutputStateMachineEngine>(std::move(dispatch));
|
||||
StateMachine mach(std::move(engine));
|
||||
|
||||
mach.ProcessString(L"\033]104\033\\");
|
||||
VERIFY_IS_TRUE(pDispatch->_resetAllColors);
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_colorTableEntriesReset.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_colorTableEntriesRequested.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesReset.size());
|
||||
pDispatch->ClearState();
|
||||
|
||||
mach.ProcessString(L"\033]104;1;3;5;7;9\033\\");
|
||||
VERIFY_IS_FALSE(pDispatch->_resetAllColors);
|
||||
VERIFY_ARE_EQUAL(5u, pDispatch->_colorTableEntriesReset.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_colorTableEntriesRequested.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesReset.size());
|
||||
VERIFY_ARE_EQUAL(1u, pDispatch->_colorTableEntriesReset[0]);
|
||||
VERIFY_ARE_EQUAL(3u, pDispatch->_colorTableEntriesReset[1]);
|
||||
VERIFY_ARE_EQUAL(5u, pDispatch->_colorTableEntriesReset[2]);
|
||||
VERIFY_ARE_EQUAL(7u, pDispatch->_colorTableEntriesReset[3]);
|
||||
VERIFY_ARE_EQUAL(9u, pDispatch->_colorTableEntriesReset[4]);
|
||||
pDispatch->ClearState();
|
||||
|
||||
// NOTE: xterm behavior - stop after first failed parse
|
||||
mach.ProcessString(L"\033]104;1;a;3\033\\");
|
||||
VERIFY_IS_FALSE(pDispatch->_resetAllColors);
|
||||
VERIFY_IS_FALSE(pDispatch->_setColorTableEntry);
|
||||
VERIFY_ARE_EQUAL(1u, pDispatch->_colorTableEntriesReset.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_colorTableEntriesRequested.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesReset.size());
|
||||
VERIFY_ARE_EQUAL(1u, pDispatch->_colorTableEntriesReset[0]);
|
||||
pDispatch->ClearState();
|
||||
|
||||
mach.ProcessString(L"\033]104;;;\033\\");
|
||||
VERIFY_IS_FALSE(pDispatch->_setColorTableEntry);
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_colorTableEntriesReset.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_colorTableEntriesRequested.size());
|
||||
VERIFY_ARE_EQUAL(0u, pDispatch->_xtermResourcesReset.size());
|
||||
pDispatch->ClearState();
|
||||
}
|
||||
|
||||
TEST_METHOD(TestOscSetWindowTitle)
|
||||
{
|
||||
BEGIN_TEST_METHOD_PROPERTIES()
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetPlatformVersion>10.0.22621.0</TargetPlatformVersion>
|
||||
<TargetPlatformVersion>10.0.26100.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user