mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-09 15:51:05 +00:00
Compare commits
68 Commits
dev/duhowe
...
v1.22.1035
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18d7231ef2 | ||
|
|
1951f93ad4 | ||
|
|
14a7cf3ad3 | ||
|
|
f9e962c298 | ||
|
|
3af8a05697 | ||
|
|
9a262e947c | ||
|
|
1b5381b37f | ||
|
|
db7a50a80b | ||
|
|
6debbc3d13 | ||
|
|
5148c0cf0d | ||
|
|
a5dc395c03 | ||
|
|
938b2190e5 | ||
|
|
e571e4fa22 | ||
|
|
26f82608b3 | ||
|
|
e435c1670f | ||
|
|
91086f6706 | ||
|
|
795077cb25 | ||
|
|
0e5fbad0f6 | ||
|
|
8ed73b1473 | ||
|
|
b4207403ea | ||
|
|
dc807db593 | ||
|
|
f78bf09336 | ||
|
|
a24d3a9ce4 | ||
|
|
6b8c04ad71 | ||
|
|
7878728752 | ||
|
|
ede23a5a18 | ||
|
|
03f050559c | ||
|
|
819628a185 | ||
|
|
ef0a6b76bd | ||
|
|
2143ca1c92 | ||
|
|
e476dd2b9c | ||
|
|
b97f3c1cd7 | ||
|
|
c1890c4a99 | ||
|
|
5f614bc1a0 | ||
|
|
0a9ed2bfda | ||
|
|
3ace5785cd | ||
|
|
8fa98f62bc | ||
|
|
b947d1a8be | ||
|
|
a0987c22c8 | ||
|
|
24475acba8 | ||
|
|
2a8dee286e | ||
|
|
181448908e | ||
|
|
e5f0af22d7 | ||
|
|
c49d79a1ec | ||
|
|
ff7f1a7c83 | ||
|
|
9b8c0602a2 | ||
|
|
ea60f14627 | ||
|
|
145babeae0 | ||
|
|
a2d7742567 | ||
|
|
44315b4909 | ||
|
|
5e8efdf008 | ||
|
|
d95a77b369 | ||
|
|
cc132d5e50 | ||
|
|
22731e8673 | ||
|
|
c129e794f8 | ||
|
|
bd33c7f20b | ||
|
|
893f32c642 | ||
|
|
58a50caf6a | ||
|
|
33b0e9dd10 | ||
|
|
385a9a6111 | ||
|
|
03fc325ad1 | ||
|
|
be99f93094 | ||
|
|
696fd1196b | ||
|
|
649d8b2979 | ||
|
|
3d01439c9f | ||
|
|
85afa41c32 | ||
|
|
b3f0afbc8f | ||
|
|
90cfb33c13 |
1
.github/actions/spelling/allow/apis.txt
vendored
1
.github/actions/spelling/allow/apis.txt
vendored
@@ -96,6 +96,7 @@ IGraphics
|
||||
IImage
|
||||
IInheritable
|
||||
IMap
|
||||
imm
|
||||
IMonarch
|
||||
IObject
|
||||
iosfwd
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
EOB
|
||||
swrapped
|
||||
wordi
|
||||
wordiswrapped
|
||||
wrappe
|
||||
17
.github/actions/spelling/expect/expect.txt
vendored
17
.github/actions/spelling/expect/expect.txt
vendored
@@ -16,6 +16,8 @@ ADDALIAS
|
||||
ADDREF
|
||||
ADDSTRING
|
||||
ADDTOOL
|
||||
adml
|
||||
admx
|
||||
AFill
|
||||
AFX
|
||||
AHelper
|
||||
@@ -339,6 +341,7 @@ CXVIRTUALSCREEN
|
||||
CXVSCROLL
|
||||
CYFRAME
|
||||
CYFULLSCREEN
|
||||
cygdrive
|
||||
CYHSCROLL
|
||||
CYMIN
|
||||
CYPADDEDBORDER
|
||||
@@ -564,6 +567,7 @@ entrypoints
|
||||
ENU
|
||||
ENUMLOGFONT
|
||||
ENUMLOGFONTEX
|
||||
EOB
|
||||
EOK
|
||||
EPres
|
||||
EQU
|
||||
@@ -782,6 +786,7 @@ HIWORD
|
||||
HKCU
|
||||
hkey
|
||||
hkl
|
||||
HKLM
|
||||
hlocal
|
||||
hlsl
|
||||
HMB
|
||||
@@ -864,6 +869,7 @@ INLINEPREFIX
|
||||
inproc
|
||||
Inputkeyinfo
|
||||
Inputreadhandledata
|
||||
INPUTSCOPE
|
||||
INSERTMODE
|
||||
INTERACTIVITYBASE
|
||||
INTERCEPTCOPYPASTE
|
||||
@@ -1289,6 +1295,7 @@ parms
|
||||
PATCOPY
|
||||
pathcch
|
||||
PATTERNID
|
||||
pbstr
|
||||
pcb
|
||||
pcch
|
||||
PCCHAR
|
||||
@@ -1374,9 +1381,11 @@ POSTCHARBREAKS
|
||||
POSX
|
||||
POSXSCROLL
|
||||
POSYSCROLL
|
||||
ppbstr
|
||||
PPEB
|
||||
ppf
|
||||
ppidl
|
||||
pprg
|
||||
PPROC
|
||||
ppropvar
|
||||
ppsi
|
||||
@@ -1692,6 +1701,7 @@ srcsrv
|
||||
SRCSRVTRG
|
||||
srctool
|
||||
srect
|
||||
SRGS
|
||||
srvinit
|
||||
srvpipe
|
||||
ssa
|
||||
@@ -1729,6 +1739,7 @@ swapchain
|
||||
swapchainpanel
|
||||
SWMR
|
||||
SWP
|
||||
swrapped
|
||||
SYMED
|
||||
SYNCPAINT
|
||||
syscalls
|
||||
@@ -1838,7 +1849,6 @@ triaging
|
||||
TRIMZEROHEADINGS
|
||||
trx
|
||||
tsa
|
||||
tsattrs
|
||||
tsgr
|
||||
tsm
|
||||
TStr
|
||||
@@ -1966,10 +1976,8 @@ vswhere
|
||||
vtapp
|
||||
VTE
|
||||
VTID
|
||||
vtio
|
||||
vtmode
|
||||
vtpipeterm
|
||||
vtpt
|
||||
VTRGB
|
||||
VTRGBTo
|
||||
vtseq
|
||||
@@ -2074,6 +2082,8 @@ WNDCLASSW
|
||||
Wndproc
|
||||
WNegative
|
||||
WNull
|
||||
wordi
|
||||
wordiswrapped
|
||||
workarea
|
||||
WOutside
|
||||
WOWARM
|
||||
@@ -2087,6 +2097,7 @@ WPrep
|
||||
WPresent
|
||||
wprp
|
||||
wprpi
|
||||
wrappe
|
||||
wregex
|
||||
writeback
|
||||
WRITECONSOLE
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"instanceUrl": "https://microsoft.visualstudio.com",
|
||||
"projectName": "OS",
|
||||
"areaPath": "OS\\Windows Client and Services\\ADEPT\\E4D-Engineered for Developers\\SHINE\\Terminal",
|
||||
"areaPath": "OS\\Windows Client and Services\\WinPD\\DEEP-Developer Experience, Ecosystem and Partnerships\\SHINE\\Terminal",
|
||||
"notificationAliases": ["condev@microsoft.com", "duhowett@microsoft.com"]
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Optional, defaults to main. Name of the branch which will be used for calculating branch point. -->
|
||||
<PGOBranch>main</PGOBranch>
|
||||
<PGOBranch>release-1.22</PGOBranch>
|
||||
|
||||
<!-- Mandatory. Name of the NuGet package which will contain PGO databases for consumption by build system. -->
|
||||
<PGOPackageName>Microsoft.Internal.Windows.Terminal.PGODatabase</PGOPackageName>
|
||||
|
||||
@@ -37,6 +37,8 @@ extends:
|
||||
akvName: $(SigningAKVName)
|
||||
authCertName: $(SigningAuthCertName)
|
||||
signCertName: $(SigningSignCertName)
|
||||
useManagedIdentity: $(SigningUseManagedIdentity)
|
||||
clientId: $(SigningOriginalClientId)
|
||||
publishSymbolsToPublic: true
|
||||
publishVpackToWindows: false
|
||||
symbolExpiryTime: 15
|
||||
|
||||
@@ -85,6 +85,8 @@ extends:
|
||||
akvName: $(SigningAKVName)
|
||||
authCertName: $(SigningAuthCertName)
|
||||
signCertName: $(SigningSignCertName)
|
||||
useManagedIdentity: $(SigningUseManagedIdentity)
|
||||
clientId: $(SigningOriginalClientId)
|
||||
terminalInternalPackageVersion: ${{ parameters.terminalInternalPackageVersion }}
|
||||
publishSymbolsToPublic: ${{ parameters.publishSymbolsToPublic }}
|
||||
publishVpackToWindows: ${{ parameters.publishVpackToWindows }}
|
||||
|
||||
@@ -59,10 +59,7 @@ jobs:
|
||||
submodules: true
|
||||
persistCredentials: True
|
||||
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- template: steps-setup-versioning.yml
|
||||
|
||||
- template: steps-download-bin-dir-artifact.yml
|
||||
parameters:
|
||||
|
||||
@@ -69,10 +69,9 @@ jobs:
|
||||
fetchTags: false # Tags still result in depth > 1 fetch; we don't need them here
|
||||
submodules: true
|
||||
persistCredentials: True
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
|
||||
- template: steps-setup-versioning.yml
|
||||
|
||||
- template: steps-download-bin-dir-artifact.yml
|
||||
parameters:
|
||||
buildPlatforms: ${{ parameters.buildPlatforms }}
|
||||
|
||||
@@ -57,10 +57,7 @@ jobs:
|
||||
submodules: true
|
||||
persistCredentials: True
|
||||
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- template: steps-setup-versioning.yml
|
||||
|
||||
- template: steps-download-bin-dir-artifact.yml
|
||||
parameters:
|
||||
|
||||
@@ -44,10 +44,7 @@ jobs:
|
||||
submodules: true
|
||||
persistCredentials: True
|
||||
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- template: steps-setup-versioning.yml
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: Download all PDBs from all prior build phases
|
||||
|
||||
@@ -43,10 +43,7 @@ jobs:
|
||||
submodules: true
|
||||
persistCredentials: True
|
||||
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- template: steps-setup-versioning.yml
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: Download all PDBs from all prior build phases
|
||||
|
||||
@@ -38,10 +38,7 @@ jobs:
|
||||
submodules: true
|
||||
persistCredentials: True
|
||||
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- template: steps-setup-versioning.yml
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: Download MSIX Bundle Artifact
|
||||
|
||||
@@ -92,10 +92,7 @@ stages:
|
||||
generateSbom: ${{ parameters.generateSbom }}
|
||||
codeSign: ${{ parameters.codeSign }}
|
||||
beforeBuildSteps: # Right before we build, lay down the universal package and localizations
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- template: ./build/pipelines/templates-v2/steps-setup-versioning.yml@self
|
||||
|
||||
- task: UniversalPackages@0
|
||||
displayName: Download terminal-internal Universal Package
|
||||
@@ -119,10 +116,7 @@ stages:
|
||||
generateSbom: ${{ parameters.generateSbom }}
|
||||
codeSign: ${{ parameters.codeSign }}
|
||||
beforeBuildSteps:
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- template: ./build/pipelines/templates-v2/steps-setup-versioning.yml@self
|
||||
# WPF doesn't need the localizations or the universal package, but if it does... put them here.
|
||||
|
||||
- stage: Package
|
||||
|
||||
@@ -130,10 +130,7 @@ extends:
|
||||
codeSign: ${{ parameters.codeSign }}
|
||||
signingIdentity: ${{ parameters.signingIdentity }}
|
||||
beforeBuildSteps: # Right before we build, lay down the universal package and localizations
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- template: ./build/pipelines/templates-v2/steps-setup-versioning.yml@self
|
||||
|
||||
- task: UniversalPackages@0
|
||||
displayName: Download terminal-internal Universal Package
|
||||
@@ -167,10 +164,7 @@ extends:
|
||||
codeSign: ${{ parameters.codeSign }}
|
||||
signingIdentity: ${{ parameters.signingIdentity }}
|
||||
beforeBuildSteps:
|
||||
- task: PkgESSetupBuild@12
|
||||
displayName: Package ES - Setup Build
|
||||
inputs:
|
||||
disableOutputRedirect: true
|
||||
- template: ./build/pipelines/templates-v2/steps-setup-versioning.yml@self
|
||||
# WPF doesn't need the localizations or the universal package, but if it does... put them here.
|
||||
|
||||
- stage: Package
|
||||
|
||||
@@ -19,4 +19,6 @@ steps:
|
||||
AuthAKVName: ${{ parameters.signingIdentity.akvName }}
|
||||
AuthCertName: ${{ parameters.signingIdentity.authCertName }}
|
||||
AuthSignCertName: ${{ parameters.signingIdentity.signCertName }}
|
||||
UseMSIAuthentication: ${{ coalesce(parameters.signingIdentity.useManagedIdentity, 'false') }}
|
||||
EsrpClientId: ${{ parameters.signingIdentity.clientId }}
|
||||
${{ insert }}: ${{ parameters.inputs }}
|
||||
|
||||
6
build/pipelines/templates-v2/steps-setup-versioning.yml
Normal file
6
build/pipelines/templates-v2/steps-setup-versioning.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
steps:
|
||||
- pwsh: |-
|
||||
nuget install Microsoft.Windows.Terminal.Versioning -OutputDirectory _versioning
|
||||
$VersionRoot = (Get-Item _versioning\Microsoft.Windows.*).FullName
|
||||
& "$VersionRoot\build\Setup.ps1" -ProjectDirectory "$(Build.SourcesDirectory)" -Verbose
|
||||
displayName: Set up versioning via M.W.T.V
|
||||
@@ -1,6 +1,6 @@
|
||||
$VSInstances = ([xml](& 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -include packages -format xml))
|
||||
$VSPackages = $VSInstances.instances.instance.packages.package
|
||||
$LatestVCPackage = ($VSInstances.instances.instance.packages.package | ? { $_.id -eq "Microsoft.VisualCpp.CRT.Source" })
|
||||
$LatestVCPackage = ($VSInstances.instances.instance.packages.package | ? { $_.id -eq "Microsoft.VisualCpp.Tools.Core" })
|
||||
$LatestVCToolsVersion = $LatestVCPackage.version;
|
||||
|
||||
Write-Output "Latest VCToolsVersion: $LatestVCToolsVersion"
|
||||
|
||||
@@ -380,7 +380,7 @@ Here's the AppxManifest we're using:
|
||||
</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>
|
||||
@@ -517,7 +517,7 @@ This is because of a few key lines we already put in the appxmanifest:
|
||||
|
||||
```xml
|
||||
<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>
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
"enum": [
|
||||
"Windows.Terminal.Wsl",
|
||||
"Windows.Terminal.Azure",
|
||||
"Windows.Terminal.PowershellCore"
|
||||
"Windows.Terminal.PowershellCore",
|
||||
"Windows.Terminal.VisualStudio"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
@@ -2355,11 +2356,25 @@
|
||||
"description": "When set to true, the terminal will focus the pane on mouse hover.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"compatibility.allowHeadless": {
|
||||
"default": false,
|
||||
"description": "When set to true, Windows Terminal will run in the background. This allows globalSummon and quakeMode actions to work even when no windows are open.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"compatibility.isolatedMode": {
|
||||
"default": false,
|
||||
"description": "When set to true, Terminal windows will not be able to interact with each other (including global hotkeys, tab drag/drop, running commandlines in existing windows, etc.). This is a compatibility escape hatch for users who are running into certain windowing issues.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"compatibility.textMeasurement": {
|
||||
"default": "graphemes",
|
||||
"description": "This changes the way incoming text is grouped into cells. The \"graphemes\" option is the most modern and Unicode-correct way to do so, while \"wcswidth\" is a common approach on UNIX, and \"console\" replicates the way it used to work on Windows.",
|
||||
"enum": [
|
||||
"graphemes",
|
||||
"wcswidth",
|
||||
"console"
|
||||
]
|
||||
},
|
||||
"copyFormatting": {
|
||||
"default": true,
|
||||
"description": "When set to `true`, the color and font formatting of selected text is also copied to your clipboard. When set to `false`, only plain text is copied to your clipboard. An array of specific formats can also be used. Supported array values include `html` and `rtf`. Plain text is always copied.",
|
||||
@@ -2699,6 +2714,16 @@
|
||||
"description": "When set to true, when opening a new tab or pane it will get reloaded environment variables.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"compatibility.allowDECRQCRA": {
|
||||
"default": false,
|
||||
"description": "When set to true, the terminal will support the DECRQCRA (Request Checksum of Rectangular Area) escape sequence.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"compatibility.allowOSC52": {
|
||||
"default": true,
|
||||
"description": "When set to true, VT applications will be allowed to set the contents of the local clipboard using OSC 52 (Manipulate Selection Data).",
|
||||
"type": "boolean"
|
||||
},
|
||||
"unfocusedAppearance": {
|
||||
"$ref": "#/$defs/AppearanceConfig",
|
||||
"description": "Sets the appearance of the terminal when it is unfocused.",
|
||||
@@ -3079,6 +3104,17 @@
|
||||
"default": false,
|
||||
"description": "When set to true, the window will have an acrylic material background. When set to false, the window will have a plain, untextured background.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"pathTranslationStyle": {
|
||||
"default": "none",
|
||||
"description": "Controls how file paths are transformed when they are dragged and dropped on the terminal. Possible values are \"none\", \"wsl\", \"cygwin\" and \"msys2\".",
|
||||
"enum": [
|
||||
"none",
|
||||
"wsl",
|
||||
"cygwin",
|
||||
"msys2"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
28
policies/WindowsTerminal.admx
Normal file
28
policies/WindowsTerminal.admx
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- (c) 2024 Microsoft Corporation -->
|
||||
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
|
||||
<policyNamespaces>
|
||||
<target prefix="terminal" namespace="Microsoft.Policies.WindowsTerminal" />
|
||||
<using prefix="windows" namespace="Microsoft.Policies.Windows" />
|
||||
</policyNamespaces>
|
||||
<resources minRequiredRevision="1.0" />
|
||||
<supportedOn>
|
||||
<definitions>
|
||||
<definition name="SUPPORTED_WindowsTerminal_1_21" displayName="$(string.SUPPORTED_WindowsTerminal_1_21)" />
|
||||
</definitions>
|
||||
</supportedOn>
|
||||
<categories>
|
||||
<category name="WindowsTerminal" displayName="$(string.WindowsTerminal)">
|
||||
<parentCategory ref="windows:WindowsComponents" />
|
||||
</category>
|
||||
</categories>
|
||||
<policies>
|
||||
<policy name="DisabledProfileSources" class="Both" displayName="$(string.DisabledProfileSources)" explainText="$(string.DisabledProfileSourcesText)" presentation="$(presentation.DisabledProfileSources)" key="Software\Policies\Microsoft\Windows Terminal">
|
||||
<parentCategory ref="WindowsTerminal" />
|
||||
<supportedOn ref="SUPPORTED_WindowsTerminal_1_21" />
|
||||
<elements>
|
||||
<multiText id="DisabledProfileSources" valueName="DisabledProfileSources" required="true" />
|
||||
</elements>
|
||||
</policy>
|
||||
</policies>
|
||||
</policyDefinitions>
|
||||
28
policies/en-US/WindowsTerminal.adml
Normal file
28
policies/en-US/WindowsTerminal.adml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- (c) 2024 Microsoft Corporation -->
|
||||
<policyDefinitionResources xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
|
||||
<displayName>Windows Terminal</displayName>
|
||||
<description>Windows Terminal</description>
|
||||
<resources>
|
||||
<stringTable>
|
||||
<string id="WindowsTerminal">Windows Terminal</string>
|
||||
<string id="SUPPORTED_WindowsTerminal_1_21">At least Windows Terminal 1.21</string>
|
||||
<string id="DisabledProfileSources">Disabled Profile Sources</string>
|
||||
<string id="DisabledProfileSourcesText">Profiles will not be generated from any sources listed here. Source names can be arbitrary strings. Potential candidates can be found as the "source" property on profile definitions in Windows Terminal's settings.json file.
|
||||
|
||||
Common sources are:
|
||||
- Windows.Terminal.Azure
|
||||
- Windows.Terminal.PowershellCore
|
||||
- Windows.Terminal.Wsl
|
||||
|
||||
For instance, setting this policy to Windows.Terminal.Wsl will disable the builtin WSL integration of Windows Terminal.
|
||||
|
||||
Note: Existing profiles will disappear from Windows Terminal after adding their source to this policy.</string>
|
||||
</stringTable>
|
||||
<presentationTable>
|
||||
<presentation id="DisabledProfileSources">
|
||||
<multiTextBox refId="DisabledProfileSources">List of disabled sources (one per line)</multiTextBox>
|
||||
</presentation>
|
||||
</presentationTable>
|
||||
</resources>
|
||||
</policyDefinitionResources>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,5 +8,5 @@ Please consult the [license](https://raw.githubusercontent.com/microsoft/cascadi
|
||||
|
||||
### Fonts Included
|
||||
|
||||
* Cascadia Code, Cascadia Mono (2404.23)
|
||||
* from microsoft/cascadia-code@1034791e5fc6e060a448d2b29cd94a6c683edb36
|
||||
* Cascadia Code, Cascadia Mono (2407.24)
|
||||
* from microsoft/cascadia-code@56bcca3f2c1e4cb19458954f0e2bb4635960df91
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
|
||||
@@ -16,7 +16,7 @@ bool Search::IsStale(const Microsoft::Console::Render::IRenderData& renderData,
|
||||
_lastMutationId != renderData.GetTextBuffer().GetLastMutationId();
|
||||
}
|
||||
|
||||
bool Search::Reset(Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags, bool reverse)
|
||||
void Search::Reset(Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags, bool reverse)
|
||||
{
|
||||
const auto& textBuffer = renderData.GetTextBuffer();
|
||||
|
||||
@@ -30,15 +30,15 @@ bool Search::Reset(Microsoft::Console::Render::IRenderData& renderData, const st
|
||||
_results = std::move(result).value_or(std::vector<til::point_span>{});
|
||||
_index = reverse ? gsl::narrow_cast<ptrdiff_t>(_results.size()) - 1 : 0;
|
||||
_step = reverse ? -1 : 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Search::MoveToCurrentSelection()
|
||||
{
|
||||
if (_renderData->IsSelectionActive())
|
||||
{
|
||||
MoveToPoint(_renderData->GetTextBuffer().ScreenToBufferPosition(_renderData->GetSelectionAnchor()));
|
||||
}
|
||||
else if (const auto span = _renderData->GetSearchHighlightFocused())
|
||||
{
|
||||
MoveToPoint(_step > 0 ? span->start : span->end);
|
||||
}
|
||||
}
|
||||
|
||||
void Search::MoveToPoint(const til::point anchor) noexcept
|
||||
|
||||
@@ -36,9 +36,8 @@ public:
|
||||
Search() = default;
|
||||
|
||||
bool IsStale(const Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags) const noexcept;
|
||||
bool Reset(Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags, bool reverse);
|
||||
void Reset(Microsoft::Console::Render::IRenderData& renderData, const std::wstring_view& needle, SearchFlag flags, bool reverse);
|
||||
|
||||
void MoveToCurrentSelection();
|
||||
void MoveToPoint(til::point anchor) noexcept;
|
||||
void MovePastPoint(til::point anchor) noexcept;
|
||||
void FindNext(bool reverse) noexcept;
|
||||
|
||||
@@ -451,14 +451,9 @@ size_t TextBuffer::FitTextIntoColumns(const std::wstring_view& chars, til::Coord
|
||||
cwd.GraphemeNext(state, chars);
|
||||
col += state.width;
|
||||
|
||||
// If we ran out of columns, we need to always return `columnLimit` and not `cols`,
|
||||
// because if we tried inserting a wide glyph into just 1 remaining column it will
|
||||
// fail to fit, but that remaining column still has been used up. When the caller sees
|
||||
// `columns == columnLimit` they will line-wrap and continue inserting into the next row.
|
||||
if (col > columnLimit)
|
||||
{
|
||||
columns = columnLimit;
|
||||
return dist;
|
||||
break;
|
||||
}
|
||||
|
||||
dist += state.len;
|
||||
@@ -466,7 +461,7 @@ size_t TextBuffer::FitTextIntoColumns(const std::wstring_view& chars, til::Coord
|
||||
|
||||
// But if we simply ran out of text we just need to return the actual number of columns.
|
||||
columns = col;
|
||||
return chars.size();
|
||||
return dist;
|
||||
}
|
||||
|
||||
// Pretend as if `position` is a regular cursor in the TextBuffer.
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.22621.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.19041.0" MaxVersionTested="10.0.26100.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
|
||||
</data>
|
||||
<data name="AppDescription" xml:space="preserve">
|
||||
<value>Nová Terminál Windows</value>
|
||||
<value>Nový Terminál Windows</value>
|
||||
</data>
|
||||
<data name="AppDescriptionPre" xml:space="preserve">
|
||||
<value>Terminál Windows s náhledem připravovaných funkcí</value>
|
||||
@@ -164,11 +164,11 @@
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Canary version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
|
||||
</data>
|
||||
<data name="ShellExtension_OpenInTerminalMenuItem_Preview" xml:space="preserve">
|
||||
<value>Otevřít náhled &aplikace Terminal</value>
|
||||
<value>Otevřít &náhled Terminálu</value>
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
|
||||
</data>
|
||||
<data name="ShellExtension_OpenInTerminalMenuItem" xml:space="preserve">
|
||||
<value>Otevřít v aplikaci &Terminal</value>
|
||||
<value>Otevřít v &Terminálu</value>
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the non-preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -118,7 +118,7 @@ namespace winrt::TerminalApp::implementation
|
||||
void TerminalPage::_HandleCloseWindow(const IInspectable& /*sender*/,
|
||||
const ActionEventArgs& args)
|
||||
{
|
||||
CloseRequested.raise(nullptr, nullptr);
|
||||
CloseWindow();
|
||||
args.Handled(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ namespace winrt::TerminalApp::implementation
|
||||
_switchToMode(CommandPaletteMode::CommandlineMode);
|
||||
e.Handled(true);
|
||||
}
|
||||
else if (key == VirtualKey::C && ctrlDown)
|
||||
else if ((key == VirtualKey::C || key == VirtualKey::Insert) && ctrlDown)
|
||||
{
|
||||
_searchBox().CopySelectionToClipboard();
|
||||
e.Handled(true);
|
||||
|
||||
@@ -23,6 +23,27 @@
|
||||
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<!-- KeyChordText styles -->
|
||||
<Style x:Key="KeyChordBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="2" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
<Style x:Key="KeyChordTextBlockStyle"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
<!-- ParsedCommandLineText styles -->
|
||||
<Style x:Key="ParsedCommandLineBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
||||
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
|
||||
</Style>
|
||||
|
||||
<DataTemplate x:Key="ListItemTemplate"
|
||||
x:DataType="local:FilteredCommand">
|
||||
<ListViewItem HorizontalContentAlignment="Stretch"
|
||||
@@ -69,12 +90,12 @@
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Background="{ThemeResource FlyoutPresenterBackground}"
|
||||
Style="{ThemeResource KeyChordBorderStyle}"
|
||||
Style="{StaticResource KeyChordBorderStyle}"
|
||||
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(Item.KeyChordText), Mode=OneWay}">
|
||||
|
||||
<TextBlock AutomationProperties.AccessibilityView="Raw"
|
||||
FontSize="12"
|
||||
Style="{ThemeResource KeyChordTextBlockStyle}"
|
||||
Style="{StaticResource KeyChordTextBlockStyle}"
|
||||
Text="{x:Bind Item.KeyChordText, Mode=OneWay}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
@@ -118,12 +139,12 @@
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Style="{ThemeResource KeyChordBorderStyle}"
|
||||
Style="{StaticResource KeyChordBorderStyle}"
|
||||
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(Item.KeyChordText), Mode=OneWay}">
|
||||
|
||||
<TextBlock AutomationProperties.AccessibilityView="Raw"
|
||||
FontSize="12"
|
||||
Style="{ThemeResource KeyChordTextBlockStyle}"
|
||||
Style="{StaticResource KeyChordTextBlockStyle}"
|
||||
Text="{x:Bind Item.KeyChordText, Mode=OneWay}" />
|
||||
</Border>
|
||||
|
||||
@@ -205,6 +226,13 @@
|
||||
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).IsInputBroadcastActive, Mode=OneWay}" />
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<Ellipse Grid.Column="4"
|
||||
Width="8"
|
||||
Height="8"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Fill="{x:Bind mtu:Converters.ColorToBrush(Item.(local:TabPaletteItem.TabStatus).TabColorIndicator), Mode=OneWay}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
@@ -212,79 +240,6 @@
|
||||
GeneralItemTemplate="{StaticResource GeneralItemTemplate}"
|
||||
NestedItemTemplate="{StaticResource NestedItemTemplate}"
|
||||
TabItemTemplate="{StaticResource TabItemTemplate}" />
|
||||
|
||||
<ResourceDictionary.ThemeDictionaries>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
|
||||
<!-- KeyChordText styles -->
|
||||
<Style x:Key="KeyChordBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="2" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
<Style x:Key="KeyChordTextBlockStyle"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
|
||||
<!-- ParsedCommandLineText styles -->
|
||||
<Style x:Key="ParsedCommandLineBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
||||
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
|
||||
</Style>
|
||||
<Style x:Key="ParsedCommandLineTextBlockStyle"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
|
||||
<!-- KeyChordText styles -->
|
||||
<Style x:Key="KeyChordBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="2" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
<Style x:Key="KeyChordTextBlockStyle"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
|
||||
<!-- ParsedCommandLineText styles -->
|
||||
<Style x:Key="ParsedCommandLineBorderStyle"
|
||||
TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
|
||||
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
|
||||
</Style>
|
||||
<Style x:Key="ParsedCommandLineTextBlockStyle"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
|
||||
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
|
||||
<Style x:Key="KeyChordBorderStyle"
|
||||
TargetType="Border" />
|
||||
<Style x:Key="KeyChordTextBlockStyle"
|
||||
TargetType="TextBlock" />
|
||||
|
||||
<!-- ParsedCommandLineText styles (use XAML defaults for High Contrast theme) -->
|
||||
<Style x:Key="ParsedCommandLineBorderStyle"
|
||||
TargetType="Border" />
|
||||
<Style x:Key="ParsedCommandLineTextBlockStyle"
|
||||
TargetType="TextBlock" />
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
@@ -368,7 +323,7 @@
|
||||
Padding="16,12"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Style="{ThemeResource ParsedCommandLineBorderStyle}"
|
||||
Style="{StaticResource ParsedCommandLineBorderStyle}"
|
||||
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(ParsedCommandLineText), Mode=OneWay}">
|
||||
|
||||
<ScrollViewer MaxHeight="200"
|
||||
|
||||
@@ -2956,13 +2956,13 @@ bool Pane::ContainsReadOnly() const
|
||||
// - <none>
|
||||
void Pane::CollectTaskbarStates(std::vector<winrt::TerminalApp::TaskbarState>& states)
|
||||
{
|
||||
if (_IsLeaf())
|
||||
if (_content)
|
||||
{
|
||||
auto tbState{ winrt::make<winrt::TerminalApp::implementation::TaskbarState>(_content.TaskbarState(),
|
||||
_content.TaskbarProgress()) };
|
||||
states.push_back(tbState);
|
||||
}
|
||||
else
|
||||
else if (_firstChild && _secondChild)
|
||||
{
|
||||
_firstChild->CollectTaskbarStates(states);
|
||||
_secondChild->CollectTaskbarStates(states);
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<comment>{Locked=qps-ploc,qps-ploca,qps-plocm}</comment>
|
||||
</data>
|
||||
<data name="AppDescription" xml:space="preserve">
|
||||
<value>Nová Terminál Windows</value>
|
||||
<value>Nový Terminál Windows</value>
|
||||
</data>
|
||||
<data name="AppDescriptionPre" xml:space="preserve">
|
||||
<value>Terminál Windows s náhledem připravovaných funkcí</value>
|
||||
@@ -164,11 +164,11 @@
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Canary version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
|
||||
</data>
|
||||
<data name="ShellExtension_OpenInTerminalMenuItem_Preview" xml:space="preserve">
|
||||
<value>Otevřít náhled &aplikace Terminal</value>
|
||||
<value>Otevřít &náhled Terminálu</value>
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the Preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
|
||||
</data>
|
||||
<data name="ShellExtension_OpenInTerminalMenuItem" xml:space="preserve">
|
||||
<value>Otevřít v aplikaci &Terminal</value>
|
||||
<value>Otevřít v &Terminálu</value>
|
||||
<comment>This is a menu item that will be displayed in the Windows File Explorer that launches the non-preview version of Windows Terminal. Please mark one of the characters to be an accelerator key.</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -192,6 +192,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Schließen</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Registerkarte verschieben</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Tabs nach rechts schließen</value>
|
||||
</data>
|
||||
@@ -936,4 +939,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Bereich schließen</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Nach links</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Nach rechts</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -193,6 +193,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Move tab</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Close tabs to the right</value>
|
||||
</data>
|
||||
@@ -941,4 +944,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Close pane</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Move left</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Move right</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -189,6 +189,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Cerrar</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Mover pestaña</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Cerrar las pestañas de la derecha</value>
|
||||
</data>
|
||||
@@ -933,4 +936,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Cerrar panel</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Mover a la izquierda</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Mover a la derecha</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -189,6 +189,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Fermer</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Déplacer l’onglet</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Fermer les onglets à droite</value>
|
||||
</data>
|
||||
@@ -933,4 +936,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Fermer le volet</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Déplacer vers la gauche</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Déplacer vers la droite</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -189,6 +189,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Chiudi</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Sposta scheda</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Chiudi schede a destra</value>
|
||||
</data>
|
||||
@@ -933,4 +936,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Chiudi il riquadro</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Sposta a sinistra</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Sposta a destra</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -190,6 +190,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>閉じる</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>タブの移動</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>タブを右側に閉じる</value>
|
||||
</data>
|
||||
@@ -934,4 +937,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>ウィンドウを閉じる</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>左へ移動</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>右へ移動</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -118,7 +118,7 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="InitialJsonParseErrorText" xml:space="preserve">
|
||||
<value>파일에서 설정을 로드 하지 못했습니다. 후행 쉼표를 포함 하 여 구문 오류가 있는지 확인 합니다.</value>
|
||||
<value>파일에서 설정을 로드하지 못했습니다. 후행 쉼표를 포함하여 구문 오류가 있는지 확인합니다.</value>
|
||||
</data>
|
||||
<data name="MissingDefaultProfileText" xml:space="preserve">
|
||||
<value>첫 번째 프로필을 사용하여 프로필 목록에서 기본 프로필을 찾을 수 없습니다. "defaultProfile"이 프로필 중 하나의 GUID와 일치하는지 확인합니다.</value>
|
||||
@@ -189,6 +189,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>닫기</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>탭 이동</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>오른쪽에 있는 탭 닫기</value>
|
||||
</data>
|
||||
@@ -319,7 +322,7 @@
|
||||
<value>상위 창의 백분율로 크기를 지정합니다. (0,1) 사이 값만 유효합니다.</value>
|
||||
</data>
|
||||
<data name="CmdNewTabDesc" xml:space="preserve">
|
||||
<value>새 작업 만들기</value>
|
||||
<value>새 탭 만들기</value>
|
||||
</data>
|
||||
<data name="CmdNTDesc" xml:space="preserve">
|
||||
<value>"new-tab" 하위 명령의 별칭입니다.</value>
|
||||
@@ -524,7 +527,7 @@
|
||||
<value>경고</value>
|
||||
</data>
|
||||
<data name="CloseReadOnlyDialog.Content" xml:space="preserve">
|
||||
<value>읽기 전용 터미널을 닫으려고 합니다. 계속하시겠어요?</value>
|
||||
<value>읽기 전용 터미널을 닫으려고 합니다. 계속하시겠습니까?</value>
|
||||
</data>
|
||||
<data name="LargePasteDialog.CloseButtonText" xml:space="preserve">
|
||||
<value>취소</value>
|
||||
@@ -616,7 +619,7 @@
|
||||
<comment>{0} will be replaced with a number.</comment>
|
||||
</data>
|
||||
<data name="CrimsonColorButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>심홍</value>
|
||||
<value>진홍</value>
|
||||
</data>
|
||||
<data name="SteelBlueColorButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>강철색</value>
|
||||
@@ -933,4 +936,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>창 닫기</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>왼쪽으로 이동</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>오른쪽으로 이동</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -189,6 +189,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Fechar</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Mover guia</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Fechar guias à direita</value>
|
||||
</data>
|
||||
@@ -933,4 +936,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Fechar o painel</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Mover para a esquerda</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Mover para a direita</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -193,6 +193,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Ćļôŝέ !</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Μòνë ťäв !!</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Ċĺοşέ ţаъş ťό ŧђé яΐğђт !!! !!! </value>
|
||||
</data>
|
||||
@@ -941,4 +944,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Ćℓǿŝé ρдʼné !!!</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Μŏνê ĺэƒť !!!</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Мóνε яίģнŧ !!!</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -193,6 +193,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Ćļôŝέ !</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Μòνë ťäв !!</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Ċĺοşέ ţаъş ťό ŧђé яΐğђт !!! !!! </value>
|
||||
</data>
|
||||
@@ -941,4 +944,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Ćℓǿŝé ρдʼné !!!</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Μŏνê ĺэƒť !!!</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Мóνε яίģнŧ !!!</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -193,6 +193,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Ćļôŝέ !</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Μòνë ťäв !!</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Ċĺοşέ ţаъş ťό ŧђé яΐğђт !!! !!! </value>
|
||||
</data>
|
||||
@@ -941,4 +944,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Ćℓǿŝé ρдʼné !!!</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Μŏνê ĺэƒť !!!</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Мóνε яίģнŧ !!!</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -189,6 +189,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>Закрыть</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>Переместить вкладку</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>Закрыть вкладки справа</value>
|
||||
</data>
|
||||
@@ -933,4 +936,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>Закрыть панель</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>Влево</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>Вправо</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -189,6 +189,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>关闭</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>移动选项卡</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>关闭右侧标签页</value>
|
||||
</data>
|
||||
@@ -933,4 +936,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>关闭窗格</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>左移</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>右移</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -189,6 +189,9 @@
|
||||
<data name="TabCloseSubMenu" xml:space="preserve">
|
||||
<value>關閉</value>
|
||||
</data>
|
||||
<data name="TabMoveSubMenu" xml:space="preserve">
|
||||
<value>移動索引標籤</value>
|
||||
</data>
|
||||
<data name="TabCloseAfter" xml:space="preserve">
|
||||
<value>關閉右側的索引標籤</value>
|
||||
</data>
|
||||
@@ -933,4 +936,10 @@
|
||||
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
|
||||
<value>關閉窗格</value>
|
||||
</data>
|
||||
<data name="TabMoveLeft" xml:space="preserve">
|
||||
<value>左移</value>
|
||||
</data>
|
||||
<data name="TabMoveRight" xml:space="preserve">
|
||||
<value>右移</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "TabBase.g.cpp"
|
||||
#include "Utils.h"
|
||||
#include "ColorHelper.h"
|
||||
#include "../inc/WindowingBehavior.h"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
@@ -56,10 +57,72 @@ namespace winrt::TerminalApp::implementation
|
||||
tab->RequestFocusActiveControl.raise();
|
||||
}
|
||||
});
|
||||
_AppendMoveMenuItems(contextMenuFlyout);
|
||||
_AppendCloseMenuItems(contextMenuFlyout);
|
||||
TabViewItem().ContextFlyout(contextMenuFlyout);
|
||||
}
|
||||
|
||||
void TabBase::_AppendMoveMenuItems(winrt::Windows::UI::Xaml::Controls::MenuFlyout flyout)
|
||||
{
|
||||
auto weakThis{ get_weak() };
|
||||
|
||||
// Move to new window
|
||||
{
|
||||
Controls::FontIcon moveTabToNewWindowTabSymbol;
|
||||
moveTabToNewWindowTabSymbol.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
|
||||
moveTabToNewWindowTabSymbol.Glyph(L"\xE8A7");
|
||||
|
||||
_moveToNewWindowMenuItem.Click([weakThis](auto&&, auto&&) {
|
||||
if (auto tab{ weakThis.get() })
|
||||
{
|
||||
MoveTabArgs args{ winrt::to_hstring(NewWindow), MoveTabDirection::Forward };
|
||||
ActionAndArgs actionAndArgs{ ShortcutAction::MoveTab, args };
|
||||
tab->_dispatch.DoAction(*tab, actionAndArgs);
|
||||
}
|
||||
});
|
||||
_moveToNewWindowMenuItem.Text(RS_(L"MoveTabToNewWindowText"));
|
||||
_moveToNewWindowMenuItem.Icon(moveTabToNewWindowTabSymbol);
|
||||
|
||||
const auto moveTabToNewWindowToolTip = RS_(L"MoveTabToNewWindowToolTip");
|
||||
WUX::Controls::ToolTipService::SetToolTip(_moveToNewWindowMenuItem, box_value(moveTabToNewWindowToolTip));
|
||||
Automation::AutomationProperties::SetHelpText(_moveToNewWindowMenuItem, moveTabToNewWindowToolTip);
|
||||
}
|
||||
|
||||
// Move left
|
||||
{
|
||||
_moveLeftMenuItem.Click([weakThis](auto&&, auto&&) {
|
||||
if (auto tab{ weakThis.get() })
|
||||
{
|
||||
MoveTabArgs args{ hstring{}, MoveTabDirection::Backward };
|
||||
ActionAndArgs actionAndArgs{ ShortcutAction::MoveTab, args };
|
||||
tab->_dispatch.DoAction(*tab, actionAndArgs);
|
||||
}
|
||||
});
|
||||
_moveLeftMenuItem.Text(RS_(L"TabMoveLeft"));
|
||||
}
|
||||
|
||||
// Move right
|
||||
{
|
||||
_moveRightMenuItem.Click([weakThis](auto&&, auto&&) {
|
||||
if (auto tab{ weakThis.get() })
|
||||
{
|
||||
MoveTabArgs args{ hstring{}, MoveTabDirection::Forward };
|
||||
ActionAndArgs actionAndArgs{ ShortcutAction::MoveTab, args };
|
||||
tab->_dispatch.DoAction(*tab, actionAndArgs);
|
||||
}
|
||||
});
|
||||
_moveRightMenuItem.Text(RS_(L"TabMoveRight"));
|
||||
}
|
||||
|
||||
// Create a sub-menu for our extended move tab items.
|
||||
Controls::MenuFlyoutSubItem moveSubMenu;
|
||||
moveSubMenu.Text(RS_(L"TabMoveSubMenu"));
|
||||
moveSubMenu.Items().Append(_moveToNewWindowMenuItem);
|
||||
moveSubMenu.Items().Append(_moveRightMenuItem);
|
||||
moveSubMenu.Items().Append(_moveLeftMenuItem);
|
||||
flyout.Items().Append(moveSubMenu);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Append the close menu items to the context menu flyout
|
||||
// Arguments:
|
||||
@@ -75,7 +138,9 @@ namespace winrt::TerminalApp::implementation
|
||||
_closeTabsAfterMenuItem.Click([weakThis](auto&&, auto&&) {
|
||||
if (auto tab{ weakThis.get() })
|
||||
{
|
||||
tab->_CloseTabsAfter();
|
||||
CloseTabsAfterArgs args{ tab->_TabViewIndex };
|
||||
ActionAndArgs closeTabsAfter{ ShortcutAction::CloseTabsAfter, args };
|
||||
tab->_dispatch.DoAction(*tab, closeTabsAfter);
|
||||
}
|
||||
});
|
||||
_closeTabsAfterMenuItem.Text(RS_(L"TabCloseAfter"));
|
||||
@@ -88,7 +153,9 @@ namespace winrt::TerminalApp::implementation
|
||||
_closeOtherTabsMenuItem.Click([weakThis](auto&&, auto&&) {
|
||||
if (auto tab{ weakThis.get() })
|
||||
{
|
||||
tab->_CloseOtherTabs();
|
||||
CloseOtherTabsArgs args{ tab->_TabViewIndex };
|
||||
ActionAndArgs closeOtherTabs{ ShortcutAction::CloseOtherTabs, args };
|
||||
tab->_dispatch.DoAction(*tab, closeOtherTabs);
|
||||
}
|
||||
});
|
||||
_closeOtherTabsMenuItem.Text(RS_(L"TabCloseOther"));
|
||||
@@ -129,33 +196,27 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Enable the Close menu items based on tab index and total number of tabs
|
||||
// - Enable menu items based on tab index and total number of tabs
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TabBase::_EnableCloseMenuItems()
|
||||
void TabBase::_EnableMenuItems()
|
||||
{
|
||||
// close other tabs is enabled only if there are other tabs
|
||||
_closeOtherTabsMenuItem.IsEnabled(TabViewNumTabs() > 1);
|
||||
// close tabs after is enabled only if there are other tabs on the right
|
||||
_closeTabsAfterMenuItem.IsEnabled(TabViewIndex() < TabViewNumTabs() - 1);
|
||||
}
|
||||
const auto tabIndex = TabViewIndex();
|
||||
const auto numOfTabs = TabViewNumTabs();
|
||||
|
||||
void TabBase::_CloseTabsAfter()
|
||||
{
|
||||
CloseTabsAfterArgs args{ _TabViewIndex };
|
||||
ActionAndArgs closeTabsAfter{ ShortcutAction::CloseTabsAfter, args };
|
||||
// enabled if there are other tabs
|
||||
_closeOtherTabsMenuItem.IsEnabled(numOfTabs > 1);
|
||||
|
||||
_dispatch.DoAction(closeTabsAfter);
|
||||
}
|
||||
// enabled if there are other tabs on the right
|
||||
_closeTabsAfterMenuItem.IsEnabled(tabIndex < numOfTabs - 1);
|
||||
|
||||
void TabBase::_CloseOtherTabs()
|
||||
{
|
||||
CloseOtherTabsArgs args{ _TabViewIndex };
|
||||
ActionAndArgs closeOtherTabs{ ShortcutAction::CloseOtherTabs, args };
|
||||
// enabled if not left-most tab
|
||||
_moveLeftMenuItem.IsEnabled(tabIndex > 0);
|
||||
|
||||
_dispatch.DoAction(closeOtherTabs);
|
||||
// enabled if not last tab
|
||||
_moveRightMenuItem.IsEnabled(tabIndex < numOfTabs - 1);
|
||||
}
|
||||
|
||||
void TabBase::UpdateTabViewIndex(const uint32_t idx, const uint32_t numTabs)
|
||||
@@ -164,7 +225,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
TabViewIndex(idx);
|
||||
TabViewNumTabs(numTabs);
|
||||
_EnableCloseMenuItems();
|
||||
_EnableMenuItems();
|
||||
_UpdateSwitchToTabKeyChord();
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,9 @@ namespace winrt::TerminalApp::implementation
|
||||
winrt::Windows::UI::Xaml::FocusState _focusState{ winrt::Windows::UI::Xaml::FocusState::Unfocused };
|
||||
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeOtherTabsMenuItem{};
|
||||
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeTabsAfterMenuItem{};
|
||||
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _moveToNewWindowMenuItem{};
|
||||
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _moveRightMenuItem{};
|
||||
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _moveLeftMenuItem{};
|
||||
winrt::TerminalApp::ShortcutActionDispatch _dispatch;
|
||||
Microsoft::Terminal::Settings::Model::IActionMapView _actionMap{ nullptr };
|
||||
winrt::hstring _keyChord{};
|
||||
@@ -69,10 +72,9 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
virtual void _MakeTabViewItem();
|
||||
|
||||
void _AppendMoveMenuItems(winrt::Windows::UI::Xaml::Controls::MenuFlyout flyout);
|
||||
winrt::Windows::UI::Xaml::Controls::MenuFlyoutSubItem _AppendCloseMenuItems(winrt::Windows::UI::Xaml::Controls::MenuFlyout flyout);
|
||||
void _EnableCloseMenuItems();
|
||||
void _CloseTabsAfter();
|
||||
void _CloseOtherTabs();
|
||||
void _EnableMenuItems();
|
||||
void _UpdateSwitchToTabKeyChord();
|
||||
void _UpdateToolTip();
|
||||
|
||||
|
||||
@@ -196,7 +196,6 @@ namespace winrt::TerminalApp::implementation
|
||||
til::typed_event<IInspectable, winrt::TerminalApp::RenameWindowRequestedArgs> RenameWindowRequested;
|
||||
til::typed_event<IInspectable, IInspectable> SummonWindowRequested;
|
||||
|
||||
til::typed_event<IInspectable, IInspectable> CloseRequested;
|
||||
til::typed_event<IInspectable, IInspectable> OpenSystemMenu;
|
||||
til::typed_event<IInspectable, IInspectable> QuitRequested;
|
||||
til::typed_event<IInspectable, winrt::Microsoft::Terminal::Control::ShowWindowArgs> ShowWindowChanged;
|
||||
|
||||
@@ -101,7 +101,6 @@ namespace TerminalApp
|
||||
event Windows.Foundation.TypedEventHandler<Object, RenameWindowRequestedArgs> RenameWindowRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> CloseRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.ShowWindowArgs> ShowWindowChanged;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "Utils.h"
|
||||
#include "ColorHelper.h"
|
||||
#include "AppLogic.h"
|
||||
#include "../inc/WindowingBehavior.h"
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
@@ -976,6 +975,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// active control in this tab. We'll just recalculate the
|
||||
// current color anyways.
|
||||
tab->_RecalculateAndApplyTabColor();
|
||||
tab->_tabStatus.TabColorIndicator(tab->GetTabColor().value_or(Windows::UI::Colors::Transparent()));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1442,23 +1442,6 @@ namespace winrt::TerminalApp::implementation
|
||||
Automation::AutomationProperties::SetHelpText(splitTabMenuItem, splitTabToolTip);
|
||||
}
|
||||
|
||||
Controls::MenuFlyoutItem moveTabToNewWindowMenuItem;
|
||||
{
|
||||
// "Move tab to new window"
|
||||
Controls::FontIcon moveTabToNewWindowTabSymbol;
|
||||
moveTabToNewWindowTabSymbol.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
|
||||
moveTabToNewWindowTabSymbol.Glyph(L"\xE8A7");
|
||||
|
||||
moveTabToNewWindowMenuItem.Click({ get_weak(), &TerminalTab::_moveTabToNewWindowClicked });
|
||||
moveTabToNewWindowMenuItem.Text(RS_(L"MoveTabToNewWindowText"));
|
||||
moveTabToNewWindowMenuItem.Icon(moveTabToNewWindowTabSymbol);
|
||||
|
||||
const auto moveTabToNewWindowToolTip = RS_(L"MoveTabToNewWindowToolTip");
|
||||
|
||||
WUX::Controls::ToolTipService::SetToolTip(moveTabToNewWindowMenuItem, box_value(moveTabToNewWindowToolTip));
|
||||
Automation::AutomationProperties::SetHelpText(moveTabToNewWindowMenuItem, moveTabToNewWindowToolTip);
|
||||
}
|
||||
|
||||
Controls::MenuFlyoutItem closePaneMenuItem = _closePaneMenuItem;
|
||||
{
|
||||
// "Close pane"
|
||||
@@ -1534,12 +1517,15 @@ namespace winrt::TerminalApp::implementation
|
||||
contextMenuFlyout.Items().Append(renameTabMenuItem);
|
||||
contextMenuFlyout.Items().Append(duplicateTabMenuItem);
|
||||
contextMenuFlyout.Items().Append(splitTabMenuItem);
|
||||
contextMenuFlyout.Items().Append(moveTabToNewWindowMenuItem);
|
||||
_AppendMoveMenuItems(contextMenuFlyout);
|
||||
contextMenuFlyout.Items().Append(exportTabMenuItem);
|
||||
contextMenuFlyout.Items().Append(findMenuItem);
|
||||
contextMenuFlyout.Items().Append(restartConnectionMenuItem);
|
||||
contextMenuFlyout.Items().Append(menuSeparator);
|
||||
|
||||
auto closeSubMenu = _AppendCloseMenuItems(contextMenuFlyout);
|
||||
closeSubMenu.Items().Append(closePaneMenuItem);
|
||||
|
||||
// GH#5750 - When the context menu is dismissed with ESC, toss the focus
|
||||
// back to our control.
|
||||
contextMenuFlyout.Closed([weakThis](auto&&, auto&&) {
|
||||
@@ -1559,8 +1545,6 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
});
|
||||
auto closeSubMenu = _AppendCloseMenuItems(contextMenuFlyout);
|
||||
closeSubMenu.Items().Append(closePaneMenuItem);
|
||||
|
||||
TabViewItem().ContextFlyout(contextMenuFlyout);
|
||||
}
|
||||
@@ -1617,6 +1601,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
_runtimeTabColor.emplace(color);
|
||||
_RecalculateAndApplyTabColor();
|
||||
_tabStatus.TabColorIndicator(color);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -1633,6 +1618,7 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
_runtimeTabColor.reset();
|
||||
_RecalculateAndApplyTabColor();
|
||||
_tabStatus.TabColorIndicator(GetTabColor().value_or(Windows::UI::Colors::Transparent()));
|
||||
}
|
||||
|
||||
winrt::Windows::UI::Xaml::Media::Brush TerminalTab::_BackgroundBrush()
|
||||
@@ -1998,13 +1984,6 @@ namespace winrt::TerminalApp::implementation
|
||||
actionAndArgs.Action(ShortcutAction::ExportBuffer);
|
||||
_dispatch.DoAction(*this, actionAndArgs);
|
||||
}
|
||||
void TerminalTab::_moveTabToNewWindowClicked(const winrt::Windows::Foundation::IInspectable& /* sender */,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& /* args */)
|
||||
{
|
||||
MoveTabArgs args{ winrt::to_hstring(NewWindow), MoveTabDirection::Forward };
|
||||
ActionAndArgs actionAndArgs{ ShortcutAction::MoveTab, args };
|
||||
_dispatch.DoAction(*this, actionAndArgs);
|
||||
}
|
||||
void TerminalTab::_findClicked(const winrt::Windows::Foundation::IInspectable& /* sender */,
|
||||
const winrt::Windows::UI::Xaml::RoutedEventArgs& /* args */)
|
||||
{
|
||||
|
||||
@@ -196,7 +196,6 @@ namespace winrt::TerminalApp::implementation
|
||||
void _splitTabClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _closePaneClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _exportTextClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _moveTabToNewWindowClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
void _findClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
|
||||
|
||||
void _bubbleRestartTerminalRequested(TerminalApp::TerminalPaneContent sender, const winrt::Windows::Foundation::IInspectable& args);
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace winrt::TerminalApp::implementation
|
||||
WINRT_OBSERVABLE_PROPERTY(bool, IsReadOnlyActive, PropertyChanged.raise);
|
||||
WINRT_OBSERVABLE_PROPERTY(uint32_t, ProgressValue, PropertyChanged.raise);
|
||||
WINRT_OBSERVABLE_PROPERTY(bool, IsInputBroadcastActive, PropertyChanged.raise);
|
||||
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Color, TabColorIndicator, PropertyChanged.raise);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -15,5 +15,6 @@ namespace TerminalApp
|
||||
UInt32 ProgressValue { get; set; };
|
||||
Boolean IsReadOnlyActive { get; set; };
|
||||
Boolean IsInputBroadcastActive { get; set; };
|
||||
Windows.UI.Color TabColorIndicator { get; set; };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +223,6 @@ namespace winrt::TerminalApp::implementation
|
||||
FORWARDED_TYPED_EVENT(IdentifyWindowsRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, IdentifyWindowsRequested);
|
||||
FORWARDED_TYPED_EVENT(RenameWindowRequested, Windows::Foundation::IInspectable, winrt::TerminalApp::RenameWindowRequestedArgs, _root, RenameWindowRequested);
|
||||
FORWARDED_TYPED_EVENT(SummonWindowRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, SummonWindowRequested);
|
||||
FORWARDED_TYPED_EVENT(CloseRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, CloseRequested);
|
||||
FORWARDED_TYPED_EVENT(OpenSystemMenu, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, OpenSystemMenu);
|
||||
FORWARDED_TYPED_EVENT(QuitRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, QuitRequested);
|
||||
FORWARDED_TYPED_EVENT(ShowWindowChanged, Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Control::ShowWindowArgs, _root, ShowWindowChanged);
|
||||
|
||||
@@ -127,7 +127,6 @@ namespace TerminalApp
|
||||
event Windows.Foundation.TypedEventHandler<Object, RenameWindowRequestedArgs> RenameWindowRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> IsQuakeWindowChanged;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> CloseRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
|
||||
event Windows.Foundation.TypedEventHandler<Object, Object> QuitRequested;
|
||||
event Windows.Foundation.TypedEventHandler<Object, TerminalApp.SystemMenuChangeArgs> SystemMenuChangeRequested;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <winrt/Windows.UI.Xaml.Automation.Peers.h>
|
||||
#include <winrt/Windows.UI.Xaml.Controls.h>
|
||||
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
|
||||
#include <winrt/Windows.UI.Xaml.Shapes.h>
|
||||
#include <winrt/Windows.UI.Xaml.Data.h>
|
||||
#include <winrt/Windows.UI.Xaml.Documents.h>
|
||||
#include <winrt/Windows.UI.Xaml.Input.h>
|
||||
|
||||
@@ -198,6 +198,17 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
}
|
||||
});
|
||||
|
||||
// If you rapidly show/hide Windows Terminal, something about GotFocus()/LostFocus() gets broken.
|
||||
// We'll then receive easily 10+ such calls from WinUI the next time the application is shown.
|
||||
shared->focusChanged = std::make_unique<til::debounced_func_trailing<bool>>(
|
||||
std::chrono::milliseconds{ 25 },
|
||||
[weakThis = get_weak()](const bool focused) {
|
||||
if (const auto core{ weakThis.get() })
|
||||
{
|
||||
core->_focusChanged(focused);
|
||||
}
|
||||
});
|
||||
|
||||
// Scrollbar updates are also expensive (XAML), so we'll throttle them as well.
|
||||
shared->updateScrollBar = std::make_shared<ThrottledFuncTrailing<Control::ScrollPositionChangedArgs>>(
|
||||
_dispatcher,
|
||||
@@ -1688,38 +1699,41 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
SearchResults ControlCore::Search(SearchRequest request)
|
||||
{
|
||||
const auto lock = _terminal->LockForWriting();
|
||||
|
||||
SearchFlag flags{};
|
||||
WI_SetFlagIf(flags, SearchFlag::CaseInsensitive, !request.CaseSensitive);
|
||||
WI_SetFlagIf(flags, SearchFlag::RegularExpression, request.RegularExpression);
|
||||
const auto searchInvalidated = _searcher.IsStale(*_terminal.get(), request.Text, flags);
|
||||
|
||||
if (searchInvalidated || !request.Reset)
|
||||
if (searchInvalidated || !request.ResetOnly)
|
||||
{
|
||||
std::vector<til::point_span> oldResults;
|
||||
til::point_span oldFocused;
|
||||
|
||||
if (const auto focused = _terminal->GetSearchHighlightFocused())
|
||||
{
|
||||
oldFocused = *focused;
|
||||
}
|
||||
|
||||
if (searchInvalidated)
|
||||
{
|
||||
oldResults = _searcher.ExtractResults();
|
||||
_searcher.Reset(*_terminal.get(), request.Text, flags, !request.GoForward);
|
||||
|
||||
if (SnapSearchResultToSelection())
|
||||
{
|
||||
_searcher.MoveToCurrentSelection();
|
||||
SnapSearchResultToSelection(false);
|
||||
}
|
||||
|
||||
_terminal->SetSearchHighlights(_searcher.Results());
|
||||
}
|
||||
else
|
||||
|
||||
if (!request.ResetOnly)
|
||||
{
|
||||
_searcher.FindNext(!request.GoForward);
|
||||
}
|
||||
|
||||
if (const auto idx = _searcher.CurrentMatch(); idx >= 0)
|
||||
{
|
||||
_terminal->SetSearchHighlightFocused(gsl::narrow<size_t>(idx), request.ScrollOffset);
|
||||
}
|
||||
_terminal->SetSearchHighlightFocused(gsl::narrow<size_t>(std::max<ptrdiff_t>(0, _searcher.CurrentMatch())));
|
||||
_renderer->TriggerSearchHighlight(oldResults);
|
||||
|
||||
if (const auto focused = _terminal->GetSearchHighlightFocused(); focused && *focused != oldFocused)
|
||||
{
|
||||
_terminal->ScrollToSearchHighlight(request.ScrollOffset);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t totalMatches = 0;
|
||||
@@ -1747,27 +1761,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
const auto lock = _terminal->LockForWriting();
|
||||
_terminal->SetSearchHighlights({});
|
||||
_terminal->SetSearchHighlightFocused({}, 0);
|
||||
_terminal->SetSearchHighlightFocused(0);
|
||||
_renderer->TriggerSearchHighlight(_searcher.Results());
|
||||
_searcher = {};
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Tells ControlCore to snap the current search result index to currently
|
||||
// selected text if the search was started using it.
|
||||
void ControlCore::SnapSearchResultToSelection(bool shouldSnap) noexcept
|
||||
{
|
||||
_snapSearchResultToSelection = shouldSnap;
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Returns true, if we should snap the current search result index to
|
||||
// the currently selected text after a new search is started, else false.
|
||||
bool ControlCore::SnapSearchResultToSelection() const noexcept
|
||||
{
|
||||
return _snapSearchResultToSelection;
|
||||
}
|
||||
|
||||
void ControlCore::Close()
|
||||
{
|
||||
if (!_IsClosing())
|
||||
@@ -2212,19 +2210,32 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - <none>
|
||||
void ControlCore::ClearBuffer(Control::ClearBufferType clearType)
|
||||
{
|
||||
if (clearType == Control::ClearBufferType::Scrollback || clearType == Control::ClearBufferType::All)
|
||||
std::wstring_view command;
|
||||
switch (clearType)
|
||||
{
|
||||
case ClearBufferType::Screen:
|
||||
command = L"\x1b[H\x1b[2J";
|
||||
break;
|
||||
case ClearBufferType::Scrollback:
|
||||
command = L"\x1b[3J";
|
||||
break;
|
||||
case ClearBufferType::All:
|
||||
command = L"\x1b[H\x1b[2J\x1b[3J";
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
const auto lock = _terminal->LockForWriting();
|
||||
_terminal->EraseScrollback();
|
||||
_terminal->Write(command);
|
||||
}
|
||||
|
||||
if (clearType == Control::ClearBufferType::Screen || clearType == Control::ClearBufferType::All)
|
||||
{
|
||||
// Send a signal to conpty to clear the buffer.
|
||||
if (auto conpty{ _connection.try_as<TerminalConnection::ConptyConnection>() })
|
||||
{
|
||||
// ConPTY will emit sequences to sync up our buffer with its new
|
||||
// contents.
|
||||
// Since the clearing of ConPTY occurs asynchronously, this call can result weird issues,
|
||||
// where a console application still sees contents that we've already deleted, etc.
|
||||
// The correct way would be for ConPTY to emit the appropriate CSI n J sequences.
|
||||
conpty.ClearBuffer();
|
||||
}
|
||||
}
|
||||
@@ -2471,13 +2482,21 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// - This is related to work done for GH#2988.
|
||||
void ControlCore::GotFocus()
|
||||
{
|
||||
_focusChanged(true);
|
||||
const auto shared = _shared.lock_shared();
|
||||
if (shared->focusChanged)
|
||||
{
|
||||
(*shared->focusChanged)(true);
|
||||
}
|
||||
}
|
||||
|
||||
// See GotFocus.
|
||||
void ControlCore::LostFocus()
|
||||
{
|
||||
_focusChanged(false);
|
||||
const auto shared = _shared.lock_shared();
|
||||
if (shared->focusChanged)
|
||||
{
|
||||
(*shared->focusChanged)(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlCore::_focusChanged(bool focused)
|
||||
|
||||
@@ -228,8 +228,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
SearchResults Search(SearchRequest request);
|
||||
const std::vector<til::point_span>& SearchResultRows() const noexcept;
|
||||
void ClearSearch();
|
||||
void SnapSearchResultToSelection(bool snap) noexcept;
|
||||
bool SnapSearchResultToSelection() const noexcept;
|
||||
|
||||
void LeftClickOnTerminal(const til::point terminalPosition,
|
||||
const int numberOfClicks,
|
||||
@@ -306,6 +304,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
struct SharedState
|
||||
{
|
||||
std::unique_ptr<til::debounced_func_trailing<>> outputIdle;
|
||||
std::unique_ptr<til::debounced_func_trailing<bool>> focusChanged;
|
||||
std::shared_ptr<ThrottledFuncTrailing<Control::ScrollPositionChangedArgs>> updateScrollBar;
|
||||
};
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Microsoft.Terminal.Control
|
||||
Boolean GoForward;
|
||||
Boolean CaseSensitive;
|
||||
Boolean RegularExpression;
|
||||
Boolean Reset;
|
||||
Boolean ResetOnly;
|
||||
Int32 ScrollOffset;
|
||||
};
|
||||
|
||||
@@ -148,7 +148,6 @@ namespace Microsoft.Terminal.Control
|
||||
|
||||
SearchResults Search(SearchRequest request);
|
||||
void ClearSearch();
|
||||
Boolean SnapSearchResultToSelection;
|
||||
|
||||
Microsoft.Terminal.Core.Color ForegroundColor { get; };
|
||||
Microsoft.Terminal.Core.Color BackgroundColor { get; };
|
||||
|
||||
@@ -725,16 +725,4 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
return _core->GetRenderData();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Used by the TermControl to know if it should translate drag-dropped
|
||||
// paths into WSL-friendly paths.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - true if the connection we were created with was a WSL profile.
|
||||
bool ControlInteractivity::ManglePathsForWsl()
|
||||
{
|
||||
return _core->Settings().ProfileSource() == L"Windows.Terminal.Wsl";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
const Windows::Foundation::IReference<CopyFormat>& formats);
|
||||
void RequestPasteTextFromClipboard();
|
||||
void SetEndSelectionPoint(const Core::Point pixelPosition);
|
||||
bool ManglePathsForWsl();
|
||||
|
||||
uint64_t Id();
|
||||
void AttachToNewControl(const Microsoft::Terminal::Control::IKeyBindings& keyBindings);
|
||||
|
||||
@@ -66,8 +66,6 @@ namespace Microsoft.Terminal.Control
|
||||
|
||||
void UpdateScrollbar(Single newValue);
|
||||
|
||||
Boolean ManglePathsForWsl { get; };
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<Object, OpenHyperlinkEventArgs> OpenHyperlink;
|
||||
event Windows.Foundation.TypedEventHandler<Object, ScrollPositionChangedArgs> ScrollPositionChanged;
|
||||
event Windows.Foundation.TypedEventHandler<Object, PasteFromClipboardEventArgs> PasteFromClipboard;
|
||||
|
||||
@@ -25,6 +25,12 @@ namespace Microsoft.Terminal.Control
|
||||
Console,
|
||||
};
|
||||
|
||||
enum DefaultInputScope
|
||||
{
|
||||
Default,
|
||||
AlphanumericHalfWidth,
|
||||
};
|
||||
|
||||
runtimeclass FontSizeChangedArgs
|
||||
{
|
||||
Int32 Width { get; };
|
||||
|
||||
@@ -891,6 +891,9 @@ void _stdcall TerminalSetTheme(void* terminal, TerminalTheme theme, LPCWSTR font
|
||||
renderSettings.SetColorTableEntry(tableIndex, gsl::at(theme.ColorTable, tableIndex));
|
||||
}
|
||||
|
||||
// Save these values as the new default render settings.
|
||||
renderSettings.SaveDefaultSettings();
|
||||
|
||||
publicTerminal->_terminal->SetCursorStyle(static_cast<Microsoft::Console::VirtualTerminal::DispatchTypes::CursorStyle>(theme.CursorStyle));
|
||||
|
||||
publicTerminal->_desiredFont = { fontFamily, 0, DEFAULT_FONT_WEIGHT, static_cast<float>(fontSize), CP_UTF8 };
|
||||
|
||||
@@ -21,6 +21,14 @@ namespace Microsoft.Terminal.Control
|
||||
Aliased
|
||||
};
|
||||
|
||||
enum PathTranslationStyle
|
||||
{
|
||||
None = 0,
|
||||
WSL,
|
||||
Cygwin,
|
||||
MSYS2
|
||||
};
|
||||
|
||||
// Class Description:
|
||||
// TerminalSettings encapsulates all settings that control the
|
||||
// TermControl's behavior. In these settings there is both the entirety
|
||||
@@ -30,7 +38,6 @@ namespace Microsoft.Terminal.Control
|
||||
Microsoft.Terminal.Control.IControlAppearance
|
||||
{
|
||||
String ProfileName;
|
||||
String ProfileSource;
|
||||
|
||||
Boolean EnableUnfocusedAcrylic { get; };
|
||||
Guid SessionId { get; };
|
||||
@@ -63,11 +70,14 @@ namespace Microsoft.Terminal.Control
|
||||
Boolean DisablePartialInvalidation { get; };
|
||||
Boolean SoftwareRendering { get; };
|
||||
Microsoft.Terminal.Control.TextMeasurement TextMeasurement { get; };
|
||||
Microsoft.Terminal.Control.DefaultInputScope DefaultInputScope { get; };
|
||||
Boolean ShowMarks { get; };
|
||||
Boolean UseBackgroundImageForWindow { get; };
|
||||
Boolean RightClickContextMenu { get; };
|
||||
Boolean RepositionCursorWithMouse { get; };
|
||||
|
||||
PathTranslationStyle PathTranslationStyle { get; };
|
||||
|
||||
// NOTE! When adding something here, make sure to update ControlProperties.h too!
|
||||
};
|
||||
}
|
||||
|
||||
@@ -58,6 +58,66 @@ static Microsoft::Console::TSF::Handle& GetTSFHandle()
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
static void _translatePathInPlace(std::wstring& fullPath, PathTranslationStyle translationStyle)
|
||||
{
|
||||
static constexpr wil::zwstring_view s_pathPrefixes[] = {
|
||||
{},
|
||||
/* WSL */ L"/mnt/",
|
||||
/* Cygwin */ L"/cygdrive/",
|
||||
/* MSYS2 */ L"/",
|
||||
};
|
||||
static constexpr wil::zwstring_view sSingleQuoteEscape = L"'\\''";
|
||||
static constexpr auto cchSingleQuoteEscape = sSingleQuoteEscape.size();
|
||||
|
||||
if (translationStyle == PathTranslationStyle::None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// All of the other path translation modes current result in /-delimited paths
|
||||
std::replace(fullPath.begin(), fullPath.end(), L'\\', L'/');
|
||||
|
||||
// Escape single quotes, assuming translated paths are always quoted by a pair of single quotes.
|
||||
size_t pos = 0;
|
||||
while ((pos = fullPath.find(L'\'', pos)) != std::wstring::npos)
|
||||
{
|
||||
// ' -> '\'' (for POSIX shell)
|
||||
fullPath.replace(pos, 1, sSingleQuoteEscape);
|
||||
// Arithmetic overflow cannot occur here.
|
||||
pos += cchSingleQuoteEscape;
|
||||
}
|
||||
|
||||
if (fullPath.size() >= 2 && fullPath.at(1) == L':')
|
||||
{
|
||||
// C:/foo/bar -> Cc/foo/bar
|
||||
fullPath.at(1) = til::tolower_ascii(fullPath.at(0));
|
||||
// Cc/foo/bar -> [PREFIX]c/foo/bar
|
||||
fullPath.replace(0, 1, s_pathPrefixes[static_cast<int>(translationStyle)]);
|
||||
}
|
||||
else if (translationStyle == PathTranslationStyle::WSL)
|
||||
{
|
||||
// Stripping the UNC name and distribution prefix only applies to WSL.
|
||||
static constexpr std::wstring_view wslPathPrefixes[] = { L"//wsl.localhost/", L"//wsl$/" };
|
||||
for (auto prefix : wslPathPrefixes)
|
||||
{
|
||||
if (til::starts_with(fullPath, prefix))
|
||||
{
|
||||
if (const auto idx = fullPath.find(L'/', prefix.size()); idx != std::wstring::npos)
|
||||
{
|
||||
// //wsl.localhost/Ubuntu-18.04/foo/bar -> /foo/bar
|
||||
fullPath.erase(0, idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
// //wsl.localhost/Ubuntu-18.04 -> /
|
||||
fullPath = L"/";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TsfDataProvider::TsfDataProvider(TermControl* termControl) noexcept :
|
||||
_termControl{ termControl }
|
||||
{
|
||||
@@ -575,7 +635,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
// but since code paths differ, extra work is required to ensure correctness.
|
||||
if (!_core.HasMultiLineSelection())
|
||||
{
|
||||
_core.SnapSearchResultToSelection(true);
|
||||
const auto selectedLine{ _core.SelectedText(true) };
|
||||
_searchBox->PopulateTextbox(selectedLine);
|
||||
}
|
||||
@@ -862,6 +921,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
}
|
||||
|
||||
_interactivity.UpdateSettings();
|
||||
{
|
||||
const auto inputScope = settings.DefaultInputScope();
|
||||
const auto alpha = inputScope == DefaultInputScope::AlphanumericHalfWidth;
|
||||
::Microsoft::Console::TSF::Handle::SetDefaultScopeAlphanumericHalfWidth(alpha);
|
||||
}
|
||||
if (_automationPeer)
|
||||
{
|
||||
_automationPeer.SetControlPadding(Core::Padding{
|
||||
@@ -1630,12 +1694,29 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
{
|
||||
if (vkey == VK_ADD)
|
||||
{
|
||||
// Alt '+' <number> is used to input Unicode code points.
|
||||
// Every time you press + it resets the entire state
|
||||
// in the original OS implementation as well.
|
||||
s.encoding = AltNumpadEncoding::Unicode;
|
||||
s.accumulator = 0;
|
||||
s.active = true;
|
||||
static const auto enabled = []() {
|
||||
wchar_t buffer[4]{};
|
||||
DWORD size = sizeof(buffer);
|
||||
RegGetValueW(
|
||||
HKEY_CURRENT_USER,
|
||||
L"Control Panel\\Input Method",
|
||||
L"EnableHexNumpad",
|
||||
RRF_RT_REG_SZ,
|
||||
nullptr,
|
||||
&buffer[0],
|
||||
&size);
|
||||
return size == 4 && memcmp(&buffer[0], L"1", 4) == 0;
|
||||
}();
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
// Alt '+' <number> is used to input Unicode code points.
|
||||
// Every time you press + it resets the entire state
|
||||
// in the original OS implementation as well.
|
||||
s.encoding = AltNumpadEncoding::Unicode;
|
||||
s.accumulator = 0;
|
||||
s.active = true;
|
||||
}
|
||||
}
|
||||
else if (vkey == VK_NUMPAD0 && s.encoding == AltNumpadEncoding::OEM && s.accumulator == 0)
|
||||
{
|
||||
@@ -3175,54 +3256,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
allPathsString += L" ";
|
||||
}
|
||||
|
||||
// Fix path for WSL
|
||||
// In the fullness of time, we should likely plumb this up
|
||||
// to the TerminalApp layer, and have it make the decision
|
||||
// if this control should have its path mangled (and do the
|
||||
// mangling), rather than exposing the source concept to the
|
||||
// Control layer.
|
||||
//
|
||||
// However, it's likely that the control layer may need to
|
||||
// know about the source anyways in the future, to support
|
||||
// GH#3158
|
||||
const auto isWSL = _interactivity.ManglePathsForWsl();
|
||||
const auto translationStyle{ _core.Settings().PathTranslationStyle() };
|
||||
_translatePathInPlace(fullPath, translationStyle);
|
||||
|
||||
if (isWSL)
|
||||
{
|
||||
std::replace(fullPath.begin(), fullPath.end(), L'\\', L'/');
|
||||
|
||||
if (fullPath.size() >= 2 && fullPath.at(1) == L':')
|
||||
{
|
||||
// C:/foo/bar -> Cc/foo/bar
|
||||
fullPath.at(1) = til::tolower_ascii(fullPath.at(0));
|
||||
// Cc/foo/bar -> /mnt/c/foo/bar
|
||||
fullPath.replace(0, 1, L"/mnt/");
|
||||
}
|
||||
else
|
||||
{
|
||||
static constexpr std::wstring_view wslPathPrefixes[] = { L"//wsl.localhost/", L"//wsl$/" };
|
||||
for (auto prefix : wslPathPrefixes)
|
||||
{
|
||||
if (til::starts_with(fullPath, prefix))
|
||||
{
|
||||
if (const auto idx = fullPath.find(L'/', prefix.size()); idx != std::wstring::npos)
|
||||
{
|
||||
// //wsl.localhost/Ubuntu-18.04/foo/bar -> /foo/bar
|
||||
fullPath.erase(0, idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
// //wsl.localhost/Ubuntu-18.04 -> /
|
||||
fullPath = L"/";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto quotesNeeded = isWSL || fullPath.find(L' ') != std::wstring::npos;
|
||||
const auto quotesChar = isWSL ? L'\'' : L'"';
|
||||
// All translated paths get quotes, and all strings spaces get quotes; all translated paths get single quotes
|
||||
const auto quotesNeeded = translationStyle != PathTranslationStyle::None || fullPath.find(L' ') != std::wstring::npos;
|
||||
const auto quotesChar = translationStyle != PathTranslationStyle::None ? L'\'' : L'"';
|
||||
|
||||
// Append fullPath and also wrap it in quotes if needed
|
||||
if (quotesNeeded)
|
||||
@@ -3807,7 +3846,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
||||
const auto goForward = _searchBox->GoForward();
|
||||
const auto caseSensitive = _searchBox->CaseSensitive();
|
||||
const auto regularExpression = _searchBox->RegularExpression();
|
||||
const auto request = SearchRequest{ text, goForward, caseSensitive, regularExpression, true, _calculateSearchScrollOffset() };
|
||||
const auto request = SearchRequest{ text, goForward, caseSensitive, regularExpression, true, _searchScrollOffset };
|
||||
_handleSearchResults(_core.Search(request));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace Microsoft.Terminal.Core
|
||||
String WordDelimiters;
|
||||
|
||||
Boolean ForceVTInput;
|
||||
Boolean AllowVtChecksumReport;
|
||||
Boolean AllowVtClipboardWrite;
|
||||
Boolean TrimBlockSelection;
|
||||
Boolean DetectURLs;
|
||||
|
||||
|
||||
@@ -89,6 +89,12 @@ void Terminal::UpdateSettings(ICoreSettings settings)
|
||||
_trimBlockSelection = settings.TrimBlockSelection();
|
||||
_autoMarkPrompts = settings.AutoMarkPrompts();
|
||||
_rainbowSuggestions = settings.RainbowSuggestions();
|
||||
_clipboardOperationsAllowed = settings.AllowVtClipboardWrite();
|
||||
|
||||
if (_stateMachine)
|
||||
{
|
||||
SetVtChecksumReportSupport(settings.AllowVtChecksumReport());
|
||||
}
|
||||
|
||||
_getTerminalInput().ForceDisableWin32InputMode(settings.ForceVTInput());
|
||||
|
||||
@@ -101,6 +107,9 @@ void Terminal::UpdateSettings(ICoreSettings settings)
|
||||
GetRenderSettings().SetColorTableEntry(TextColor::FRAME_BACKGROUND, til::color{ settings.TabColor().Value() });
|
||||
}
|
||||
|
||||
// Save the changes made above and in UpdateAppearance as the new default render settings.
|
||||
GetRenderSettings().SaveDefaultSettings();
|
||||
|
||||
if (!_startingTabColor && settings.StartingTabColor())
|
||||
{
|
||||
_startingTabColor = settings.StartingTabColor().Value();
|
||||
@@ -209,10 +218,10 @@ void Terminal::SetCursorStyle(const DispatchTypes::CursorStyle cursorStyle)
|
||||
engine.Dispatch().SetCursorStyle(cursorStyle);
|
||||
}
|
||||
|
||||
void Terminal::EraseScrollback()
|
||||
void Terminal::SetVtChecksumReportSupport(const bool enabled)
|
||||
{
|
||||
auto& engine = reinterpret_cast<OutputStateMachineEngine&>(_stateMachine->Engine());
|
||||
engine.Dispatch().EraseInDisplay(DispatchTypes::EraseType::Scrollback);
|
||||
engine.Dispatch().SetVtChecksumReportSupport(enabled);
|
||||
}
|
||||
|
||||
bool Terminal::IsXtermBracketedPasteModeEnabled() const noexcept
|
||||
@@ -1254,15 +1263,17 @@ void Terminal::SetSearchHighlights(const std::vector<til::point_span>& highlight
|
||||
// Method Description:
|
||||
// - Stores the focused search highlighted region in the terminal
|
||||
// - If the region isn't empty, it will be brought into view
|
||||
void Terminal::SetSearchHighlightFocused(const size_t focusedIdx, til::CoordType searchScrollOffset)
|
||||
void Terminal::SetSearchHighlightFocused(const size_t focusedIdx) noexcept
|
||||
{
|
||||
_assertLocked();
|
||||
_searchHighlightFocused = focusedIdx;
|
||||
}
|
||||
|
||||
// bring the focused region into the view if the index is in valid range
|
||||
if (focusedIdx < _searchHighlights.size())
|
||||
void Terminal::ScrollToSearchHighlight(til::CoordType searchScrollOffset)
|
||||
{
|
||||
if (_searchHighlightFocused < _searchHighlights.size())
|
||||
{
|
||||
const auto focused = til::at(_searchHighlights, focusedIdx);
|
||||
const auto focused = til::at(_searchHighlights, _searchHighlightFocused);
|
||||
const auto adjustedStart = til::point{ focused.start.x, std::max(0, focused.start.y - searchScrollOffset) };
|
||||
const auto adjustedEnd = til::point{ focused.end.x, std::max(0, focused.end.y - searchScrollOffset) };
|
||||
_ScrollToPoints(adjustedStart, adjustedEnd);
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
void UpdateAppearance(const winrt::Microsoft::Terminal::Core::ICoreAppearance& appearance);
|
||||
void SetFontInfo(const FontInfo& fontInfo);
|
||||
void SetCursorStyle(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::CursorStyle cursorStyle);
|
||||
void EraseScrollback();
|
||||
void SetVtChecksumReportSupport(const bool enabled);
|
||||
bool IsXtermBracketedPasteModeEnabled() const noexcept;
|
||||
std::wstring_view GetWorkingDirectory() noexcept;
|
||||
|
||||
@@ -233,7 +233,8 @@ public:
|
||||
void SetSearchMissingCommandCallback(std::function<void(std::wstring_view, const til::CoordType)> pfn) noexcept;
|
||||
void SetClearQuickFixCallback(std::function<void()> pfn) noexcept;
|
||||
void SetSearchHighlights(const std::vector<til::point_span>& highlights) noexcept;
|
||||
void SetSearchHighlightFocused(const size_t focusedIdx, til::CoordType searchScrollOffset);
|
||||
void SetSearchHighlightFocused(size_t focusedIdx) noexcept;
|
||||
void ScrollToSearchHighlight(til::CoordType searchScrollOffset);
|
||||
|
||||
void BlinkCursor() noexcept;
|
||||
void SetCursorOn(const bool isOn) noexcept;
|
||||
@@ -408,6 +409,7 @@ private:
|
||||
Microsoft::Console::Types::Viewport _mutableViewport;
|
||||
til::CoordType _scrollbackLines = 0;
|
||||
bool _detectURLs = false;
|
||||
bool _clipboardOperationsAllowed = true;
|
||||
|
||||
til::size _altBufferSize;
|
||||
std::optional<til::size> _deferredResize;
|
||||
|
||||
@@ -86,7 +86,7 @@ void Terminal::SetWindowTitle(const std::wstring_view title)
|
||||
_assertLocked();
|
||||
if (!_suppressApplicationTitle)
|
||||
{
|
||||
_title.emplace(title);
|
||||
_title.emplace(title.empty() ? _startingTitle : title);
|
||||
_pfnTitleChanged(_title.value());
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,10 @@ unsigned int Terminal::GetConsoleOutputCP() const noexcept
|
||||
|
||||
void Terminal::CopyToClipboard(wil::zwstring_view content)
|
||||
{
|
||||
_pfnCopyToClipboard(content);
|
||||
if (_clipboardOperationsAllowed)
|
||||
{
|
||||
_pfnCopyToClipboard(content);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -178,7 +178,7 @@
|
||||
<!-- command name -->
|
||||
<ColumnDefinition Width="*" />
|
||||
<!-- key chord -->
|
||||
<ColumnDefinition Width="150" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<!-- edit buttons -->
|
||||
<!--
|
||||
This needs to be 112 because that is the width of the row of buttons in edit mode + padding.
|
||||
@@ -307,7 +307,7 @@
|
||||
Glyph="" />
|
||||
</Button.Content>
|
||||
<Button.Flyout>
|
||||
<Flyout>
|
||||
<Flyout FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}">
|
||||
<StackPanel>
|
||||
<TextBlock x:Uid="Actions_DeleteConfirmationMessage"
|
||||
Style="{StaticResource CustomFlyoutTextStyle}" />
|
||||
|
||||
@@ -289,14 +289,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
// Display a confirmation dialog.
|
||||
TextBlock errorMessageTB{};
|
||||
errorMessageTB.Text(RS_(L"Actions_RenameConflictConfirmationMessage"));
|
||||
errorMessageTB.TextWrapping(TextWrapping::Wrap);
|
||||
|
||||
const auto conflictingCmdName{ conflictingCmd.Name() };
|
||||
TextBlock conflictingCommandNameTB{};
|
||||
conflictingCommandNameTB.Text(fmt::format(L"\"{}\"", conflictingCmdName.empty() ? RS_(L"Actions_UnnamedCommandName") : conflictingCmdName));
|
||||
conflictingCommandNameTB.FontStyle(Windows::UI::Text::FontStyle::Italic);
|
||||
conflictingCommandNameTB.TextWrapping(TextWrapping::Wrap);
|
||||
|
||||
TextBlock confirmationQuestionTB{};
|
||||
confirmationQuestionTB.Text(RS_(L"Actions_RenameConflictConfirmationQuestion"));
|
||||
confirmationQuestionTB.TextWrapping(TextWrapping::Wrap);
|
||||
|
||||
Button acceptBTN{};
|
||||
acceptBTN.Content(box_value(RS_(L"Actions_RenameConflictConfirmationAcceptButton")));
|
||||
@@ -320,7 +323,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
flyoutStack.Children().Append(confirmationQuestionTB);
|
||||
flyoutStack.Children().Append(acceptBTN);
|
||||
|
||||
// This should match CustomFlyoutPresenterStyle in CommonResources.xaml!
|
||||
// We don't have access to those resources here, so it's easier to just copy them over.
|
||||
// This allows the flyout text to wrap
|
||||
Style acceptChangesFlyoutStyle{ winrt::xaml_typename<FlyoutPresenter>() };
|
||||
Setter horizontalScrollModeStyleSetter{ ScrollViewer::HorizontalScrollModeProperty(), box_value(ScrollMode::Disabled) };
|
||||
Setter horizontalScrollBarVisibilityStyleSetter{ ScrollViewer::HorizontalScrollBarVisibilityProperty(), box_value(ScrollBarVisibility::Disabled) };
|
||||
acceptChangesFlyoutStyle.Setters().Append(horizontalScrollModeStyleSetter);
|
||||
acceptChangesFlyoutStyle.Setters().Append(horizontalScrollBarVisibilityStyleSetter);
|
||||
|
||||
Flyout acceptChangesFlyout{};
|
||||
acceptChangesFlyout.FlyoutPresenterStyle(acceptChangesFlyoutStyle);
|
||||
acceptChangesFlyout.Content(flyoutStack);
|
||||
senderVM.AcceptChangesFlyout(acceptChangesFlyout);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
<!-- Used for disclaimers -->
|
||||
<Style x:Key="DisclaimerStyle"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="TextWrapping" Value="WrapWholeWords" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
<Setter Property="MaxWidth" Value="1000" />
|
||||
</Style>
|
||||
|
||||
@@ -125,6 +125,14 @@
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="Margin" Value="0,0,0,10" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
</Style>
|
||||
|
||||
<!-- Used for the flyout itself. Removes scroll bar to allow for text wrapping. -->
|
||||
<Style x:Key="CustomFlyoutPresenterStyle"
|
||||
TargetType="FlyoutPresenter">
|
||||
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
|
||||
</Style>
|
||||
|
||||
<!-- Number Box -->
|
||||
@@ -145,7 +153,7 @@
|
||||
BasedOn="{StaticResource BaseButtonStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="Margin" Value="10,0,0,0" />
|
||||
<Setter Property="Height" Value="33" />
|
||||
<Setter Property="MinHeight" Value="33" />
|
||||
</Style>
|
||||
|
||||
<!-- Delete button based on Accent button template -->
|
||||
|
||||
35
src/cascadia/TerminalSettingsEditor/Compatibility.cpp
Normal file
35
src/cascadia/TerminalSettingsEditor/Compatibility.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#include "pch.h"
|
||||
#include "Compatibility.h"
|
||||
#include "EnumEntry.h"
|
||||
#include "Compatibility.g.cpp"
|
||||
#include "CompatibilityViewModel.g.cpp"
|
||||
|
||||
using namespace winrt::Windows::UI::Xaml::Navigation;
|
||||
using namespace winrt::Microsoft::Terminal::Settings::Model;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
CompatibilityViewModel::CompatibilityViewModel(Model::GlobalAppSettings globalSettings) :
|
||||
_GlobalSettings{ globalSettings }
|
||||
{
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(TextMeasurement, TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, L"Globals_TextMeasurement_", L"Text");
|
||||
}
|
||||
|
||||
bool CompatibilityViewModel::DebugFeaturesAvailable() const noexcept
|
||||
{
|
||||
return Feature_DebugModeUI::IsEnabled();
|
||||
}
|
||||
|
||||
Compatibility::Compatibility()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
void Compatibility::OnNavigatedTo(const NavigationEventArgs& e)
|
||||
{
|
||||
_ViewModel = e.Parameter().as<Editor::CompatibilityViewModel>();
|
||||
}
|
||||
}
|
||||
46
src/cascadia/TerminalSettingsEditor/Compatibility.h
Normal file
46
src/cascadia/TerminalSettingsEditor/Compatibility.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Compatibility.g.h"
|
||||
#include "CompatibilityViewModel.g.h"
|
||||
#include "ViewModelHelpers.h"
|
||||
#include "Utils.h"
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
struct CompatibilityViewModel : CompatibilityViewModelT<CompatibilityViewModel>, ViewModelHelper<CompatibilityViewModel>
|
||||
{
|
||||
public:
|
||||
CompatibilityViewModel(Model::GlobalAppSettings globalSettings);
|
||||
|
||||
bool DebugFeaturesAvailable() const noexcept;
|
||||
|
||||
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
|
||||
using ViewModelHelper<CompatibilityViewModel>::PropertyChanged;
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AllowHeadless);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DebugFeaturesEnabled);
|
||||
GETSET_BINDABLE_ENUM_SETTING(TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, _GlobalSettings.TextMeasurement);
|
||||
|
||||
private:
|
||||
Model::GlobalAppSettings _GlobalSettings;
|
||||
};
|
||||
|
||||
struct Compatibility : public HasScrollViewer<Compatibility>, CompatibilityT<Compatibility>
|
||||
{
|
||||
Compatibility();
|
||||
|
||||
void OnNavigatedTo(const winrt::Windows::UI::Xaml::Navigation::NavigationEventArgs& e);
|
||||
|
||||
til::property_changed_event PropertyChanged;
|
||||
WINRT_OBSERVABLE_PROPERTY(Editor::CompatibilityViewModel, ViewModel, PropertyChanged.raise, nullptr);
|
||||
};
|
||||
}
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
|
||||
{
|
||||
BASIC_FACTORY(Compatibility);
|
||||
BASIC_FACTORY(CompatibilityViewModel);
|
||||
}
|
||||
28
src/cascadia/TerminalSettingsEditor/Compatibility.idl
Normal file
28
src/cascadia/TerminalSettingsEditor/Compatibility.idl
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
import "EnumEntry.idl";
|
||||
|
||||
#include "ViewModelHelpers.idl.h"
|
||||
|
||||
namespace Microsoft.Terminal.Settings.Editor
|
||||
{
|
||||
runtimeclass CompatibilityViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
|
||||
{
|
||||
CompatibilityViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);
|
||||
|
||||
Boolean DebugFeaturesAvailable { get; };
|
||||
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, AllowHeadless);
|
||||
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, DebugFeaturesEnabled);
|
||||
|
||||
IInspectable CurrentTextMeasurement;
|
||||
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> TextMeasurementList { get; };
|
||||
}
|
||||
|
||||
[default_interface] runtimeclass Compatibility : Windows.UI.Xaml.Controls.Page
|
||||
{
|
||||
Compatibility();
|
||||
CompatibilityViewModel ViewModel { get; };
|
||||
}
|
||||
}
|
||||
50
src/cascadia/TerminalSettingsEditor/Compatibility.xaml
Normal file
50
src/cascadia/TerminalSettingsEditor/Compatibility.xaml
Normal file
@@ -0,0 +1,50 @@
|
||||
<!--
|
||||
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
|
||||
the MIT License. See LICENSE in the project root for license information.
|
||||
-->
|
||||
<Page x:Class="Microsoft.Terminal.Settings.Editor.Compatibility"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="CommonResources.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<DataTemplate x:Key="EnumComboBoxTemplate"
|
||||
x:DataType="local:EnumEntry">
|
||||
<TextBlock Text="{x:Bind EnumName}" />
|
||||
</DataTemplate>
|
||||
</ResourceDictionary>
|
||||
</Page.Resources>
|
||||
|
||||
<StackPanel Style="{StaticResource SettingsStackStyle}">
|
||||
<!-- Allow Headless -->
|
||||
<local:SettingContainer x:Uid="Globals_AllowHeadless">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.AllowHeadless, Mode=TwoWay}"
|
||||
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
|
||||
</local:SettingContainer>
|
||||
|
||||
<!-- Text Measurement -->
|
||||
<local:SettingContainer x:Uid="Globals_TextMeasurement">
|
||||
<ComboBox AutomationProperties.AccessibilityView="Content"
|
||||
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
|
||||
ItemsSource="{x:Bind ViewModel.TextMeasurementList}"
|
||||
SelectedItem="{x:Bind ViewModel.CurrentTextMeasurement, Mode=TwoWay}"
|
||||
Style="{StaticResource ComboBoxSettingStyle}" />
|
||||
</local:SettingContainer>
|
||||
|
||||
<!-- Debug Features -->
|
||||
<local:SettingContainer x:Uid="Globals_DebugFeaturesEnabled"
|
||||
Visibility="{x:Bind ViewModel.DebugFeaturesAvailable}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.DebugFeaturesEnabled, Mode=TwoWay}"
|
||||
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
|
||||
</local:SettingContainer>
|
||||
</StackPanel>
|
||||
</Page>
|
||||
@@ -488,7 +488,7 @@
|
||||
</StackPanel>
|
||||
</Button.Content>
|
||||
<Button.Flyout>
|
||||
<Flyout>
|
||||
<Flyout FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}">
|
||||
<StackPanel>
|
||||
<TextBlock x:Uid="ColorScheme_DeleteConfirmationMessage"
|
||||
Style="{StaticResource CustomFlyoutTextStyle}" />
|
||||
|
||||
@@ -27,20 +27,6 @@
|
||||
</Page.Resources>
|
||||
|
||||
<StackPanel Style="{StaticResource SettingsStackStyle}">
|
||||
<!-- Language -->
|
||||
<local:SettingContainer x:Uid="Globals_Language"
|
||||
Visibility="{x:Bind ViewModel.LanguageSelectorAvailable}">
|
||||
<ComboBox ItemsSource="{x:Bind ViewModel.LanguageList}"
|
||||
SelectedItem="{x:Bind ViewModel.CurrentLanguage, Mode=TwoWay}"
|
||||
Style="{StaticResource ComboBoxSettingStyle}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="x:String">
|
||||
<TextBlock Text="{x:Bind local:GlobalAppearanceViewModel.LanguageDisplayConverter((x:String))}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</local:SettingContainer>
|
||||
|
||||
<!-- Theme -->
|
||||
<local:SettingContainer x:Uid="Globals_Theme">
|
||||
<ComboBox AutomationProperties.AccessibilityView="Content"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "EnumEntry.h"
|
||||
|
||||
#include <LibraryResources.h>
|
||||
#include <WtExeUtils.h>
|
||||
|
||||
using namespace winrt;
|
||||
using namespace winrt::Windows::UI::Xaml;
|
||||
@@ -18,28 +17,6 @@ using namespace winrt::Windows::Foundation::Collections;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
// For ComboBox an empty SelectedItem string denotes no selection.
|
||||
// What we want instead is for "Use system language" to be selected by default.
|
||||
// --> "und" is synonymous for "Use system language".
|
||||
constexpr std::wstring_view systemLanguageTag{ L"und" };
|
||||
|
||||
static constexpr std::array appLanguageTags{
|
||||
L"en-US",
|
||||
L"de-DE",
|
||||
L"es-ES",
|
||||
L"fr-FR",
|
||||
L"it-IT",
|
||||
L"ja",
|
||||
L"ko",
|
||||
L"pt-BR",
|
||||
L"qps-PLOC",
|
||||
L"qps-PLOCA",
|
||||
L"qps-PLOCM",
|
||||
L"ru",
|
||||
L"zh-Hans",
|
||||
L"zh-Hant",
|
||||
};
|
||||
|
||||
constexpr std::wstring_view systemThemeName{ L"system" };
|
||||
constexpr std::wstring_view darkThemeName{ L"dark" };
|
||||
constexpr std::wstring_view lightThemeName{ L"light" };
|
||||
@@ -56,146 +33,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
_UpdateThemeList();
|
||||
}
|
||||
|
||||
winrt::hstring GlobalAppearanceViewModel::LanguageDisplayConverter(const winrt::hstring& tag)
|
||||
{
|
||||
if (tag == systemLanguageTag)
|
||||
{
|
||||
return RS_(L"Globals_LanguageDefault");
|
||||
}
|
||||
|
||||
winrt::Windows::Globalization::Language language{ tag };
|
||||
return language.NativeName();
|
||||
}
|
||||
|
||||
// Returns whether the language selector is available/shown.
|
||||
//
|
||||
// winrt::Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride()
|
||||
// doesn't work for unpackaged applications. The corresponding code in TerminalApp is disabled.
|
||||
// It would be confusing for our users if we presented a dysfunctional language selector.
|
||||
bool GlobalAppearanceViewModel::LanguageSelectorAvailable()
|
||||
{
|
||||
return IsPackaged();
|
||||
}
|
||||
|
||||
// Returns the list of languages the user may override the application language with.
|
||||
// The returned list are BCP 47 language tags like {"und", "en-US", "de-DE", "es-ES", ...}.
|
||||
// "und" is short for "undefined" and is synonymous for "Use system language" in this code.
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> GlobalAppearanceViewModel::LanguageList()
|
||||
{
|
||||
if (_languageList)
|
||||
{
|
||||
return _languageList;
|
||||
}
|
||||
|
||||
if (!LanguageSelectorAvailable())
|
||||
{
|
||||
_languageList = {};
|
||||
return _languageList;
|
||||
}
|
||||
|
||||
// In order to return the language list this code does the following:
|
||||
// [1] Get all possible languages we want to allow the user to choose.
|
||||
// We have to acquire languages from multiple sources, creating duplicates. See below at [1].
|
||||
// [2] Sort languages by their ASCII tags, forcing the UI in a consistent/stable order.
|
||||
// I wanted to sort the localized language names initially, but it turned out to be complex.
|
||||
// [3] Remove potential duplicates in our language list from [1].
|
||||
// We don't want to have en-US twice in the list, do we?
|
||||
// [4] Optionally remove unwanted language tags (like pseudo-localizations).
|
||||
|
||||
std::vector<winrt::hstring> tags;
|
||||
|
||||
// [1]:
|
||||
{
|
||||
// ManifestLanguages contains languages the app ships with.
|
||||
// Unfortunately, we cannot use this source. Our manifest must contain the
|
||||
// ~100 languages that are localized for the shell extension and start menu
|
||||
// presentation so we align with Windows display languages for those surfaces.
|
||||
// However, the actual content of our application is limited to a much smaller
|
||||
// subset of approximately 14 languages. As such, we will code the limited
|
||||
// subset of languages that we support for selection within the Settings
|
||||
// dropdown to steer users towards the ones that we can display in the app.
|
||||
|
||||
// As per the function definition, the first item
|
||||
// is always "Use system language" ("und").
|
||||
tags.emplace_back(systemLanguageTag);
|
||||
|
||||
// Add our hard-coded languages after the system definition.
|
||||
for (const auto& v : appLanguageTags)
|
||||
{
|
||||
tags.push_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: The size of tags is always >0, due to tags[0] being hard-coded to "und".
|
||||
const auto tagsBegin = ++tags.begin();
|
||||
const auto tagsEnd = tags.end();
|
||||
|
||||
// [2]:
|
||||
std::sort(tagsBegin, tagsEnd);
|
||||
|
||||
// I'd love for both, std::unique and std::remove_if, to occur in a single loop,
|
||||
// but the code turned out to be complex and even less maintainable, so I gave up.
|
||||
{
|
||||
// [3] part 1:
|
||||
auto it = std::unique(tagsBegin, tagsEnd);
|
||||
|
||||
// The qps- languages are useful for testing ("pseudo-localization").
|
||||
// --> Leave them in if debug features are enabled.
|
||||
if (!_GlobalSettings.DebugFeaturesEnabled())
|
||||
{
|
||||
// [4] part 1:
|
||||
it = std::remove_if(tagsBegin, it, [](const winrt::hstring& tag) -> bool {
|
||||
return til::starts_with(tag, L"qps-");
|
||||
});
|
||||
}
|
||||
|
||||
// [3], [4] part 2 (completing the so called "erase-remove idiom"):
|
||||
tags.erase(it, tagsEnd);
|
||||
}
|
||||
|
||||
_languageList = winrt::single_threaded_observable_vector(std::move(tags));
|
||||
return _languageList;
|
||||
}
|
||||
|
||||
winrt::Windows::Foundation::IInspectable GlobalAppearanceViewModel::CurrentLanguage()
|
||||
{
|
||||
if (_currentLanguage)
|
||||
{
|
||||
return _currentLanguage;
|
||||
}
|
||||
|
||||
if (!LanguageSelectorAvailable())
|
||||
{
|
||||
_currentLanguage = {};
|
||||
return _currentLanguage;
|
||||
}
|
||||
|
||||
// NOTE: PrimaryLanguageOverride throws if this instance is unpackaged.
|
||||
auto currentLanguage = winrt::Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride();
|
||||
if (currentLanguage.empty())
|
||||
{
|
||||
currentLanguage = systemLanguageTag;
|
||||
}
|
||||
|
||||
_currentLanguage = winrt::box_value(currentLanguage);
|
||||
return _currentLanguage;
|
||||
}
|
||||
|
||||
void GlobalAppearanceViewModel::CurrentLanguage(const winrt::Windows::Foundation::IInspectable& tag)
|
||||
{
|
||||
_currentLanguage = tag;
|
||||
|
||||
const auto currentLanguage = winrt::unbox_value<winrt::hstring>(_currentLanguage);
|
||||
if (currentLanguage == systemLanguageTag)
|
||||
{
|
||||
_GlobalSettings.ClearLanguage();
|
||||
}
|
||||
else
|
||||
{
|
||||
_GlobalSettings.Language(currentLanguage);
|
||||
}
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Updates the list of all themes available to choose from.
|
||||
void GlobalAppearanceViewModel::_UpdateThemeList()
|
||||
|
||||
@@ -22,16 +22,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
GETSET_BINDABLE_ENUM_SETTING(TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, _GlobalSettings.TabWidthMode);
|
||||
|
||||
public:
|
||||
// LanguageDisplayConverter maps the given BCP 47 tag to a localized string.
|
||||
// For instance "en-US" produces "English (United States)", while "de-DE" produces
|
||||
// "Deutsch (Deutschland)". This works independently of the user's locale.
|
||||
static winrt::hstring LanguageDisplayConverter(const winrt::hstring& tag);
|
||||
|
||||
bool LanguageSelectorAvailable();
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> LanguageList();
|
||||
winrt::Windows::Foundation::IInspectable CurrentLanguage();
|
||||
void CurrentLanguage(const winrt::Windows::Foundation::IInspectable& tag);
|
||||
|
||||
winrt::Windows::Foundation::IInspectable CurrentTheme();
|
||||
void CurrentTheme(const winrt::Windows::Foundation::IInspectable& tag);
|
||||
static winrt::hstring ThemeNameConverter(const Model::Theme& theme);
|
||||
@@ -52,8 +42,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
private:
|
||||
Model::GlobalAppSettings _GlobalSettings;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> _languageList;
|
||||
winrt::Windows::Foundation::IInspectable _currentLanguage;
|
||||
winrt::Windows::Foundation::IInspectable _currentTheme;
|
||||
|
||||
void _UpdateThemeList();
|
||||
|
||||
@@ -11,11 +11,6 @@ namespace Microsoft.Terminal.Settings.Editor
|
||||
{
|
||||
GlobalAppearanceViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);
|
||||
|
||||
static String LanguageDisplayConverter(String tag);
|
||||
Boolean LanguageSelectorAvailable { get; };
|
||||
Windows.Foundation.Collections.IObservableVector<String> LanguageList { get; };
|
||||
IInspectable CurrentLanguage;
|
||||
|
||||
IInspectable CurrentTheme;
|
||||
static String ThemeNameConverter(Microsoft.Terminal.Settings.Model.Theme theme);
|
||||
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Model.Theme> ThemeList { get; };
|
||||
|
||||
@@ -139,6 +139,29 @@
|
||||
</ComboBox>
|
||||
</local:SettingContainer>
|
||||
|
||||
<!-- Language -->
|
||||
<local:SettingContainer x:Uid="Globals_Language"
|
||||
Visibility="{x:Bind ViewModel.LanguageSelectorAvailable}">
|
||||
<ComboBox ItemsSource="{x:Bind ViewModel.LanguageList}"
|
||||
SelectedItem="{x:Bind ViewModel.CurrentLanguage, Mode=TwoWay}"
|
||||
Style="{StaticResource ComboBoxSettingStyle}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="x:String">
|
||||
<TextBlock Text="{x:Bind local:LaunchViewModel.LanguageDisplayConverter((x:String))}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</local:SettingContainer>
|
||||
|
||||
<!-- Language -->
|
||||
<local:SettingContainer x:Uid="Globals_DefaultInputScope">
|
||||
<ComboBox AutomationProperties.AccessibilityView="Content"
|
||||
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
|
||||
ItemsSource="{x:Bind ViewModel.DefaultInputScopeList}"
|
||||
SelectedItem="{x:Bind ViewModel.CurrentDefaultInputScope, Mode=TwoWay}"
|
||||
Style="{StaticResource ComboBoxSettingStyle}" />
|
||||
</local:SettingContainer>
|
||||
|
||||
<!-- Start on User Login -->
|
||||
<local:SettingContainer x:Uid="Globals_StartOnUserLogin">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.StartOnUserLogin, Mode=TwoWay}"
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
#include "LaunchViewModel.h"
|
||||
#include "LaunchViewModel.g.cpp"
|
||||
#include "EnumEntry.h"
|
||||
|
||||
#include <LibraryResources.h>
|
||||
#include <WtExeUtils.h>
|
||||
|
||||
using namespace winrt::Windows::UI::Xaml::Navigation;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
@@ -14,11 +16,34 @@ using namespace winrt::Windows::UI::Xaml::Data;
|
||||
|
||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
// For ComboBox an empty SelectedItem string denotes no selection.
|
||||
// What we want instead is for "Use system language" to be selected by default.
|
||||
// --> "und" is synonymous for "Use system language".
|
||||
constexpr std::wstring_view systemLanguageTag{ L"und" };
|
||||
|
||||
static constexpr std::array appLanguageTags{
|
||||
L"en-US",
|
||||
L"de-DE",
|
||||
L"es-ES",
|
||||
L"fr-FR",
|
||||
L"it-IT",
|
||||
L"ja",
|
||||
L"ko",
|
||||
L"pt-BR",
|
||||
L"qps-PLOC",
|
||||
L"qps-PLOCA",
|
||||
L"qps-PLOCM",
|
||||
L"ru",
|
||||
L"zh-Hans",
|
||||
L"zh-Hant",
|
||||
};
|
||||
|
||||
LaunchViewModel::LaunchViewModel(Model::CascadiaSettings settings) :
|
||||
_Settings{ settings }
|
||||
{
|
||||
_useDefaultLaunchPosition = isnan(InitialPosX()) && isnan(InitialPosY());
|
||||
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(DefaultInputScope, DefaultInputScope, winrt::Microsoft::Terminal::Control::DefaultInputScope, L"Globals_DefaultInputScope", L"Content");
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(FirstWindowPreference, FirstWindowPreference, FirstWindowPreference, L"Globals_FirstWindowPreference", L"Content");
|
||||
INITIALIZE_BINDABLE_ENUM_SETTING(LaunchMode, LaunchMode, LaunchMode, L"Globals_LaunchMode", L"Content");
|
||||
// More options were added to the JSON mapper when the enum was made into [Flags]
|
||||
@@ -40,6 +65,146 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
});
|
||||
}
|
||||
|
||||
winrt::hstring LaunchViewModel::LanguageDisplayConverter(const winrt::hstring& tag)
|
||||
{
|
||||
if (tag == systemLanguageTag)
|
||||
{
|
||||
return RS_(L"Globals_LanguageDefault");
|
||||
}
|
||||
|
||||
winrt::Windows::Globalization::Language language{ tag };
|
||||
return language.NativeName();
|
||||
}
|
||||
|
||||
// Returns whether the language selector is available/shown.
|
||||
//
|
||||
// winrt::Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride()
|
||||
// doesn't work for unpackaged applications. The corresponding code in TerminalApp is disabled.
|
||||
// It would be confusing for our users if we presented a dysfunctional language selector.
|
||||
bool LaunchViewModel::LanguageSelectorAvailable()
|
||||
{
|
||||
return IsPackaged();
|
||||
}
|
||||
|
||||
// Returns the list of languages the user may override the application language with.
|
||||
// The returned list are BCP 47 language tags like {"und", "en-US", "de-DE", "es-ES", ...}.
|
||||
// "und" is short for "undefined" and is synonymous for "Use system language" in this code.
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> LaunchViewModel::LanguageList()
|
||||
{
|
||||
if (_languageList)
|
||||
{
|
||||
return _languageList;
|
||||
}
|
||||
|
||||
if (!LanguageSelectorAvailable())
|
||||
{
|
||||
_languageList = {};
|
||||
return _languageList;
|
||||
}
|
||||
|
||||
// In order to return the language list this code does the following:
|
||||
// [1] Get all possible languages we want to allow the user to choose.
|
||||
// We have to acquire languages from multiple sources, creating duplicates. See below at [1].
|
||||
// [2] Sort languages by their ASCII tags, forcing the UI in a consistent/stable order.
|
||||
// I wanted to sort the localized language names initially, but it turned out to be complex.
|
||||
// [3] Remove potential duplicates in our language list from [1].
|
||||
// We don't want to have en-US twice in the list, do we?
|
||||
// [4] Optionally remove unwanted language tags (like pseudo-localizations).
|
||||
|
||||
std::vector<winrt::hstring> tags;
|
||||
|
||||
// [1]:
|
||||
{
|
||||
// ManifestLanguages contains languages the app ships with.
|
||||
// Unfortunately, we cannot use this source. Our manifest must contain the
|
||||
// ~100 languages that are localized for the shell extension and start menu
|
||||
// presentation so we align with Windows display languages for those surfaces.
|
||||
// However, the actual content of our application is limited to a much smaller
|
||||
// subset of approximately 14 languages. As such, we will code the limited
|
||||
// subset of languages that we support for selection within the Settings
|
||||
// dropdown to steer users towards the ones that we can display in the app.
|
||||
|
||||
// As per the function definition, the first item
|
||||
// is always "Use system language" ("und").
|
||||
tags.emplace_back(systemLanguageTag);
|
||||
|
||||
// Add our hard-coded languages after the system definition.
|
||||
for (const auto& v : appLanguageTags)
|
||||
{
|
||||
tags.push_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: The size of tags is always >0, due to tags[0] being hard-coded to "und".
|
||||
const auto tagsBegin = ++tags.begin();
|
||||
const auto tagsEnd = tags.end();
|
||||
|
||||
// [2]:
|
||||
std::sort(tagsBegin, tagsEnd);
|
||||
|
||||
// I'd love for both, std::unique and std::remove_if, to occur in a single loop,
|
||||
// but the code turned out to be complex and even less maintainable, so I gave up.
|
||||
{
|
||||
// [3] part 1:
|
||||
auto it = std::unique(tagsBegin, tagsEnd);
|
||||
|
||||
// The qps- languages are useful for testing ("pseudo-localization").
|
||||
// --> Leave them in if debug features are enabled.
|
||||
if (!_Settings.GlobalSettings().DebugFeaturesEnabled())
|
||||
{
|
||||
// [4] part 1:
|
||||
it = std::remove_if(tagsBegin, it, [](const winrt::hstring& tag) -> bool {
|
||||
return til::starts_with(tag, L"qps-");
|
||||
});
|
||||
}
|
||||
|
||||
// [3], [4] part 2 (completing the so called "erase-remove idiom"):
|
||||
tags.erase(it, tagsEnd);
|
||||
}
|
||||
|
||||
_languageList = winrt::single_threaded_observable_vector(std::move(tags));
|
||||
return _languageList;
|
||||
}
|
||||
|
||||
winrt::Windows::Foundation::IInspectable LaunchViewModel::CurrentLanguage()
|
||||
{
|
||||
if (_currentLanguage)
|
||||
{
|
||||
return _currentLanguage;
|
||||
}
|
||||
|
||||
if (!LanguageSelectorAvailable())
|
||||
{
|
||||
_currentLanguage = {};
|
||||
return _currentLanguage;
|
||||
}
|
||||
|
||||
// NOTE: PrimaryLanguageOverride throws if this instance is unpackaged.
|
||||
auto currentLanguage = winrt::Windows::Globalization::ApplicationLanguages::PrimaryLanguageOverride();
|
||||
if (currentLanguage.empty())
|
||||
{
|
||||
currentLanguage = systemLanguageTag;
|
||||
}
|
||||
|
||||
_currentLanguage = winrt::box_value(currentLanguage);
|
||||
return _currentLanguage;
|
||||
}
|
||||
|
||||
void LaunchViewModel::CurrentLanguage(const winrt::Windows::Foundation::IInspectable& tag)
|
||||
{
|
||||
_currentLanguage = tag;
|
||||
|
||||
const auto currentLanguage = winrt::unbox_value<winrt::hstring>(_currentLanguage);
|
||||
if (currentLanguage == systemLanguageTag)
|
||||
{
|
||||
_Settings.GlobalSettings().ClearLanguage();
|
||||
}
|
||||
else
|
||||
{
|
||||
_Settings.GlobalSettings().Language(currentLanguage);
|
||||
}
|
||||
}
|
||||
|
||||
winrt::hstring LaunchViewModel::LaunchParametersCurrentValue()
|
||||
{
|
||||
const auto launchModeString = CurrentLaunchMode().as<EnumEntry>()->EnumName();
|
||||
@@ -167,7 +332,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
// from menus, but still work as the startup profile for instance.
|
||||
for (const auto& profile : allProfiles)
|
||||
{
|
||||
if (!profile.Deleted())
|
||||
if (!profile.Deleted() && !profile.Orphaned() /* BACKPORT GH#18188 - DO NOT DISPLAY ORPHANED PROFILES */)
|
||||
{
|
||||
profiles.emplace_back(profile);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,16 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
public:
|
||||
LaunchViewModel(Model::CascadiaSettings settings);
|
||||
|
||||
// LanguageDisplayConverter maps the given BCP 47 tag to a localized string.
|
||||
// For instance "en-US" produces "English (United States)", while "de-DE" produces
|
||||
// "Deutsch (Deutschland)". This works independently of the user's locale.
|
||||
static winrt::hstring LanguageDisplayConverter(const winrt::hstring& tag);
|
||||
|
||||
bool LanguageSelectorAvailable();
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> LanguageList();
|
||||
winrt::Windows::Foundation::IInspectable CurrentLanguage();
|
||||
void CurrentLanguage(const winrt::Windows::Foundation::IInspectable& tag);
|
||||
|
||||
winrt::hstring LaunchParametersCurrentValue();
|
||||
double InitialPosX();
|
||||
double InitialPosY();
|
||||
@@ -35,6 +45,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
void CurrentLaunchMode(const winrt::Windows::Foundation::IInspectable& enumEntry);
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> LaunchModeList();
|
||||
|
||||
GETSET_BINDABLE_ENUM_SETTING(DefaultInputScope, winrt::Microsoft::Terminal::Control::DefaultInputScope, _Settings.GlobalSettings().DefaultInputScope);
|
||||
GETSET_BINDABLE_ENUM_SETTING(FirstWindowPreference, Model::FirstWindowPreference, _Settings.GlobalSettings().FirstWindowPreference);
|
||||
GETSET_BINDABLE_ENUM_SETTING(WindowingBehavior, Model::WindowingMode, _Settings.GlobalSettings().WindowingBehavior);
|
||||
|
||||
@@ -45,6 +56,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
private:
|
||||
Model::CascadiaSettings _Settings;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> _languageList;
|
||||
winrt::Windows::Foundation::IInspectable _currentLanguage;
|
||||
bool _useDefaultLaunchPosition;
|
||||
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> _LaunchModeList;
|
||||
|
||||
@@ -11,6 +11,14 @@ namespace Microsoft.Terminal.Settings.Editor
|
||||
{
|
||||
LaunchViewModel(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
|
||||
|
||||
static String LanguageDisplayConverter(String tag);
|
||||
Boolean LanguageSelectorAvailable { get; };
|
||||
Windows.Foundation.Collections.IObservableVector<String> LanguageList { get; };
|
||||
IInspectable CurrentLanguage;
|
||||
|
||||
IInspectable CurrentDefaultInputScope;
|
||||
IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> DefaultInputScopeList { get; };
|
||||
|
||||
String LaunchParametersCurrentValue { get; };
|
||||
Double InitialPosX;
|
||||
Double InitialPosY;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "MainPage.g.cpp"
|
||||
#include "Launch.h"
|
||||
#include "Interaction.h"
|
||||
#include "Compatibility.h"
|
||||
#include "Rendering.h"
|
||||
#include "RenderingViewModel.h"
|
||||
#include "Actions.h"
|
||||
@@ -39,6 +40,7 @@ using namespace winrt::Windows::Foundation::Collections;
|
||||
static const std::wstring_view launchTag{ L"Launch_Nav" };
|
||||
static const std::wstring_view interactionTag{ L"Interaction_Nav" };
|
||||
static const std::wstring_view renderingTag{ L"Rendering_Nav" };
|
||||
static const std::wstring_view compatibilityTag{ L"Compatibility_Nav" };
|
||||
static const std::wstring_view actionsTag{ L"Actions_Nav" };
|
||||
static const std::wstring_view globalProfileTag{ L"GlobalProfile_Nav" };
|
||||
static const std::wstring_view addProfileTag{ L"AddProfile" };
|
||||
@@ -339,6 +341,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
_breadcrumbs.Append(crumb);
|
||||
SettingsMainPage_ScrollViewer().ScrollToVerticalOffset(0);
|
||||
}
|
||||
else if (currentPage == ProfileSubPage::Terminal)
|
||||
{
|
||||
contentFrame().Navigate(xaml_typename<Editor::Profiles_Terminal>(), profile);
|
||||
const auto crumb = winrt::make<Breadcrumb>(breadcrumbTag, RS_(L"Profile_Terminal/Header"), BreadcrumbSubPage::Profile_Terminal);
|
||||
_breadcrumbs.Append(crumb);
|
||||
SettingsMainPage_ScrollViewer().ScrollToVerticalOffset(0);
|
||||
}
|
||||
else if (currentPage == ProfileSubPage::Advanced)
|
||||
{
|
||||
contentFrame().Navigate(xaml_typename<Editor::Profiles_Advanced>(), profile);
|
||||
@@ -372,6 +381,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
const auto crumb = winrt::make<Breadcrumb>(box_value(clickedItemTag), RS_(L"Nav_Rendering/Content"), BreadcrumbSubPage::None);
|
||||
_breadcrumbs.Append(crumb);
|
||||
}
|
||||
else if (clickedItemTag == compatibilityTag)
|
||||
{
|
||||
contentFrame().Navigate(xaml_typename<Editor::Compatibility>(), winrt::make<CompatibilityViewModel>(_settingsClone.GlobalSettings()));
|
||||
const auto crumb = winrt::make<Breadcrumb>(box_value(clickedItemTag), RS_(L"Nav_Compatibility/Content"), BreadcrumbSubPage::None);
|
||||
_breadcrumbs.Append(crumb);
|
||||
}
|
||||
else if (clickedItemTag == actionsTag)
|
||||
{
|
||||
contentFrame().Navigate(xaml_typename<Editor::Actions>(), winrt::make<ActionsViewModel>(_settingsClone));
|
||||
@@ -395,6 +410,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
profileVM.CurrentPage(ProfileSubPage::Appearance);
|
||||
}
|
||||
else if (subPage == BreadcrumbSubPage::Profile_Terminal)
|
||||
{
|
||||
profileVM.CurrentPage(ProfileSubPage::Terminal);
|
||||
}
|
||||
else if (subPage == BreadcrumbSubPage::Profile_Advanced)
|
||||
{
|
||||
profileVM.CurrentPage(ProfileSubPage::Advanced);
|
||||
@@ -452,6 +471,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
{
|
||||
profile.CurrentPage(ProfileSubPage::Appearance);
|
||||
}
|
||||
else if (subPage == BreadcrumbSubPage::Profile_Terminal)
|
||||
{
|
||||
profile.CurrentPage(ProfileSubPage::Terminal);
|
||||
}
|
||||
else if (subPage == BreadcrumbSubPage::Profile_Advanced)
|
||||
{
|
||||
profile.CurrentPage(ProfileSubPage::Advanced);
|
||||
@@ -526,7 +549,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
// profile changes.
|
||||
for (const auto& profile : _settingsClone.AllProfiles())
|
||||
{
|
||||
if (!profile.Deleted())
|
||||
if (!profile.Deleted() && !profile.Orphaned() /* BACKPORT GH#18188 - DO NOT DISPLAY ORPHANED PROFILES */)
|
||||
{
|
||||
auto profileVM = _viewModelForProfile(profile, _settingsClone);
|
||||
profileVM.SetupAppearances(_colorSchemesPageVM.AllColorSchemes());
|
||||
@@ -682,6 +705,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
// can have mica too.
|
||||
void MainPage::_UpdateBackgroundForMica()
|
||||
{
|
||||
// If we're in high contrast mode, don't override the theme.
|
||||
if (Windows::UI::ViewManagement::AccessibilitySettings accessibilitySettings; accessibilitySettings.HighContrast())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool isMicaAvailable = false;
|
||||
|
||||
// Check to see if our hosting window supports Mica at all. We'll check
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Microsoft.Terminal.Settings.Editor
|
||||
{
|
||||
None = 0,
|
||||
Profile_Appearance,
|
||||
Profile_Terminal,
|
||||
Profile_Advanced,
|
||||
ColorSchemes_Edit
|
||||
};
|
||||
|
||||
@@ -44,11 +44,10 @@
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<!-- Define resources for HighContrast mode here -->
|
||||
<StaticResource x:Key="SettingsPageBackground"
|
||||
ResourceKey="SystemColorWindowColorBrush" />
|
||||
ResourceKey="SystemColorWindowBrush" />
|
||||
<StaticResource x:Key="SettingsPageMicaBackground"
|
||||
ResourceKey="SystemColorWindowColorBrush" />
|
||||
ResourceKey="SystemColorWindowBrush" />
|
||||
</ResourceDictionary>
|
||||
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -135,6 +134,13 @@
|
||||
</muxc:NavigationViewItem.Icon>
|
||||
</muxc:NavigationViewItem>
|
||||
|
||||
<muxc:NavigationViewItem x:Uid="Nav_Compatibility"
|
||||
Tag="Compatibility_Nav">
|
||||
<muxc:NavigationViewItem.Icon>
|
||||
<FontIcon Glyph="" />
|
||||
</muxc:NavigationViewItem.Icon>
|
||||
</muxc:NavigationViewItem>
|
||||
|
||||
<muxc:NavigationViewItem x:Uid="Nav_Actions"
|
||||
Tag="Actions_Nav">
|
||||
<muxc:NavigationViewItem.Icon>
|
||||
|
||||
@@ -64,6 +64,9 @@
|
||||
<ClInclude Include="Interaction.h">
|
||||
<DependentUpon>Interaction.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Compatibility.h">
|
||||
<DependentUpon>Compatibility.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
<ClInclude Include="KeyChordListener.h">
|
||||
<DependentUpon>KeyChordListener.xaml</DependentUpon>
|
||||
</ClInclude>
|
||||
@@ -118,6 +121,10 @@
|
||||
<DependentUpon>Profiles_Appearance.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Profiles_Terminal.h">
|
||||
<DependentUpon>Profiles_Terminal.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Appearances.h">
|
||||
<DependentUpon>Appearances.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
@@ -154,6 +161,9 @@
|
||||
<Page Include="Interaction.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Compatibility.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="KeyChordListener.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -172,6 +182,9 @@
|
||||
<Page Include="Profiles_Appearance.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Profiles_Terminal.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Appearances.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -204,6 +217,9 @@
|
||||
<ClCompile Include="Interaction.cpp">
|
||||
<DependentUpon>Interaction.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Compatibility.cpp">
|
||||
<DependentUpon>Compatibility.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KeyChordListener.cpp">
|
||||
<DependentUpon>KeyChordListener.xaml</DependentUpon>
|
||||
</ClCompile>
|
||||
@@ -261,6 +277,10 @@
|
||||
<DependentUpon>Profiles_Appearance.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Profiles_Terminal.cpp">
|
||||
<DependentUpon>Profiles_Terminal.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Appearances.cpp">
|
||||
<DependentUpon>Appearances.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
@@ -311,6 +331,10 @@
|
||||
<DependentUpon>Interaction.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Midl>
|
||||
<Midl Include="Compatibility.idl">
|
||||
<DependentUpon>Compatibility.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Midl>
|
||||
<Midl Include="Rendering.idl">
|
||||
<DependentUpon>Rendering.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
@@ -338,6 +362,10 @@
|
||||
<DependentUpon>Profiles_Appearance.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Midl>
|
||||
<Midl Include="Profiles_Terminal.idl">
|
||||
<DependentUpon>Profiles_Terminal.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Midl>
|
||||
<Midl Include="Appearances.idl">
|
||||
<DependentUpon>Appearances.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user