mirror of
https://github.com/microsoft/terminal.git
synced 2026-04-10 08:11:06 +00:00
Compare commits
38 Commits
dev/lhecke
...
v1.5.10411
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fdd1560fd | ||
|
|
3b876cc0b5 | ||
|
|
970d441a52 | ||
|
|
d86f5c1f74 | ||
|
|
84a5b668c1 | ||
|
|
ee83677122 | ||
|
|
2594edcec0 | ||
|
|
b092bdd42c | ||
|
|
2568a7cef2 | ||
|
|
bda1494394 | ||
|
|
118195a970 | ||
|
|
fd2b3f7632 | ||
|
|
2692874c71 | ||
|
|
a205f4547d | ||
|
|
944fddbbe9 | ||
|
|
677ab36a8a | ||
|
|
334e518773 | ||
|
|
9e9c0bea83 | ||
|
|
5f29f7603d | ||
|
|
ceb0551066 | ||
|
|
c17fdf07ee | ||
|
|
a315fd5f62 | ||
|
|
305946caa0 | ||
|
|
cadca1e839 | ||
|
|
c5e1bbdd25 | ||
|
|
817df81f48 | ||
|
|
a388adf50a | ||
|
|
5fb99657ea | ||
|
|
12c100cdb0 | ||
|
|
431559fd83 | ||
|
|
109f9c451f | ||
|
|
95b9b7c852 | ||
|
|
f3cdf6841f | ||
|
|
1228897071 | ||
|
|
0300b31117 | ||
|
|
368fa17c2d | ||
|
|
c7607417d3 | ||
|
|
204c9d2cf4 |
14
.github/actions/spell-check/expect/a129ff14ec985d6b7bf09e296a831c955d41040b.txt
vendored
Normal file
14
.github/actions/spell-check/expect/a129ff14ec985d6b7bf09e296a831c955d41040b.txt
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
checkboxes
|
||||
CSIDL
|
||||
csv
|
||||
horiz
|
||||
IDispatch
|
||||
inlines
|
||||
IWeb
|
||||
Progman
|
||||
reserialize
|
||||
SHANDLE
|
||||
SHGFP
|
||||
udk
|
||||
unfocus
|
||||
WClass
|
||||
26
.github/actions/spell-check/expect/expect.txt
vendored
26
.github/actions/spell-check/expect/expect.txt
vendored
@@ -168,6 +168,7 @@ BOLDFONT
|
||||
BOOLIFY
|
||||
bools
|
||||
Bopomofo
|
||||
boostorg
|
||||
Borland
|
||||
BOTTOMLEFT
|
||||
BOTTOMRIGHT
|
||||
@@ -247,7 +248,6 @@ charset
|
||||
CHARSETINFO
|
||||
chcp
|
||||
checkbox
|
||||
Checkboxes
|
||||
chh
|
||||
Childitem
|
||||
chk
|
||||
@@ -382,7 +382,6 @@ CORESYSTEM
|
||||
cotaskmem
|
||||
countof
|
||||
cout
|
||||
CParams
|
||||
CPG
|
||||
cpinfo
|
||||
CPINFOEX
|
||||
@@ -411,7 +410,6 @@ csbi
|
||||
csbiex
|
||||
csharp
|
||||
CSHORT
|
||||
cso
|
||||
csproj
|
||||
Csr
|
||||
csrmsg
|
||||
@@ -424,7 +422,6 @@ cstdlib
|
||||
cstr
|
||||
cstring
|
||||
cstyle
|
||||
CSV
|
||||
CSwitch
|
||||
CText
|
||||
ctime
|
||||
@@ -836,7 +833,6 @@ gcy
|
||||
gdi
|
||||
gdip
|
||||
gdirenderer
|
||||
GENERATEPROJECTPRIFILE
|
||||
geopol
|
||||
GETALIAS
|
||||
GETALIASES
|
||||
@@ -951,7 +947,6 @@ hfont
|
||||
hglobal
|
||||
hh
|
||||
hhh
|
||||
hhhh
|
||||
hhook
|
||||
hhx
|
||||
HIBYTE
|
||||
@@ -978,7 +973,6 @@ hmod
|
||||
hmodule
|
||||
hmon
|
||||
HMONITOR
|
||||
Horiz
|
||||
HORZ
|
||||
hostable
|
||||
hostlib
|
||||
@@ -1088,10 +1082,8 @@ INITMENU
|
||||
inkscape
|
||||
inl
|
||||
INLINEPREFIX
|
||||
Inlines
|
||||
INotify
|
||||
inout
|
||||
INPATHROOT
|
||||
inproc
|
||||
Inputkeyinfo
|
||||
INPUTPROCESSORPROFILE
|
||||
@@ -1333,7 +1325,6 @@ mailto
|
||||
majorly
|
||||
makeappx
|
||||
MAKEINTRESOURCE
|
||||
MAKEINTRESOURCEA
|
||||
MAKEINTRESOURCEW
|
||||
MAKELANGID
|
||||
MAKELONG
|
||||
@@ -1406,7 +1397,6 @@ monostate
|
||||
MOUSEACTIVATE
|
||||
MOUSEFIRST
|
||||
MOUSEHWHEEL
|
||||
mousemode
|
||||
MOUSEMOVE
|
||||
mousewheel
|
||||
MOVESTART
|
||||
@@ -1428,7 +1418,6 @@ MSGSELECTMODE
|
||||
msiexec
|
||||
MSIL
|
||||
msix
|
||||
msixbundle
|
||||
msrc
|
||||
msvcrt
|
||||
MSVS
|
||||
@@ -1943,7 +1932,6 @@ Replymessage
|
||||
repositorypath
|
||||
rescap
|
||||
Resequence
|
||||
Reserialize
|
||||
RESETCONTENT
|
||||
resheader
|
||||
resizable
|
||||
@@ -1970,7 +1958,6 @@ rgpwsz
|
||||
rgrc
|
||||
rgs
|
||||
rgui
|
||||
rgus
|
||||
rgw
|
||||
rgwch
|
||||
rhs
|
||||
@@ -2104,7 +2091,6 @@ sfi
|
||||
SFINAE
|
||||
SFUI
|
||||
sgr
|
||||
SGRXY
|
||||
SHCo
|
||||
shcore
|
||||
shellapi
|
||||
@@ -2277,6 +2263,7 @@ tcome
|
||||
tcommandline
|
||||
tcommands
|
||||
tcon
|
||||
TDelegated
|
||||
TDP
|
||||
TEAMPROJECT
|
||||
tearoff
|
||||
@@ -2443,7 +2430,6 @@ UNCPRIORITY
|
||||
undef
|
||||
Unescape
|
||||
unexpand
|
||||
Unfocus
|
||||
unhighlighting
|
||||
unhosted
|
||||
unicode
|
||||
@@ -2768,14 +2754,12 @@ XColors
|
||||
xcopy
|
||||
XCount
|
||||
xdy
|
||||
xe
|
||||
XEncoding
|
||||
xes
|
||||
Xes
|
||||
XES
|
||||
xff
|
||||
XFile
|
||||
xlang
|
||||
XManifest
|
||||
XMath
|
||||
XMFLOAT
|
||||
@@ -2800,6 +2784,7 @@ xvalue
|
||||
XVIRTUALSCREEN
|
||||
XWalk
|
||||
xy
|
||||
Xzn
|
||||
yact
|
||||
YAML
|
||||
YCast
|
||||
@@ -2826,6 +2811,7 @@ zu
|
||||
zxcvbnm
|
||||
zy
|
||||
AAAAABBBBBBCCC
|
||||
AAAAA
|
||||
BBBBBCCC
|
||||
abcd
|
||||
abcd
|
||||
LPMINMAXINFO
|
||||
MINMAXINFO
|
||||
|
||||
20
NuGet.Config
20
NuGet.Config
@@ -1,24 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<!-- Add repositories here to the list of available repositories -->
|
||||
|
||||
<!-- Dependencies that we must carry because they're not on public nuget feeds right now. -->
|
||||
<clear />
|
||||
<!-- Dependencies that we can turn on to force override for testing purposes before uploading. -->
|
||||
<!--<add key="Static Package Dependencies" value="dep\packages" />-->
|
||||
|
||||
<!-- Use our own NuGet Feed -->
|
||||
<add key="TerminalDependencies" value="https://pkgs.dev.azure.com/ms/terminal/_packaging/TerminalDependencies/nuget/v3/index.json" />
|
||||
|
||||
<!-- Temporarily? use the feeds from our friends in MUX for Helix test stuff -->
|
||||
<add key="dotnetfeed" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
|
||||
<add key="dnceng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
|
||||
<add key="MUX-Dependencies" value="https://pkgs.dev.azure.com/ms/microsoft-ui-xaml/_packaging/MUX-Dependencies/nuget/v3/index.json" />
|
||||
|
||||
<!-- Internal NuGet feeds that may not be accessible outside Microsoft corporate network -->
|
||||
<!--<add key="TAEF - internal" value="https://microsoft.pkgs.visualstudio.com/DefaultCollection/_packaging/Taef/nuget/v3/index.json" />
|
||||
<add key="OpenConsole - Internal" value="https://microsoft.pkgs.visualstudio.com/_packaging/OpenConsole/nuget/v3/index.json" />-->
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
</disabledPackageSources>
|
||||
<config>
|
||||
<add key="repositorypath" value=".\packages" />
|
||||
</config>
|
||||
|
||||
@@ -694,7 +694,7 @@
|
||||
"enum": [
|
||||
"mru",
|
||||
"inOrder",
|
||||
"disabled",
|
||||
"disabled"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
@@ -702,7 +702,7 @@
|
||||
"deprecated": true
|
||||
},
|
||||
"tabSwitcherMode": {
|
||||
"default": true,
|
||||
"default": "inOrder",
|
||||
"description": "When set to \"true\" or \"mru\", the \"nextTab\" and \"prevTab\" commands will use the tab switcher UI, with most-recently-used ordering. When set to \"inOrder\", these actions will switch tabs in their current ordering. Set to \"false\" to disable the tab switcher.",
|
||||
"oneOf": [
|
||||
{
|
||||
@@ -712,7 +712,7 @@
|
||||
"enum": [
|
||||
"mru",
|
||||
"inOrder",
|
||||
"disabled",
|
||||
"disabled"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
BIN
res/Cascadia.ttf
BIN
res/Cascadia.ttf
Binary file not shown.
Binary file not shown.
@@ -17,5 +17,5 @@ Please consult the [license](https://raw.githubusercontent.com/microsoft/cascadi
|
||||
|
||||
### Fonts Included
|
||||
|
||||
* Cascadia Code, Cascadia Mono (2009.21)
|
||||
* from microsoft/cascadia-code@32f84124db1970fa5d032f0fe9019e6922961beb
|
||||
* Cascadia Code, Cascadia Mono (2102.03)
|
||||
* from microsoft/cascadia-code@b358d1ba3d1629c113671312b18eab52797cc055
|
||||
|
||||
@@ -149,12 +149,12 @@
|
||||
<!-- **END VC LIBS HACK** -->
|
||||
|
||||
<!-- This is required to get the package dependency in the AppXManifest. -->
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
</Target>
|
||||
|
||||
<Import Project="$(SolutionDir)build\rules\CollectWildcardResources.targets" />
|
||||
|
||||
@@ -82,14 +82,9 @@
|
||||
<desktop5:ItemType Type="Directory">
|
||||
<desktop5:Verb Id="Command1" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
<!-- Due to a bug in the OS, this doesn't actually work right -
|
||||
we'll get a nullptr in our implementation. So this is disabled
|
||||
temporarily. See MSFT:24623699 for more details.
|
||||
|
||||
<desktop5:ItemType Type="Directory\Background">
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
-->
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
</desktop4:FileExplorerContextMenus>
|
||||
</desktop4:Extension>
|
||||
|
||||
|
||||
@@ -82,15 +82,9 @@
|
||||
<desktop5:ItemType Type="Directory">
|
||||
<desktop5:Verb Id="Command1" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
<!-- Due to a bug in the OS, this doesn't actually work right -
|
||||
we'll get a nullptr in our implementation. So this is disabled
|
||||
temporarily. See MSFT:24623699 for more details.
|
||||
|
||||
<desktop5:ItemType Type="Directory\Background">
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
-->
|
||||
|
||||
</desktop4:FileExplorerContextMenus>
|
||||
</desktop4:Extension>
|
||||
|
||||
|
||||
@@ -83,14 +83,9 @@
|
||||
<desktop5:ItemType Type="Directory">
|
||||
<desktop5:Verb Id="Command1" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
<!-- Due to a bug in the OS, this doesn't actually work right -
|
||||
we'll get a nullptr in our implementation. So this is disabled
|
||||
temporarily. See MSFT:24623699 for more details.
|
||||
|
||||
<desktop5:ItemType Type="Directory\Background">
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
<desktop5:Verb Id="Command2" Clsid="9f156763-7844-4dc4-b2b1-901f640f5155" />
|
||||
</desktop5:ItemType>
|
||||
-->
|
||||
</desktop4:FileExplorerContextMenus>
|
||||
</desktop4:Extension>
|
||||
|
||||
|
||||
@@ -90,10 +90,10 @@
|
||||
<!-- From Microsoft.UI.Xaml.targets -->
|
||||
<Native-Platform Condition="'$(Platform)' == 'Win32'">x86</Native-Platform>
|
||||
<Native-Platform Condition="'$(Platform)' != 'Win32'">$(Platform)</Native-Platform>
|
||||
<_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\runtimes\win10-$(Native-Platform)\native\"</_MUXBinRoot>
|
||||
<_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\runtimes\win10-$(Native-Platform)\native\"</_MUXBinRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- We actually can just straight up reference MUX here, it's fine -->
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace TerminalAppLocalTests
|
||||
TEST_METHOD(TestMultipleCommandExecuteCommandlineAction);
|
||||
TEST_METHOD(TestInvalidExecuteCommandlineAction);
|
||||
TEST_METHOD(TestLaunchMode);
|
||||
TEST_METHOD(TestLaunchModeWithNoCommand);
|
||||
|
||||
private:
|
||||
void _buildCommandlinesHelper(AppCommandlineArgs& appArgs,
|
||||
@@ -1224,4 +1225,56 @@ namespace TerminalAppLocalTests
|
||||
VERIFY_ARE_EQUAL(appArgs.GetLaunchMode().value(), LaunchMode::MaximizedFocusMode);
|
||||
}
|
||||
}
|
||||
|
||||
void CommandlineTest::TestLaunchModeWithNoCommand()
|
||||
{
|
||||
{
|
||||
Log::Comment(NoThrowString().Format(L"Pass a launch mode and profile"));
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", L"-M", L"--profile", L"cmd" };
|
||||
_buildCommandlinesHelper(appArgs, 1u, rawCommands);
|
||||
|
||||
VERIFY_IS_TRUE(appArgs.GetLaunchMode().has_value());
|
||||
VERIFY_ARE_EQUAL(appArgs.GetLaunchMode().value(), LaunchMode::MaximizedMode);
|
||||
VERIFY_ARE_EQUAL(1u, appArgs._startupActions.size());
|
||||
|
||||
auto actionAndArgs = appArgs._startupActions.at(0);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<NewTabArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_IS_NOT_NULL(myArgs.TerminalArgs());
|
||||
VERIFY_IS_TRUE(myArgs.TerminalArgs().Commandline().empty());
|
||||
VERIFY_IS_TRUE(myArgs.TerminalArgs().StartingDirectory().empty());
|
||||
VERIFY_IS_TRUE(myArgs.TerminalArgs().TabTitle().empty());
|
||||
VERIFY_IS_TRUE(myArgs.TerminalArgs().ProfileIndex() == nullptr);
|
||||
VERIFY_IS_FALSE(myArgs.TerminalArgs().Profile().empty());
|
||||
VERIFY_ARE_EQUAL(L"cmd", myArgs.TerminalArgs().Profile());
|
||||
}
|
||||
{
|
||||
Log::Comment(NoThrowString().Format(L"Pass a launch mode and command line"));
|
||||
|
||||
AppCommandlineArgs appArgs{};
|
||||
std::vector<const wchar_t*> rawCommands{ L"wt.exe", L"-M", L"powershell.exe" };
|
||||
_buildCommandlinesHelper(appArgs, 1u, rawCommands);
|
||||
|
||||
VERIFY_IS_TRUE(appArgs.GetLaunchMode().has_value());
|
||||
VERIFY_ARE_EQUAL(appArgs.GetLaunchMode().value(), LaunchMode::MaximizedMode);
|
||||
VERIFY_ARE_EQUAL(1u, appArgs._startupActions.size());
|
||||
|
||||
auto actionAndArgs = appArgs._startupActions.at(0);
|
||||
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, actionAndArgs.Action());
|
||||
VERIFY_IS_NOT_NULL(actionAndArgs.Args());
|
||||
auto myArgs = actionAndArgs.Args().try_as<NewTabArgs>();
|
||||
VERIFY_IS_NOT_NULL(myArgs);
|
||||
VERIFY_IS_NOT_NULL(myArgs.TerminalArgs());
|
||||
VERIFY_IS_FALSE(myArgs.TerminalArgs().Commandline().empty());
|
||||
VERIFY_IS_TRUE(myArgs.TerminalArgs().StartingDirectory().empty());
|
||||
VERIFY_IS_TRUE(myArgs.TerminalArgs().TabTitle().empty());
|
||||
VERIFY_IS_TRUE(myArgs.TerminalArgs().ProfileIndex() == nullptr);
|
||||
VERIFY_IS_TRUE(myArgs.TerminalArgs().Profile().empty());
|
||||
VERIFY_ARE_EQUAL(L"powershell.exe", myArgs.TerminalArgs().Commandline());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@
|
||||
<!-- From Microsoft.UI.Xaml.targets -->
|
||||
<Native-Platform Condition="'$(Platform)' == 'Win32'">x86</Native-Platform>
|
||||
<Native-Platform Condition="'$(Platform)' != 'Win32'">$(Platform)</Native-Platform>
|
||||
<_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\runtimes\win10-$(Native-Platform)\native\"</_MUXBinRoot>
|
||||
<_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\runtimes\win10-$(Native-Platform)\native\"</_MUXBinRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- We actually can just straight up reference MUX here, it's fine -->
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets" Condition="Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" />
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
|
||||
<Import Project="$(OpenConsoleDir)\src\common.build.post.props" />
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "pch.h"
|
||||
#include "OpenTerminalHere.h"
|
||||
#include <ShlObj.h>
|
||||
|
||||
// TODO GH#6112: Localize these strings
|
||||
static constexpr std::wstring_view VerbDisplayName{ L"Open in Windows Terminal" };
|
||||
@@ -117,14 +118,29 @@ static std::wstring _getExePath()
|
||||
HRESULT OpenTerminalHere::Invoke(IShellItemArray* psiItemArray,
|
||||
IBindCtx* /*pBindContext*/)
|
||||
{
|
||||
DWORD count;
|
||||
psiItemArray->GetCount(&count);
|
||||
|
||||
winrt::com_ptr<IShellItem> psi;
|
||||
RETURN_IF_FAILED(psiItemArray->GetItemAt(0, psi.put()));
|
||||
|
||||
wil::unique_cotaskmem_string pszName;
|
||||
RETURN_IF_FAILED(psi->GetDisplayName(SIGDN_FILESYSPATH, &pszName));
|
||||
|
||||
if (psiItemArray == nullptr)
|
||||
{
|
||||
// get the current path from explorer.exe
|
||||
const auto path = this->_GetPathFromExplorer();
|
||||
|
||||
// no go, unable to get a reasonable path
|
||||
if (path.empty())
|
||||
{
|
||||
return S_FALSE;
|
||||
}
|
||||
pszName = wil::make_cotaskmem_string(path.c_str(), path.length());
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD count;
|
||||
psiItemArray->GetCount(&count);
|
||||
|
||||
winrt::com_ptr<IShellItem> psi;
|
||||
RETURN_IF_FAILED(psiItemArray->GetItemAt(0, psi.put()));
|
||||
RETURN_IF_FAILED(psi->GetDisplayName(SIGDN_FILESYSPATH, &pszName));
|
||||
}
|
||||
|
||||
{
|
||||
wil::unique_process_information _piClient;
|
||||
@@ -214,3 +230,103 @@ HRESULT OpenTerminalHere::EnumSubCommands(IEnumExplorerCommand** ppEnum)
|
||||
*ppEnum = nullptr;
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
std::wstring OpenTerminalHere::_GetPathFromExplorer() const
|
||||
{
|
||||
using namespace std;
|
||||
using namespace winrt;
|
||||
|
||||
wstring path;
|
||||
HRESULT hr = NOERROR;
|
||||
|
||||
auto hwnd = ::GetForegroundWindow();
|
||||
if (hwnd == nullptr)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
TCHAR szName[MAX_PATH] = { 0 };
|
||||
::GetClassName(hwnd, szName, MAX_PATH);
|
||||
if (0 == StrCmp(szName, L"WorkerW") ||
|
||||
0 == StrCmp(szName, L"Progman"))
|
||||
{
|
||||
//special folder: desktop
|
||||
hr = ::SHGetFolderPath(NULL, CSIDL_DESKTOP, NULL, SHGFP_TYPE_CURRENT, szName);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
path = szName;
|
||||
return path;
|
||||
}
|
||||
|
||||
if (0 != StrCmp(szName, L"CabinetWClass"))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
com_ptr<IShellWindows> shell;
|
||||
try
|
||||
{
|
||||
shell = create_instance<IShellWindows>(CLSID_ShellWindows, CLSCTX_ALL);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
//look like try_create_instance is not available no more
|
||||
}
|
||||
|
||||
if (shell == nullptr)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
com_ptr<IDispatch> disp;
|
||||
wil::unique_variant variant;
|
||||
variant.vt = VT_I4;
|
||||
|
||||
com_ptr<IWebBrowserApp> browser;
|
||||
// look for correct explorer window
|
||||
for (variant.intVal = 0;
|
||||
shell->Item(variant, disp.put()) == S_OK;
|
||||
variant.intVal++)
|
||||
{
|
||||
com_ptr<IWebBrowserApp> tmp;
|
||||
if (FAILED(disp->QueryInterface(tmp.put())))
|
||||
{
|
||||
disp = nullptr; // get rid of DEBUG non-nullptr warning
|
||||
continue;
|
||||
}
|
||||
|
||||
HWND tmpHWND = NULL;
|
||||
hr = tmp->get_HWND(reinterpret_cast<SHANDLE_PTR*>(&tmpHWND));
|
||||
if (hwnd == tmpHWND)
|
||||
{
|
||||
browser = tmp;
|
||||
disp = nullptr; // get rid of DEBUG non-nullptr warning
|
||||
break; //found
|
||||
}
|
||||
|
||||
disp = nullptr; // get rid of DEBUG non-nullptr warning
|
||||
}
|
||||
|
||||
if (browser != nullptr)
|
||||
{
|
||||
wil::unique_bstr url;
|
||||
hr = browser->get_LocationURL(&url);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
wstring sUrl(url.get(), SysStringLen(url.get()));
|
||||
DWORD size = MAX_PATH;
|
||||
hr = ::PathCreateFromUrl(sUrl.c_str(), szName, &size, NULL);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
path = szName;
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ struct __declspec(uuid("9f156763-7844-4dc4-b2b1-901f640f5155"))
|
||||
STDMETHODIMP GetCanonicalName(GUID* pguidCommandName);
|
||||
STDMETHODIMP EnumSubCommands(IEnumExplorerCommand** ppEnum);
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
std::wstring _GetPathFromExplorer() const;
|
||||
};
|
||||
|
||||
CoCreatableClass(OpenTerminalHere);
|
||||
|
||||
@@ -11,10 +11,13 @@
|
||||
<!-- sets a bunch of Windows Universal properties -->
|
||||
<OpenConsoleUniversalApp>true</OpenConsoleUniversalApp>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
|
||||
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.pre.props" />
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
<Link>
|
||||
<AdditionalDependencies>User32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="OpenTerminalHere.h" />
|
||||
@@ -40,7 +43,6 @@
|
||||
<None Include="packages.config" />
|
||||
<None Include="WindowsTerminalShellExt.def" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- ========================= Project References ======================== -->
|
||||
<ItemGroup>
|
||||
<!--
|
||||
@@ -56,7 +58,5 @@
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
|
||||
</Project>
|
||||
|
||||
@@ -69,50 +69,29 @@ int AppCommandlineArgs::ParseCommand(const Commandline& command)
|
||||
{
|
||||
throw CLI::CallForHelp();
|
||||
}
|
||||
// Clear the parser's internal state
|
||||
_app.clear();
|
||||
|
||||
// attempt to parse the commandline
|
||||
// attempt to parse the commandline prefix of the form [options][subcommand]
|
||||
_app.parse(args);
|
||||
auto remainingParams = _app.remaining_size();
|
||||
|
||||
// If we parsed the commandline, and _no_ subcommands were provided, try
|
||||
// parsing again as a "new-tab" command.
|
||||
|
||||
// parse the remaining suffix as a "new-tab" command.
|
||||
if (_noCommandsProvided())
|
||||
{
|
||||
_newTabCommand.subcommand->clear();
|
||||
_newTabCommand.subcommand->parse(args);
|
||||
remainingParams = _newTabCommand.subcommand->remaining_size();
|
||||
}
|
||||
|
||||
// if after parsing the prefix and (optionally) the implicit tab subcommand
|
||||
// we still have unparsed parameters we need to fail
|
||||
if (remainingParams > 0)
|
||||
{
|
||||
throw CLI::ExtrasError(args);
|
||||
}
|
||||
}
|
||||
catch (const CLI::CallForHelp& e)
|
||||
{
|
||||
return _handleExit(_app, e);
|
||||
}
|
||||
catch (const CLI::ParseError& e)
|
||||
{
|
||||
// If we parsed the commandline, and _no_ subcommands were provided, try
|
||||
// parsing again as a "new-tab" command.
|
||||
if (_noCommandsProvided())
|
||||
{
|
||||
try
|
||||
{
|
||||
// CLI11 mutated the original vector the first time it tried to
|
||||
// parse the args. Reconstruct it the way CLI11 wants here.
|
||||
// "See above for why it's begin() + 1"
|
||||
std::vector<std::string> args{ command.Args().begin() + 1, command.Args().end() };
|
||||
std::reverse(args.begin(), args.end());
|
||||
_newTabCommand.subcommand->clear();
|
||||
_newTabCommand.subcommand->parse(args);
|
||||
}
|
||||
catch (const CLI::ParseError& e)
|
||||
{
|
||||
return _handleExit(*_newTabCommand.subcommand, e);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return _handleExit(_app, e);
|
||||
}
|
||||
return _handleExit(_app, e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -157,6 +136,15 @@ int AppCommandlineArgs::_handleExit(const CLI::App& command, const CLI::Error& e
|
||||
// - <none>
|
||||
void AppCommandlineArgs::_buildParser()
|
||||
{
|
||||
// We define or parser as a prefix command, to support "implicit new tab subcommand" scenario.
|
||||
// In this scenario we will try to parse the prefix that contains parameters like launch mode,
|
||||
// but will not encounter an explicit command.
|
||||
// Instead we will encounter an argument that doesn't belong to the prefix indicating the prefix is over.
|
||||
// Then we will try to parse the remaining arguments as a new tab subcommand.
|
||||
// E.g., for "wt.exe -M -d c:/", we will use -M for the launch mode, but once we will encounter -d
|
||||
// we will know that the prefix is over and try to handle the suffix as a new tab subcommand
|
||||
_app.prefix_command();
|
||||
|
||||
// -v,--version: Displays version info
|
||||
auto versionCallback = [this](int64_t /*count*/) {
|
||||
// Set our message to display the application name and the current version.
|
||||
|
||||
@@ -583,10 +583,10 @@ namespace winrt::TerminalApp::implementation
|
||||
auto tabControl = TabRowControl();
|
||||
tabControl.Measure({ SHRT_MAX, SHRT_MAX });
|
||||
|
||||
// For whatever reason, there's about 6px of unaccounted-for space
|
||||
// in the application. I couldn't tell you where these 6px are
|
||||
// For whatever reason, there's about 10px of unaccounted-for space
|
||||
// in the application. I couldn't tell you where these 10px are
|
||||
// coming from, but they need to be included in this math.
|
||||
proposedSize.Width += (tabControl.DesiredSize().Height + 6) * scale;
|
||||
proposedSize.Height += (tabControl.DesiredSize().Height + 10) * scale;
|
||||
}
|
||||
|
||||
return proposedSize;
|
||||
@@ -797,7 +797,8 @@ namespace winrt::TerminalApp::implementation
|
||||
// editors, who will write a temp file, then rename it to be the
|
||||
// actual file you wrote. So listen for that too.
|
||||
if (!(event == wil::FolderChangeEvent::Modified ||
|
||||
event == wil::FolderChangeEvent::RenameNewName))
|
||||
event == wil::FolderChangeEvent::RenameNewName ||
|
||||
event == wil::FolderChangeEvent::Removed))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ the MIT License. See LICENSE in the project root for license information. -->
|
||||
x:Name="_prefixCharacter"
|
||||
Margin="16,16,0,-8"
|
||||
FontSize="14"
|
||||
HorizontalAlignment="Left"
|
||||
Visibility="{x:Bind PrefixCharacter,
|
||||
Mode=OneWay,
|
||||
Converter={StaticResource ParentCommandVisibilityConverter}}"
|
||||
@@ -185,35 +186,35 @@ the MIT License. See LICENSE in the project root for license information. -->
|
||||
>
|
||||
</TextBlock>
|
||||
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Padding="16, 0, 16, 4"
|
||||
Grid.Row="1"
|
||||
Visibility="{x:Bind ParentCommandName,
|
||||
Mode=OneWay,
|
||||
Converter={StaticResource ParentCommandVisibilityConverter}}">
|
||||
|
||||
<Button
|
||||
Background="Transparent"
|
||||
x:Name="_parentCommandBackButton"
|
||||
x:Uid="ParentCommandBackButton"
|
||||
Click="_moveBackButtonClicked"
|
||||
ClickMode="Press"
|
||||
VerticalAlignment="Center">
|
||||
<FontIcon
|
||||
FontSize="12"
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Glyph="">
|
||||
</FontIcon>
|
||||
</Button>
|
||||
|
||||
<TextBlock
|
||||
Padding="16, 0, 16, 4"
|
||||
x:Name="_parentCommandText"
|
||||
FontStyle="Italic"
|
||||
Grid.Row="1"
|
||||
Text="{x:Bind ParentCommandName, Mode=OneWay}"
|
||||
VerticalAlignment="Center">
|
||||
</TextBlock>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Padding="16, 0, 16, 4"
|
||||
Grid.Row="1"
|
||||
Visibility="{x:Bind ParentCommandName,
|
||||
Mode=OneWay,
|
||||
Converter={StaticResource ParentCommandVisibilityConverter}}">
|
||||
|
||||
<Button
|
||||
Background="Transparent"
|
||||
x:Name="_parentCommandBackButton"
|
||||
x:Uid="ParentCommandBackButton"
|
||||
Click="_moveBackButtonClicked"
|
||||
ClickMode="Press"
|
||||
VerticalAlignment="Center">
|
||||
<FontIcon
|
||||
FontSize="12"
|
||||
FontFamily="Segoe MDL2 Assets"
|
||||
Glyph="">
|
||||
</FontIcon>
|
||||
</Button>
|
||||
|
||||
<TextBlock
|
||||
Padding="16, 0, 16, 4"
|
||||
x:Name="_parentCommandText"
|
||||
FontStyle="Italic"
|
||||
Grid.Row="1"
|
||||
Text="{x:Bind ParentCommandName, Mode=OneWay}"
|
||||
VerticalAlignment="Center">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
@@ -267,7 +268,7 @@ the MIT License. See LICENSE in the project root for license information. -->
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Left"
|
||||
Text="{x:Bind HighlightedName, Mode=OneWay}"/>
|
||||
|
||||
|
||||
<!-- The block for the key chord is only visible
|
||||
when there's actual text set as the label. See
|
||||
CommandKeyChordVisibilityConverter for details. -->
|
||||
|
||||
@@ -22,9 +22,11 @@ the MIT License. See LICENSE in the project root for license information. -->
|
||||
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="SystemControlBackgroundBaseLowBrush"/>
|
||||
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="SystemControlBackgroundBaseMediumLowBrush"/>
|
||||
<StaticResource x:Key="CaptionButtonStroke" ResourceKey="SystemControlForegroundBaseHighBrush"/>
|
||||
<StaticResource x:Key="CaptionButtonStrokeColor" ResourceKey="SystemBaseHighColor"/>
|
||||
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="SystemControlForegroundBaseHighBrush"/>
|
||||
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="SystemControlForegroundBaseHighBrush"/>
|
||||
<SolidColorBrush x:Key="CaptionButtonBackground" Color="Transparent" />
|
||||
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver" Color="#e81123"/>
|
||||
<SolidColorBrush x:Key="CloseButtonStrokePointerOver" Color="White"/>
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPressed" Color="#f1707a"/>
|
||||
@@ -35,9 +37,11 @@ the MIT License. See LICENSE in the project root for license information. -->
|
||||
<StaticResource x:Key="CaptionButtonBackgroundPointerOver" ResourceKey="SystemControlBackgroundBaseLowBrush"/>
|
||||
<StaticResource x:Key="CaptionButtonBackgroundPressed" ResourceKey="SystemControlBackgroundBaseMediumLowBrush"/>
|
||||
<StaticResource x:Key="CaptionButtonStroke" ResourceKey="SystemControlForegroundBaseHighBrush"/>
|
||||
<StaticResource x:Key="CaptionButtonStrokeColor" ResourceKey="SystemBaseHighColor"/>
|
||||
<StaticResource x:Key="CaptionButtonStrokePointerOver" ResourceKey="SystemControlForegroundBaseHighBrush"/>
|
||||
<StaticResource x:Key="CaptionButtonStrokePressed" ResourceKey="SystemControlForegroundBaseHighBrush"/>
|
||||
<SolidColorBrush x:Key="CaptionButtonBackground" Color="Transparent" />
|
||||
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver" Color="#e81123"/>
|
||||
<SolidColorBrush x:Key="CloseButtonStrokePointerOver" Color="White"/>
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPressed" Color="#f1707a"/>
|
||||
@@ -46,9 +50,11 @@ the MIT License. See LICENSE in the project root for license information. -->
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<x:Double x:Key="CaptionButtonStrokeWidth">3.0</x:Double>
|
||||
<SolidColorBrush x:Key="CaptionButtonBackground" Color="{ThemeResource SystemColorButtonFaceColor}"/>
|
||||
<StaticResource x:Key="CaptionButtonBackgroundColor" ResourceKey="SystemColorButtonFaceColor"/>
|
||||
<SolidColorBrush x:Key="CaptionButtonBackgroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}"/>
|
||||
<SolidColorBrush x:Key="CaptionButtonBackgroundPressed" Color="{ThemeResource SystemColorHighlightColor}"/>
|
||||
<SolidColorBrush x:Key="CaptionButtonStroke" Color="{ThemeResource SystemColorButtonTextColor}"/>
|
||||
<StaticResource x:Key="CaptionButtonStrokeColor" ResourceKey="SystemColorButtonTextColor"/>
|
||||
<SolidColorBrush x:Key="CaptionButtonStrokePointerOver" Color="{ThemeResource SystemColorHighlightTextColor}"/>
|
||||
<SolidColorBrush x:Key="CaptionButtonStrokePressed" Color="{ThemeResource SystemColorHighlightTextColor}"/>
|
||||
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver" Color="{ThemeResource SystemColorHighlightColor}"/>
|
||||
@@ -95,8 +101,8 @@ the MIT License. See LICENSE in the project root for license information. -->
|
||||
<VisualStateGroup.Transitions>
|
||||
<VisualTransition From="PointerOver" To="Normal">
|
||||
<Storyboard>
|
||||
<ColorAnimation Storyboard.TargetName="ButtonBaseElement" Storyboard.TargetProperty="(UIElement.Background).(SolidColorBrush.Color)" To="{Binding Color, Source={ThemeResource CaptionButtonBackground}}" Duration="0:0:0.2"/>
|
||||
<ColorAnimation Storyboard.TargetName="Path" Storyboard.TargetProperty="(UIElement.Stroke).(SolidColorBrush.Color)" To="{Binding Color, Source={ThemeResource CaptionButtonStroke}}" Duration="0:0:0.1"/>
|
||||
<ColorAnimation Storyboard.TargetName="ButtonBaseElement" Storyboard.TargetProperty="(UIElement.Background).(SolidColorBrush.Color)" To="{ThemeResource CaptionButtonBackgroundColor}" Duration="0:0:0.2"/>
|
||||
<ColorAnimation Storyboard.TargetName="Path" Storyboard.TargetProperty="(UIElement.Stroke).(SolidColorBrush.Color)" To="{ThemeResource CaptionButtonStrokeColor}" Duration="0:0:0.1"/>
|
||||
</Storyboard>
|
||||
</VisualTransition>
|
||||
</VisualStateGroup.Transitions>
|
||||
|
||||
@@ -1093,13 +1093,14 @@ void Pane::_SetupEntranceAnimation()
|
||||
// Windows" setting in the OS
|
||||
winrt::Windows::UI::ViewManagement::UISettings uiSettings;
|
||||
const auto animationsEnabledInOS = uiSettings.AnimationsEnabled();
|
||||
const auto animationsEnabledInApp = Media::Animation::Timeline::AllowDependentAnimations();
|
||||
|
||||
const bool splitWidth = _splitState == SplitState::Vertical;
|
||||
const auto totalSize = splitWidth ? _root.ActualWidth() : _root.ActualHeight();
|
||||
// If we don't have a size yet, it's likely that we're in startup, or we're
|
||||
// being executed as a sequence of actions. In that case, just skip the
|
||||
// animation.
|
||||
if (totalSize <= 0 || !animationsEnabledInOS)
|
||||
if (totalSize <= 0 || !animationsEnabledInOS || !animationsEnabledInApp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1168,6 +1169,15 @@ void Pane::_SetupEntranceAnimation()
|
||||
childGrid.HorizontalAlignment(isFirstChild ? HorizontalAlignment::Left : HorizontalAlignment::Right);
|
||||
control.HorizontalAlignment(HorizontalAlignment::Left);
|
||||
control.Width(isFirstChild ? totalSize : size);
|
||||
|
||||
// When the animation is completed, undo the trickiness from before, to
|
||||
// restore the controls to the behavior they'd usually have.
|
||||
animation.Completed([childGrid, control](auto&&, auto&&) {
|
||||
control.Width(NAN);
|
||||
childGrid.Width(NAN);
|
||||
childGrid.HorizontalAlignment(HorizontalAlignment::Stretch);
|
||||
control.HorizontalAlignment(HorizontalAlignment::Stretch);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1177,38 +1187,19 @@ void Pane::_SetupEntranceAnimation()
|
||||
childGrid.VerticalAlignment(isFirstChild ? VerticalAlignment::Top : VerticalAlignment::Bottom);
|
||||
control.VerticalAlignment(VerticalAlignment::Top);
|
||||
control.Height(isFirstChild ? totalSize : size);
|
||||
|
||||
// When the animation is completed, undo the trickiness from before, to
|
||||
// restore the controls to the behavior they'd usually have.
|
||||
animation.Completed([childGrid, control](auto&&, auto&&) {
|
||||
control.Height(NAN);
|
||||
childGrid.Height(NAN);
|
||||
childGrid.VerticalAlignment(VerticalAlignment::Stretch);
|
||||
control.VerticalAlignment(VerticalAlignment::Stretch);
|
||||
});
|
||||
}
|
||||
|
||||
// Start the animation.
|
||||
s.Begin();
|
||||
|
||||
std::weak_ptr<Pane> weakThis{ shared_from_this() };
|
||||
// When the animation is completed, undo the trickiness from before, to
|
||||
// restore the controls to the behavior they'd usually have.
|
||||
animation.Completed([weakThis, isFirstChild, splitWidth](auto&&, auto&&) {
|
||||
if (auto pane{ weakThis.lock() })
|
||||
{
|
||||
auto child = isFirstChild ? pane->_firstChild : pane->_secondChild;
|
||||
auto childGrid = child->_root;
|
||||
if (auto control = child->_control)
|
||||
{
|
||||
if (splitWidth)
|
||||
{
|
||||
control.Width(NAN);
|
||||
childGrid.Width(NAN);
|
||||
childGrid.HorizontalAlignment(HorizontalAlignment::Stretch);
|
||||
control.HorizontalAlignment(HorizontalAlignment::Stretch);
|
||||
}
|
||||
else
|
||||
{
|
||||
control.Height(NAN);
|
||||
childGrid.Height(NAN);
|
||||
childGrid.VerticalAlignment(VerticalAlignment::Stretch);
|
||||
control.VerticalAlignment(VerticalAlignment::Stretch);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// TODO: GH#7365 - animating the first child right now doesn't _really_ do
|
||||
|
||||
@@ -62,7 +62,6 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// Build the menu
|
||||
Controls::MenuFlyout newTabFlyout;
|
||||
newTabFlyout.Items().Append(_CreateCloseSubMenu());
|
||||
newTabFlyout.Items().Append(closeTabMenuItem);
|
||||
TabViewItem().ContextFlyout(newTabFlyout);
|
||||
}
|
||||
|
||||
@@ -316,13 +316,13 @@
|
||||
<!-- ========================= Globals ======================== -->
|
||||
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
|
||||
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets" Condition="Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets'))" />
|
||||
</Target>
|
||||
|
||||
|
||||
@@ -703,7 +703,6 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
auto tabViewItem = newTabImpl->TabViewItem();
|
||||
_tabView.TabItems().Append(tabViewItem);
|
||||
_ReapplyCompactTabSize();
|
||||
|
||||
// Set this tab's icon to the icon from the user's profile
|
||||
const auto profile = _settings.FindProfile(profileGuid);
|
||||
@@ -918,8 +917,7 @@ namespace winrt::TerminalApp::implementation
|
||||
{
|
||||
auto newTabTitle = tab.Title();
|
||||
|
||||
if (_settings.GlobalSettings().ShowTitleInTitlebar() &&
|
||||
tab.FocusState() != FocusState::Unfocused)
|
||||
if (_settings.GlobalSettings().ShowTitleInTitlebar() && tab == _GetFocusedTab())
|
||||
{
|
||||
_titleChangeHandlers(*this, newTabTitle);
|
||||
}
|
||||
@@ -1206,6 +1204,14 @@ namespace winrt::TerminalApp::implementation
|
||||
// - Sets focus to the tab to the right or left the currently selected tab.
|
||||
void TerminalPage::_SelectNextTab(const bool bMoveRight)
|
||||
{
|
||||
if (CommandPalette().Visibility() == Visibility::Visible)
|
||||
{
|
||||
// If the tab switcher is currently open, don't change its mode.
|
||||
// Just select the new tab.
|
||||
CommandPalette().SelectNextItem(bMoveRight);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto tabSwitchMode = _settings.GlobalSettings().TabSwitcherMode();
|
||||
const bool useInOrderTabIndex = tabSwitchMode != TabSwitcherMode::MostRecentlyUsed;
|
||||
|
||||
@@ -1250,19 +1256,10 @@ namespace winrt::TerminalApp::implementation
|
||||
CommandPalette().SetTabActions(_mruTabActions, true);
|
||||
}
|
||||
|
||||
if (CommandPalette().Visibility() == Visibility::Visible)
|
||||
{
|
||||
// If the tab switcher is currently open, don't change its mode.
|
||||
// Just select the new tab.
|
||||
CommandPalette().SelectNextItem(bMoveRight);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, set up the tab switcher in the selected mode, with
|
||||
// the given ordering, and make it visible.
|
||||
CommandPalette().EnableTabSwitcherMode(false, newTabIndex);
|
||||
CommandPalette().Visibility(Visibility::Visible);
|
||||
}
|
||||
// Otherwise, set up the tab switcher in the selected mode, with
|
||||
// the given ordering, and make it visible.
|
||||
CommandPalette().EnableTabSwitcherMode(false, newTabIndex);
|
||||
CommandPalette().Visibility(Visibility::Visible);
|
||||
}
|
||||
else if (auto index{ _GetFocusedTabIndex() })
|
||||
{
|
||||
@@ -1750,7 +1747,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// - See Pane::CalcSnappedDimension
|
||||
float TerminalPage::CalcSnappedDimension(const bool widthOrHeight, const float dimension) const
|
||||
{
|
||||
if (_settings.GlobalSettings().SnapToGridOnResize())
|
||||
if (_settings && _settings.GlobalSettings().SnapToGridOnResize())
|
||||
{
|
||||
if (auto index{ _GetFocusedTabIndex() })
|
||||
{
|
||||
@@ -1853,8 +1850,9 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
const bool hasNewLine = std::find(text.cbegin(), text.cend(), L'\n') != text.cend();
|
||||
const bool warnMultiLine = hasNewLine && _settings.GlobalSettings().WarnAboutMultiLinePaste();
|
||||
const auto isNewLineLambda = [](auto c) { return c == L'\n' || c == L'\r'; };
|
||||
const auto hasNewLine = std::find_if(text.cbegin(), text.cend(), isNewLineLambda) != text.cend();
|
||||
const auto warnMultiLine = hasNewLine && _settings.GlobalSettings().WarnAboutMultiLinePaste();
|
||||
|
||||
constexpr const std::size_t minimumSizeForWarning = 1024 * 5; // 5 KiB
|
||||
const bool warnLargeText = text.size() > minimumSizeForWarning &&
|
||||
@@ -2063,8 +2061,13 @@ namespace winrt::TerminalApp::implementation
|
||||
_UpdateMRUTab(index);
|
||||
}
|
||||
|
||||
tab.TabViewItem().StartBringIntoView();
|
||||
|
||||
// Raise an event that our title changed
|
||||
_titleChangeHandlers(*this, tab.Title());
|
||||
if (_settings.GlobalSettings().ShowTitleInTitlebar())
|
||||
{
|
||||
_titleChangeHandlers(*this, tab.Title());
|
||||
}
|
||||
}
|
||||
CATCH_LOG();
|
||||
}
|
||||
@@ -2243,7 +2246,7 @@ namespace winrt::TerminalApp::implementation
|
||||
IVectorView<Profile> profiles,
|
||||
IMapView<winrt::hstring, ColorScheme> schemes)
|
||||
{
|
||||
IVector<SettingsLoadWarnings> warnings;
|
||||
IVector<SettingsLoadWarnings> warnings{ winrt::single_threaded_vector<SettingsLoadWarnings>() };
|
||||
|
||||
std::vector<ColorScheme> sortedSchemes;
|
||||
sortedSchemes.reserve(schemes.Size());
|
||||
@@ -2667,25 +2670,6 @@ namespace winrt::TerminalApp::implementation
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - The TabView does not apply compact sizing to items added after Compact is enabled.
|
||||
// By forcibly reapplying compact sizing every time we add a new tab, we'll make sure
|
||||
// that it works.
|
||||
// Workaround from https://github.com/microsoft/microsoft-ui-xaml/issues/2711
|
||||
// TODO: Remove this function and its calls when ingesting the above changes.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void TerminalPage::_ReapplyCompactTabSize()
|
||||
{
|
||||
if (_tabView.TabWidthMode() == MUX::Controls::TabViewWidthMode::Compact)
|
||||
{
|
||||
_tabView.UpdateLayout();
|
||||
_tabView.TabWidthMode(MUX::Controls::TabViewWidthMode::Compact);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Initializes a SwitchToTab command object for this Tab instance.
|
||||
// This should be done before the tab is added to the _tabs vector so that
|
||||
@@ -2775,9 +2759,9 @@ namespace winrt::TerminalApp::implementation
|
||||
// Service" is disabled.
|
||||
void TerminalPage::ShowKeyboardServiceWarning()
|
||||
{
|
||||
if (auto presenter{ _dialogPresenter.get() })
|
||||
if (auto keyboardWarningInfoBar = FindName(L"KeyboardWarningInfoBar").try_as<MUX::Controls::InfoBar>())
|
||||
{
|
||||
presenter.ShowDialog(FindName(L"KeyboardServiceDisabledDialog").try_as<WUX::Controls::ContentDialog>());
|
||||
keyboardWarningInfoBar.IsOpen(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2826,9 +2810,9 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
// Method Description:
|
||||
// - Return the fully-formed warning message for the
|
||||
// "KeyboardServiceDisabled" dialog. This dialog is used to warn the user
|
||||
// "KeyboardServiceDisabled" InfoBar. This InfoBar is used to warn the user
|
||||
// if the keyboard service is disabled, and uses the OS localization for
|
||||
// the service's actual name. It's bound to the dialog in XAML.
|
||||
// the service's actual name. It's bound to the bar in XAML.
|
||||
// Return Value:
|
||||
// - The warning message, including the OS-localized service name.
|
||||
winrt::hstring TerminalPage::KeyboardServiceDisabledText()
|
||||
|
||||
@@ -224,8 +224,6 @@ namespace winrt::TerminalApp::implementation
|
||||
|
||||
void _OpenSettingsUI();
|
||||
|
||||
void _ReapplyCompactTabSize();
|
||||
|
||||
void _MakeSwitchToTabCommand(const TerminalApp::TabBase& tab, const uint32_t index);
|
||||
|
||||
static int _ComputeScrollDelta(ScrollDirection scrollDirection, const uint32_t rowsToScroll);
|
||||
|
||||
@@ -83,24 +83,18 @@ the MIT License. See LICENSE in the project root for license information. -->
|
||||
</TextBlock>
|
||||
</ContentDialog>
|
||||
|
||||
|
||||
<ContentDialog
|
||||
x:Load="False"
|
||||
x:Name="KeyboardServiceDisabledDialog"
|
||||
x:Uid="KeyboardServiceDisabledDialog"
|
||||
DefaultButton="Primary">
|
||||
|
||||
<TextBlock
|
||||
Foreground="{ThemeResource ErrorTextBrush}"
|
||||
IsTextSelectionEnabled="True"
|
||||
TextWrapping="WrapWholeWords"
|
||||
Text="{x:Bind KeyboardServiceDisabledText, Mode=OneWay}" />
|
||||
</ContentDialog>
|
||||
|
||||
<local:CommandPalette
|
||||
x:Name="CommandPalette"
|
||||
Grid.Row="1"
|
||||
Visibility="Collapsed"
|
||||
VerticalAlignment="Stretch" />
|
||||
|
||||
<mux:InfoBar x:Name="KeyboardWarningInfoBar"
|
||||
x:Load="False"
|
||||
IsClosable="True"
|
||||
IsIconVisible="True"
|
||||
IsOpen="False"
|
||||
Severity="Warning"
|
||||
Message="{x:Bind KeyboardServiceDisabledText, Mode=OneWay}"/>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@@ -500,7 +500,7 @@ namespace winrt::TerminalApp::implementation
|
||||
Controls::MenuFlyoutItem closeTabMenuItem;
|
||||
Controls::FontIcon closeSymbol;
|
||||
closeSymbol.FontFamily(Media::FontFamily{ L"Segoe MDL2 Assets" });
|
||||
closeSymbol.Glyph(L"\xE8BB");
|
||||
closeSymbol.Glyph(L"\xE711");
|
||||
|
||||
closeTabMenuItem.Click([weakThis](auto&&, auto&&) {
|
||||
if (auto tab{ weakThis.get() })
|
||||
@@ -546,7 +546,7 @@ namespace winrt::TerminalApp::implementation
|
||||
// "Rename Tab"
|
||||
Controls::FontIcon renameTabSymbol;
|
||||
renameTabSymbol.FontFamily(Media::FontFamily{ L"Segoe MDL2 Assets" });
|
||||
renameTabSymbol.Glyph(L"\xE932"); // Label
|
||||
renameTabSymbol.Glyph(L"\xE8AC"); // Rename
|
||||
|
||||
renameTabMenuItem.Click([weakThis](auto&&, auto&&) {
|
||||
if (auto tab{ weakThis.get() })
|
||||
@@ -564,7 +564,6 @@ namespace winrt::TerminalApp::implementation
|
||||
newTabFlyout.Items().Append(chooseColorMenuItem);
|
||||
newTabFlyout.Items().Append(renameTabMenuItem);
|
||||
newTabFlyout.Items().Append(menuSeparator);
|
||||
newTabFlyout.Items().Append(_CreateCloseSubMenu());
|
||||
newTabFlyout.Items().Append(closeTabMenuItem);
|
||||
TabViewItem().ContextFlyout(newTabFlyout);
|
||||
}
|
||||
@@ -855,6 +854,8 @@ namespace winrt::TerminalApp::implementation
|
||||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForegroundPointerOver"), fontBrush);
|
||||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForegroundPressed"), fontBrush);
|
||||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewButtonForegroundActiveTab"), fontBrush);
|
||||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewButtonForegroundPressed"), fontBrush);
|
||||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewButtonForegroundPointerOver"), fontBrush);
|
||||
|
||||
_RefreshVisualState();
|
||||
|
||||
|
||||
@@ -74,13 +74,13 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="$(OpenConsoleDir)packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets" Condition="Exists('$(OpenConsoleDir)packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets'))" />
|
||||
</Target>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.0.0" targetFramework="native" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.5.0-prerelease.200609001" targetFramework="native" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.5.0-prerelease.201202003" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.201017.1" targetFramework="native" />
|
||||
</packages>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "ConptyConnection.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <userenv.h>
|
||||
|
||||
#include "ConptyConnection.g.cpp"
|
||||
|
||||
@@ -94,11 +93,8 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
||||
environment.clear();
|
||||
});
|
||||
|
||||
{
|
||||
const auto newEnvironmentBlock{ Utils::CreateEnvironmentBlock() };
|
||||
// Populate the environment map with the current environment.
|
||||
RETURN_IF_FAILED(Utils::UpdateEnvironmentMapW(environment, newEnvironmentBlock.get()));
|
||||
}
|
||||
// Populate the environment map with the current environment.
|
||||
RETURN_IF_FAILED(Utils::UpdateEnvironmentMapW(environment));
|
||||
|
||||
{
|
||||
// Convert connection Guid to string and ignore the enclosing '{}'.
|
||||
|
||||
@@ -81,6 +81,5 @@
|
||||
<AdditionalDependencies>$(OpenConsoleCommonOutDir)\conptylib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<Import Project="$(SolutionDir)build\rules\CollectWildcardResources.targets" />
|
||||
</Project>
|
||||
|
||||
@@ -1943,6 +1943,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
||||
// - Pre-process text pasted (presumably from the clipboard)
|
||||
// before sending it over the terminal's connection, converting
|
||||
// Windows-space \r\n line-endings to \r line-endings
|
||||
// - Also converts \n line-endings to \r line-endings
|
||||
void TermControl::_SendPastedTextToConnection(const std::wstring& wstr)
|
||||
{
|
||||
// Some notes on this implementation:
|
||||
@@ -1952,20 +1953,52 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
||||
// performance guarantees aren't exactly stellar)
|
||||
// - The STL doesn't have a simple string search/replace method.
|
||||
// This fact is lamentable.
|
||||
// - This line-ending conversion is intentionally fairly
|
||||
// conservative, to avoid stripping out lone \n characters
|
||||
// where they could conceivably be intentional.
|
||||
// - We search for \n, and when we find it we copy the string up to
|
||||
// the \n (but not including it). Then, we check the if the
|
||||
// previous character is \r, if its not, then we had a lone \n
|
||||
// and so we append our own \r
|
||||
|
||||
std::wstring stripped{ wstr };
|
||||
std::wstring stripped;
|
||||
stripped.reserve(wstr.length());
|
||||
|
||||
std::wstring::size_type pos = 0;
|
||||
std::wstring::size_type begin = 0;
|
||||
|
||||
while ((pos = stripped.find(L"\r\n", pos)) != std::wstring::npos)
|
||||
while ((pos = wstr.find(L"\n", pos)) != std::wstring::npos)
|
||||
{
|
||||
stripped.replace(pos, 2, L"\r");
|
||||
// copy up to but not including the \n
|
||||
stripped.append(wstr.cbegin() + begin, wstr.cbegin() + pos);
|
||||
if (!(pos > 0 && (wstr.at(pos - 1) == L'\r')))
|
||||
{
|
||||
// there was no \r before the \n we did not copy,
|
||||
// so append our own \r (this effectively replaces the \n
|
||||
// with a \r)
|
||||
stripped.push_back(L'\r');
|
||||
}
|
||||
++pos;
|
||||
begin = pos;
|
||||
}
|
||||
|
||||
_connection.WriteInput(stripped);
|
||||
// If we entered the while loop even once, begin would be non-zero
|
||||
// (because we set begin = pos right after incrementing pos)
|
||||
// So, if begin is still zero at this point it means we never found a newline
|
||||
// and we can just write the original string
|
||||
if (begin == 0)
|
||||
{
|
||||
_connection.WriteInput(wstr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// copy over the part after the last \n
|
||||
stripped.append(wstr.cbegin() + begin, wstr.cend());
|
||||
|
||||
// we may have removed some characters, so we may not need as much space
|
||||
// as we reserved earlier
|
||||
stripped.shrink_to_fit();
|
||||
_connection.WriteInput(stripped);
|
||||
}
|
||||
|
||||
_terminal->ClearSelection();
|
||||
_terminal->TrySnapOnInput();
|
||||
}
|
||||
|
||||
@@ -2438,6 +2471,17 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
||||
// closed. We can just do it whenever.
|
||||
_AsyncCloseConnection();
|
||||
|
||||
{
|
||||
// GH#8734:
|
||||
// We lock the terminal here to make sure it isn't still being
|
||||
// used in the connection thread before we destroy the renderer.
|
||||
// However, we must unlock it again prior to triggering the
|
||||
// teardown, to avoid the render thread being deadlocked. The
|
||||
// renderer may be waiting to acquire the terminal lock, while
|
||||
// we're waiting for the renderer to finish.
|
||||
auto lock = _terminal->LockForWriting();
|
||||
}
|
||||
|
||||
if (auto localRenderEngine{ std::exchange(_renderEngine, nullptr) })
|
||||
{
|
||||
if (auto localRenderer{ std::exchange(_renderer, nullptr) })
|
||||
@@ -2917,9 +2961,46 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.DataView().Contains(StandardDataFormats::StorageItems()))
|
||||
if (e.DataView().Contains(StandardDataFormats::ApplicationLink()))
|
||||
{
|
||||
auto items = co_await e.DataView().GetStorageItemsAsync();
|
||||
try
|
||||
{
|
||||
Windows::Foundation::Uri link{ co_await e.DataView().GetApplicationLinkAsync() };
|
||||
_SendPastedTextToConnection(std::wstring{ link.AbsoluteUri() });
|
||||
}
|
||||
CATCH_LOG();
|
||||
}
|
||||
else if (e.DataView().Contains(StandardDataFormats::WebLink()))
|
||||
{
|
||||
try
|
||||
{
|
||||
Windows::Foundation::Uri link{ co_await e.DataView().GetWebLinkAsync() };
|
||||
_SendPastedTextToConnection(std::wstring{ link.AbsoluteUri() });
|
||||
}
|
||||
CATCH_LOG();
|
||||
}
|
||||
else if (e.DataView().Contains(StandardDataFormats::Text()))
|
||||
{
|
||||
try
|
||||
{
|
||||
std::wstring text{ co_await e.DataView().GetTextAsync() };
|
||||
_SendPastedTextToConnection(text);
|
||||
}
|
||||
CATCH_LOG();
|
||||
}
|
||||
// StorageItem must be last. Some applications put hybrid data format items
|
||||
// in a drop message and we'll eat a crash when we request them.
|
||||
// Those applications usually include Text as well, so having storage items
|
||||
// last makes sure we'll hit text before getting to them.
|
||||
else if (e.DataView().Contains(StandardDataFormats::StorageItems()))
|
||||
{
|
||||
Windows::Foundation::Collections::IVectorView<Windows::Storage::IStorageItem> items;
|
||||
try
|
||||
{
|
||||
items = co_await e.DataView().GetStorageItemsAsync();
|
||||
}
|
||||
CATCH_LOG();
|
||||
|
||||
if (items.Size() > 0)
|
||||
{
|
||||
std::wstring allPaths;
|
||||
@@ -2949,15 +3030,6 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
||||
_SendInputToConnection(allPaths);
|
||||
}
|
||||
}
|
||||
else if (e.DataView().Contains(StandardDataFormats::Text()))
|
||||
{
|
||||
try
|
||||
{
|
||||
std::wstring text{ co_await e.DataView().GetTextAsync() };
|
||||
_SendPastedTextToConnection(text);
|
||||
}
|
||||
CATCH_LOG();
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
GETSET_SETTING(bool, DebugFeaturesEnabled); // default value set in constructor
|
||||
GETSET_SETTING(bool, StartOnUserLogin, false);
|
||||
GETSET_SETTING(bool, AlwaysOnTop, false);
|
||||
GETSET_SETTING(Model::TabSwitcherMode, TabSwitcherMode, Model::TabSwitcherMode::MostRecentlyUsed);
|
||||
GETSET_SETTING(Model::TabSwitcherMode, TabSwitcherMode, Model::TabSwitcherMode::InOrder);
|
||||
GETSET_SETTING(bool, DisableAnimations, false);
|
||||
|
||||
private:
|
||||
|
||||
@@ -41,7 +41,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
void KeyMapping::SetKeyBinding(const Microsoft::Terminal::Settings::Model::ActionAndArgs& actionAndArgs,
|
||||
const KeyChord& chord)
|
||||
{
|
||||
// if the chord is already mapped - clear the mapping
|
||||
if (_keyShortcuts.find(chord) != _keyShortcuts.end())
|
||||
{
|
||||
ClearKeyBinding(chord);
|
||||
}
|
||||
|
||||
_keyShortcuts[chord] = actionAndArgs;
|
||||
_keyShortcutsByInsertionOrder.push_back(std::make_pair(chord, actionAndArgs));
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
@@ -53,12 +60,19 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
void KeyMapping::ClearKeyBinding(const KeyChord& chord)
|
||||
{
|
||||
_keyShortcuts.erase(chord);
|
||||
|
||||
KeyChordEquality keyChordEquality;
|
||||
_keyShortcutsByInsertionOrder.erase(std::remove_if(_keyShortcutsByInsertionOrder.begin(), _keyShortcutsByInsertionOrder.end(), [keyChordEquality, chord](const auto& keyBinding) {
|
||||
return keyChordEquality(keyBinding.first, chord);
|
||||
}),
|
||||
_keyShortcutsByInsertionOrder.end());
|
||||
}
|
||||
|
||||
KeyChord KeyMapping::GetKeyBindingForAction(Microsoft::Terminal::Settings::Model::ShortcutAction const& action)
|
||||
{
|
||||
for (auto& kv : _keyShortcuts)
|
||||
for (auto it = _keyShortcutsByInsertionOrder.rbegin(); it != _keyShortcutsByInsertionOrder.rend(); ++it)
|
||||
{
|
||||
const auto& kv = *it;
|
||||
if (kv.second.Action() == action)
|
||||
{
|
||||
return kv.first;
|
||||
@@ -72,6 +86,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
// and IActionArgs. This enables searching no only for the binding of a
|
||||
// particular ShortcutAction, but also a particular set of values for
|
||||
// arguments to that action.
|
||||
// If several bindings might match the lookup, prefers the one that was added last.
|
||||
// Arguments:
|
||||
// - actionAndArgs: The ActionAndArgs to lookup the keybinding for.
|
||||
// Return Value:
|
||||
@@ -83,8 +98,9 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
return { nullptr };
|
||||
}
|
||||
|
||||
for (auto& kv : _keyShortcuts)
|
||||
for (auto it = _keyShortcutsByInsertionOrder.rbegin(); it != _keyShortcutsByInsertionOrder.rend(); ++it)
|
||||
{
|
||||
const auto& kv = *it;
|
||||
const auto action = kv.second.Action();
|
||||
const auto args = kv.second.Args();
|
||||
const auto actionMatched = action == actionAndArgs.Action();
|
||||
|
||||
@@ -71,6 +71,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
|
||||
private:
|
||||
std::unordered_map<TerminalControl::KeyChord, Model::ActionAndArgs, KeyChordHash, KeyChordEquality> _keyShortcuts;
|
||||
std::vector<std::pair<TerminalControl::KeyChord, Model::ActionAndArgs>> _keyShortcutsByInsertionOrder;
|
||||
|
||||
friend class SettingsModelLocalTests::DeserializationTests;
|
||||
friend class SettingsModelLocalTests::KeyBindingsTests;
|
||||
|
||||
@@ -177,12 +177,12 @@
|
||||
<!-- ========================= Globals ======================== -->
|
||||
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
|
||||
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
</Target>
|
||||
<!-- This target will take our defaults.json and stamp it into a .h file that
|
||||
we can include in the code directly. This way, we don't need to worry about
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
|
||||
GETSET_SETTING(hstring, BackgroundImagePath);
|
||||
GETSET_SETTING(double, BackgroundImageOpacity, 1.0);
|
||||
GETSET_SETTING(Windows::UI::Xaml::Media::Stretch, BackgroundImageStretchMode, Windows::UI::Xaml::Media::Stretch::Fill);
|
||||
GETSET_SETTING(Windows::UI::Xaml::Media::Stretch, BackgroundImageStretchMode, Windows::UI::Xaml::Media::Stretch::UniformToFill);
|
||||
|
||||
GETSET_SETTING(Microsoft::Terminal::TerminalControl::TextAntialiasingMode, AntialiasingMode, Microsoft::Terminal::TerminalControl::TextAntialiasingMode::Grayscale);
|
||||
GETSET_SETTING(bool, RetroTerminalEffect, false);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"showTabsInTitlebar": true,
|
||||
"showTerminalTitleInTitlebar": true,
|
||||
"tabWidthMode": "equal",
|
||||
"useTabSwitcher": "mru",
|
||||
"tabSwitcherMode": "inOrder",
|
||||
|
||||
// Miscellaneous
|
||||
"confirmCloseAllTabs": true,
|
||||
|
||||
@@ -70,12 +70,12 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(OpenConsoleDir)\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
</Target>
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
|
||||
@@ -276,10 +276,77 @@ void IslandWindow::OnSize(const UINT width, const UINT height)
|
||||
}
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Handles a WM_GETMINMAXINFO message, issued before the window sizing starts.
|
||||
// This message allows to modify the minimal and maximal dimensions of the window.
|
||||
// We focus on minimal dimensions here
|
||||
// (the maximal dimension will be calculate upon maximizing)
|
||||
// Our goal is to protect against to downsizing to less than minimal allowed dimensions,
|
||||
// that might occur in the scenarios where _OnSizing is bypassed.
|
||||
// An example of such scenario is anchoring the window to the top/bottom screen border
|
||||
// in order to maximize window height (GH# 8026).
|
||||
// The computation is similar to what we do in _OnSizing:
|
||||
// we need to consider both the client area and non-client exclusive area sizes,
|
||||
// while taking DPI into account as well.
|
||||
// Arguments:
|
||||
// - lParam: Pointer to the requested MINMAXINFO struct,
|
||||
// a ptMinTrackSize field of which we want to update with the computed dimensions.
|
||||
// It also acts as the return value (it's a ref parameter).
|
||||
// Return Value:
|
||||
// - <none>
|
||||
|
||||
void IslandWindow::_OnGetMinMaxInfo(const WPARAM /*wParam*/, const LPARAM lParam)
|
||||
{
|
||||
// Without a callback we don't know to snap the dimensions of the client area.
|
||||
// Should not be a problem, the callback is not set early in the startup
|
||||
// The initial dimensions will be set later on
|
||||
if (!_pfnSnapDimensionCallback)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HMONITOR hmon = MonitorFromWindow(GetHandle(), MONITOR_DEFAULTTONEAREST);
|
||||
if (hmon == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UINT dpix = USER_DEFAULT_SCREEN_DPI;
|
||||
UINT dpiy = USER_DEFAULT_SCREEN_DPI;
|
||||
GetDpiForMonitor(hmon, MDT_EFFECTIVE_DPI, &dpix, &dpiy);
|
||||
|
||||
// From now we use dpix for all computations (same as in _OnSizing).
|
||||
const auto nonClientSizeScaled = GetTotalNonClientExclusiveSize(dpix);
|
||||
const auto scale = base::ClampedNumeric<float>(dpix) / USER_DEFAULT_SCREEN_DPI;
|
||||
|
||||
auto lpMinMaxInfo = reinterpret_cast<LPMINMAXINFO>(lParam);
|
||||
lpMinMaxInfo->ptMinTrackSize.x = _calculateTotalSize(true, minimumWidth * scale, nonClientSizeScaled.cx);
|
||||
lpMinMaxInfo->ptMinTrackSize.y = _calculateTotalSize(false, minimumHeight * scale, nonClientSizeScaled.cy);
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Helper function that calculates a singe dimension value, given initialWindow and nonClientSizes
|
||||
// Arguments:
|
||||
// - isWidth: parameter to pass to SnapDimensionCallback.
|
||||
// True if the method is invoked for width computation, false if for height.
|
||||
// - clientSize: the size of the client area (already)
|
||||
// - nonClientSizeScaled: the exclusive non-client size (already scaled)
|
||||
// Return Value:
|
||||
// - The total dimension
|
||||
long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize, const long nonClientSize)
|
||||
{
|
||||
return gsl::narrow_cast<int>(_pfnSnapDimensionCallback(isWidth, gsl::narrow_cast<float>(clientSize)) + nonClientSize);
|
||||
}
|
||||
|
||||
[[nodiscard]] LRESULT IslandWindow::MessageHandler(UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
_OnGetMinMaxInfo(wparam, lparam);
|
||||
return 0;
|
||||
}
|
||||
case WM_CREATE:
|
||||
{
|
||||
_HandleCreateWindow(wparam, lparam);
|
||||
|
||||
@@ -74,7 +74,15 @@ protected:
|
||||
|
||||
LONG _getDesiredWindowStyle() const;
|
||||
|
||||
void _OnGetMinMaxInfo(const WPARAM wParam, const LPARAM lParam);
|
||||
long _calculateTotalSize(const bool isWidth, const long clientSize, const long nonClientSize);
|
||||
|
||||
private:
|
||||
// This minimum width allows for width the tabs fit
|
||||
static constexpr long minimumWidth = 460L;
|
||||
|
||||
// We run with no height requirement for client area,
|
||||
// though the total height will take into account the non-client area
|
||||
// and the requirements of components hosted in the client area
|
||||
static constexpr long minimumHeight = 0L;
|
||||
};
|
||||
|
||||
@@ -95,14 +95,14 @@
|
||||
|
||||
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
|
||||
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets" Condition="Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.1-rc\build\native\Microsoft.VCRTForwarders.140.targets" Condition="Exists('..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.1-rc\build\native\Microsoft.VCRTForwarders.140.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.1-rc\build\native\Microsoft.VCRTForwarders.140.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.VCRTForwarders.140.1.0.1-rc\build\native\Microsoft.VCRTForwarders.140.targets'))" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.201017.1" targetFramework="native" />
|
||||
<package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.0.0" targetFramework="native" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.5.0-prerelease.200609001" targetFramework="native" />
|
||||
<package id="Microsoft.UI.Xaml" version="2.5.0-prerelease.201202003" targetFramework="native" />
|
||||
<package id="Microsoft.VCRTForwarders.140" version="1.0.1-rc" targetFramework="native" />
|
||||
<package id="Terminal.ThemeHelpers" version="0.2.200324001" targetFramework="native" />
|
||||
</packages>
|
||||
@@ -69,5 +69,5 @@ TRACELOGGING_DECLARE_PROVIDER(g_hWindowsTerminalProvider);
|
||||
// For commandline argument processing
|
||||
#include <shellapi.h>
|
||||
#include <processenv.h>
|
||||
|
||||
#include <WinUser.h>
|
||||
#include "til.h"
|
||||
|
||||
@@ -73,14 +73,14 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" />
|
||||
<Import Project="..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets" Condition="Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\build\native\Microsoft.UI.Xaml.targets'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.props'))" />
|
||||
<Error Condition="!Exists('..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Toolkit.Win32.UI.XamlApplication.6.0.0\build\native\Microsoft.Toolkit.Win32.UI.XamlApplication.targets'))" />
|
||||
</Target>
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Microsoft.Terminal.Wpf
|
||||
|
||||
NativeMethods.TerminalSetTheme(this.terminal, theme, fontFamily, fontSize, (int)dpiScale.PixelsPerInchX);
|
||||
|
||||
if (!this.RenderSize.IsEmpty)
|
||||
if (!this.RenderSize.IsEmpty && !this.TerminalControlSize.IsEmpty)
|
||||
{
|
||||
this.Resize(this.TerminalControlSize);
|
||||
}
|
||||
|
||||
@@ -143,11 +143,16 @@ namespace Microsoft.Terminal.Wpf
|
||||
{
|
||||
var dpiScale = VisualTreeHelper.GetDpi(this);
|
||||
|
||||
// termContainer requires scaled sizes.
|
||||
var newSizeWidth = (sizeInfo.NewSize.Width - this.scrollbar.ActualWidth) * dpiScale.DpiScaleX;
|
||||
newSizeWidth = newSizeWidth < 0 ? 0 : newSizeWidth;
|
||||
|
||||
var newSizeHeight = sizeInfo.NewSize.Height * dpiScale.DpiScaleY;
|
||||
newSizeHeight = newSizeHeight < 0 ? 0 : newSizeHeight;
|
||||
|
||||
this.termContainer.TerminalControlSize = new Size()
|
||||
{
|
||||
Width = (sizeInfo.NewSize.Width - this.scrollbar.ActualWidth) * dpiScale.DpiScaleX,
|
||||
Height = sizeInfo.NewSize.Height * dpiScale.DpiScaleY,
|
||||
Width = newSizeWidth,
|
||||
Height = newSizeHeight,
|
||||
};
|
||||
|
||||
if (!this.AutoResize)
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<!-- From Microsoft.UI.Xaml.targets -->
|
||||
<Native-Platform Condition="'$(Platform)' == 'Win32'">x86</Native-Platform>
|
||||
<Native-Platform Condition="'$(Platform)' != 'Win32'">$(Platform)</Native-Platform>
|
||||
<_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.200609001\runtimes\win10-$(Native-Platform)\native\"</_MUXBinRoot>
|
||||
<_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.5.0-prerelease.201202003\runtimes\win10-$(Native-Platform)\native\"</_MUXBinRoot>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemDefinitionGroup>
|
||||
|
||||
@@ -524,7 +524,24 @@ void ApiRoutines::GetLargestConsoleWindowSizeImpl(const SCREEN_INFORMATION& cont
|
||||
COORD const coordScreenBufferSize = screenInfo.GetBufferSize().Dimensions();
|
||||
if (size.X != coordScreenBufferSize.X || size.Y != coordScreenBufferSize.Y)
|
||||
{
|
||||
RETURN_NTSTATUS(screenInfo.ResizeScreenBuffer(size, TRUE));
|
||||
RETURN_IF_NTSTATUS_FAILED(screenInfo.ResizeScreenBuffer(size, TRUE));
|
||||
}
|
||||
|
||||
// Make sure the viewport doesn't now overflow the buffer dimensions.
|
||||
auto overflow = screenInfo.GetViewport().BottomRightExclusive() - screenInfo.GetBufferSize().Dimensions();
|
||||
if (overflow.X > 0 || overflow.Y > 0)
|
||||
{
|
||||
overflow = { std::max<SHORT>(overflow.X, 0), std::max<SHORT>(overflow.Y, 0) };
|
||||
RETURN_IF_NTSTATUS_FAILED(screenInfo.SetViewportOrigin(false, -overflow, false));
|
||||
}
|
||||
|
||||
// And also that the cursor position is clamped within the buffer boundaries.
|
||||
auto& cursor = screenInfo.GetTextBuffer().GetCursor();
|
||||
auto clampedCursorPosition = cursor.GetPosition();
|
||||
screenInfo.GetBufferSize().Clamp(clampedCursorPosition);
|
||||
if (clampedCursorPosition != cursor.GetPosition())
|
||||
{
|
||||
cursor.SetPosition(clampedCursorPosition);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
@@ -620,6 +637,23 @@ void ApiRoutines::GetLargestConsoleWindowSizeImpl(const SCREEN_INFORMATION& cont
|
||||
// (see https://msdn.microsoft.com/en-us/library/windows/desktop/ms686125(v=vs.85).aspx and DoSrvSetConsoleWindowInfo)
|
||||
// Note that it also doesn't set cursor position.
|
||||
|
||||
// However, we do need to make sure the viewport doesn't now overflow the buffer dimensions.
|
||||
auto overflow = context.GetViewport().BottomRightExclusive() - context.GetBufferSize().Dimensions();
|
||||
if (overflow.X > 0 || overflow.Y > 0)
|
||||
{
|
||||
overflow = { std::max<SHORT>(overflow.X, 0), std::max<SHORT>(overflow.Y, 0) };
|
||||
RETURN_IF_NTSTATUS_FAILED(context.SetViewportOrigin(false, -overflow, false));
|
||||
}
|
||||
|
||||
// And also that the cursor position is clamped within the buffer boundaries.
|
||||
auto& cursor = context.GetTextBuffer().GetCursor();
|
||||
auto clampedCursorPosition = cursor.GetPosition();
|
||||
context.GetBufferSize().Clamp(clampedCursorPosition);
|
||||
if (clampedCursorPosition != cursor.GetPosition())
|
||||
{
|
||||
cursor.SetPosition(clampedCursorPosition);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
CATCH_RETURN();
|
||||
|
||||
@@ -276,7 +276,7 @@ const std::vector<Microsoft::Console::Render::RenderOverlay> RenderData::GetOver
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - true if the cursor should be drawn twice as wide as usual
|
||||
bool RenderData::IsCursorDoubleWidth() const noexcept
|
||||
bool RenderData::IsCursorDoubleWidth() const
|
||||
{
|
||||
const CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
|
||||
return gci.GetActiveOutputBuffer().CursorIsDoubleWidth();
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
CursorType GetCursorStyle() const noexcept override;
|
||||
ULONG GetCursorPixelWidth() const noexcept override;
|
||||
COLORREF GetCursorColor() const noexcept override;
|
||||
bool IsCursorDoubleWidth() const noexcept override;
|
||||
bool IsCursorDoubleWidth() const override;
|
||||
|
||||
bool IsScreenReversed() const noexcept override;
|
||||
|
||||
|
||||
@@ -2146,7 +2146,7 @@ void SCREEN_INFORMATION::SetViewport(const Viewport& newViewport,
|
||||
}
|
||||
|
||||
// do adjustments on a copy that's easily manipulated.
|
||||
SMALL_RECT srCorrected = newViewport.ToInclusive();
|
||||
SMALL_RECT srCorrected = newViewport.ToExclusive();
|
||||
|
||||
if (srCorrected.Left < 0)
|
||||
{
|
||||
@@ -2160,16 +2160,16 @@ void SCREEN_INFORMATION::SetViewport(const Viewport& newViewport,
|
||||
}
|
||||
|
||||
const COORD coordScreenBufferSize = GetBufferSize().Dimensions();
|
||||
if (srCorrected.Right >= coordScreenBufferSize.X)
|
||||
if (srCorrected.Right > coordScreenBufferSize.X)
|
||||
{
|
||||
srCorrected.Right = coordScreenBufferSize.X;
|
||||
}
|
||||
if (srCorrected.Bottom >= coordScreenBufferSize.Y)
|
||||
if (srCorrected.Bottom > coordScreenBufferSize.Y)
|
||||
{
|
||||
srCorrected.Bottom = coordScreenBufferSize.Y;
|
||||
}
|
||||
|
||||
_viewport = Viewport::FromInclusive(srCorrected);
|
||||
_viewport = Viewport::FromExclusive(srCorrected);
|
||||
if (updateBottom)
|
||||
{
|
||||
UpdateBottom();
|
||||
|
||||
@@ -651,8 +651,12 @@ BOOL HandleMouseEvent(const SCREEN_INFORMATION& ScreenInfo,
|
||||
sDelta = GET_WHEEL_DELTA_WPARAM(wParam);
|
||||
}
|
||||
|
||||
if (HandleTerminalMouseEvent(MousePosition, Message, GET_KEYSTATE_WPARAM(wParam), sDelta))
|
||||
if (HandleTerminalMouseEvent(MousePosition, Message, LOWORD(GetControlKeyState(0)), sDelta))
|
||||
{
|
||||
// Use GetControlKeyState here to get the control state in console event mode.
|
||||
// This will ensure that we get ALT and SHIFT, the former of which is not available
|
||||
// through MK_ constants. We only care about the bottom 16 bits.
|
||||
|
||||
// GH#6401: Capturing the mouse ensures that we get drag/release events
|
||||
// even if the user moves outside the window.
|
||||
// HandleTerminalMouseEvent returns false if the terminal's not in VT mode,
|
||||
|
||||
@@ -186,8 +186,10 @@ public:
|
||||
wch = L'\x0';
|
||||
break;
|
||||
}
|
||||
// MK_SHIFT is ignored by the translator
|
||||
wch += (sModifierKeystate & MK_CONTROL) ? 0x08 : 0x00;
|
||||
// Use Any here with the multi-flag constants -- they capture left/right key state
|
||||
WI_UpdateFlag(wch, 0x04, WI_IsAnyFlagSet(sModifierKeystate, SHIFT_PRESSED));
|
||||
WI_UpdateFlag(wch, 0x08, WI_IsAnyFlagSet(sModifierKeystate, ALT_PRESSED));
|
||||
WI_UpdateFlag(wch, 0x10, WI_IsAnyFlagSet(sModifierKeystate, CTRL_PRESSED));
|
||||
return wch;
|
||||
}
|
||||
|
||||
@@ -222,8 +224,10 @@ public:
|
||||
result = 0;
|
||||
break;
|
||||
}
|
||||
// MK_SHIFT and MK_ALT is ignored by the translator
|
||||
result += (sModifierKeystate & MK_CONTROL) ? 0x08 : 0x00;
|
||||
// Use Any here with the multi-flag constants -- they capture left/right key state
|
||||
WI_UpdateFlag(result, 0x04, WI_IsAnyFlagSet(sModifierKeystate, SHIFT_PRESSED));
|
||||
WI_UpdateFlag(result, 0x08, WI_IsAnyFlagSet(sModifierKeystate, ALT_PRESSED));
|
||||
WI_UpdateFlag(result, 0x10, WI_IsAnyFlagSet(sModifierKeystate, CTRL_PRESSED));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -274,8 +278,8 @@ public:
|
||||
BEGIN_TEST_METHOD_PROPERTIES()
|
||||
// TEST_METHOD_PROPERTY(L"Data:uiButton", L"{WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_RBUTTONDOWN, WM_RBUTTONUP}")
|
||||
TEST_METHOD_PROPERTY(L"Data:uiButton", L"{0x0201, 0x0202, 0x0207, 0x0208, 0x0204, 0x0205}")
|
||||
// None, MK_SHIFT, MK_CONTROL
|
||||
TEST_METHOD_PROPERTY(L"Data:uiModifierKeystate", L"{0x0000, 0x0004, 0x0008}")
|
||||
// None, SHIFT, LEFT_CONTROL, RIGHT_ALT, RIGHT_ALT | LEFT_CONTROL
|
||||
TEST_METHOD_PROPERTY(L"Data:uiModifierKeystate", L"{0x0000, 0x0010, 0x0008, 0x0001, 0x0009}")
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
Log::Comment(L"Starting test...");
|
||||
@@ -357,7 +361,8 @@ public:
|
||||
BEGIN_TEST_METHOD_PROPERTIES()
|
||||
// TEST_METHOD_PROPERTY(L"Data:uiButton", L"{WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_RBUTTONDOWN, WM_RBUTTONUP}")
|
||||
TEST_METHOD_PROPERTY(L"Data:uiButton", L"{0x0201, 0x0202, 0x0207, 0x0208, 0x0204, 0x0205}")
|
||||
TEST_METHOD_PROPERTY(L"Data:uiModifierKeystate", L"{0x0000, 0x0004, 0x0008}")
|
||||
// None, SHIFT, LEFT_CONTROL, RIGHT_ALT, RIGHT_ALT | LEFT_CONTROL
|
||||
TEST_METHOD_PROPERTY(L"Data:uiModifierKeystate", L"{0x0000, 0x0010, 0x0008, 0x0001, 0x0009}")
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
Log::Comment(L"Starting test...");
|
||||
@@ -443,7 +448,8 @@ public:
|
||||
BEGIN_TEST_METHOD_PROPERTIES()
|
||||
// TEST_METHOD_PROPERTY(L"Data:uiButton", L"{WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_MOUSEMOVE}")
|
||||
TEST_METHOD_PROPERTY(L"Data:uiButton", L"{0x0201, 0x0202, 0x0207, 0x0208, 0x0204, 0x0205, 0x0200}")
|
||||
TEST_METHOD_PROPERTY(L"Data:uiModifierKeystate", L"{0x0000, 0x0004, 0x0008}")
|
||||
// None, SHIFT, LEFT_CONTROL, RIGHT_ALT, RIGHT_ALT | LEFT_CONTROL
|
||||
TEST_METHOD_PROPERTY(L"Data:uiModifierKeystate", L"{0x0000, 0x0010, 0x0008, 0x0001, 0x0009}")
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
Log::Comment(L"Starting test...");
|
||||
@@ -523,7 +529,8 @@ public:
|
||||
{
|
||||
BEGIN_TEST_METHOD_PROPERTIES()
|
||||
TEST_METHOD_PROPERTY(L"Data:sScrollDelta", L"{-120, 120, -10000, 32736}")
|
||||
TEST_METHOD_PROPERTY(L"Data:uiModifierKeystate", L"{0x0000, 0x0004, 0x0008}")
|
||||
// None, SHIFT, LEFT_CONTROL, RIGHT_ALT, RIGHT_ALT | LEFT_CONTROL
|
||||
TEST_METHOD_PROPERTY(L"Data:uiModifierKeystate", L"{0x0000, 0x0010, 0x0008, 0x0001, 0x0009}")
|
||||
END_TEST_METHOD_PROPERTIES()
|
||||
|
||||
Log::Comment(L"Starting test...");
|
||||
|
||||
@@ -133,8 +133,8 @@ constexpr unsigned int TerminalInput::s_GetPressedButton(const MouseButtonState
|
||||
// 11 - released (none)
|
||||
// Next three bits indicate modifier keys:
|
||||
// 0x04 - shift (This never makes it through, as our emulator is skipped when shift is pressed.)
|
||||
// 0x08 - ctrl
|
||||
// 0x10 - meta
|
||||
// 0x08 - meta
|
||||
// 0x10 - ctrl
|
||||
// 32 (x20) is added for "hover" events:
|
||||
// "For example, motion into cell x,y with button 1 down is reported as `CSI M @ CxCy`.
|
||||
// ( @ = 32 + 0 (button 1) + 32 (motion indicator) ).
|
||||
@@ -146,7 +146,7 @@ constexpr unsigned int TerminalInput::s_GetPressedButton(const MouseButtonState
|
||||
// Parameters:
|
||||
// - button - the message to decode.
|
||||
// - isHover - whether or not this is a hover event
|
||||
// - modifierKeyState - alt/ctrl/shift key hold state
|
||||
// - modifierKeyState - the modifier keys _in console format_
|
||||
// - delta - scroll wheel delta
|
||||
// Return value:
|
||||
// - the int representing the equivalent X button encoding.
|
||||
@@ -188,12 +188,10 @@ static constexpr int _windowsButtonToXEncoding(const unsigned int button,
|
||||
xvalue += 0x20;
|
||||
}
|
||||
|
||||
// Shift will never pass through to us, because shift is used by the host to skip VT mouse and use the default handler.
|
||||
// TODO: MSFT:8804719 Add an option to disable/remap shift as a bypass for VT mousemode handling
|
||||
// xvalue += (modifierKeyState & MK_SHIFT) ? 0x04 : 0x00;
|
||||
xvalue += (modifierKeyState & MK_CONTROL) ? 0x08 : 0x00;
|
||||
// Unfortunately, we don't get meta/alt as a part of mouse events. Only Ctrl and Shift.
|
||||
// xvalue += (modifierKeyState & MK_META) ? 0x10 : 0x00;
|
||||
// Use Any here with the multi-flag constants -- they capture left/right key state
|
||||
WI_UpdateFlag(xvalue, 0x04, WI_IsAnyFlagSet(modifierKeyState, SHIFT_PRESSED));
|
||||
WI_UpdateFlag(xvalue, 0x08, WI_IsAnyFlagSet(modifierKeyState, ALT_PRESSED));
|
||||
WI_UpdateFlag(xvalue, 0x10, WI_IsAnyFlagSet(modifierKeyState, CTRL_PRESSED));
|
||||
|
||||
return xvalue;
|
||||
}
|
||||
@@ -206,6 +204,7 @@ static constexpr int _windowsButtonToXEncoding(const unsigned int button,
|
||||
// See MSFT:19461988 and https://github.com/Microsoft/console/issues/296
|
||||
// Parameters:
|
||||
// - button - the message to decode.
|
||||
// - modifierKeyState - the modifier keys _in console format_
|
||||
// Return value:
|
||||
// - the int representing the equivalent X button encoding.
|
||||
static constexpr int _windowsButtonToSGREncoding(const unsigned int button,
|
||||
@@ -247,12 +246,10 @@ static constexpr int _windowsButtonToSGREncoding(const unsigned int button,
|
||||
xvalue += 0x20;
|
||||
}
|
||||
|
||||
// Shift will never pass through to us, because shift is used by the host to skip VT mouse and use the default handler.
|
||||
// TODO: MSFT:8804719 Add an option to disable/remap shift as a bypass for VT mousemode handling
|
||||
// xvalue += (modifierKeyState & MK_SHIFT) ? 0x04 : 0x00;
|
||||
xvalue += (modifierKeyState & MK_CONTROL) ? 0x08 : 0x00;
|
||||
// Unfortunately, we don't get meta/alt as a part of mouse events. Only Ctrl and Shift.
|
||||
// xvalue += (modifierKeyState & MK_META) ? 0x10 : 0x00;
|
||||
// Use Any here with the multi-flag constants -- they capture left/right key state
|
||||
WI_UpdateFlag(xvalue, 0x04, WI_IsAnyFlagSet(modifierKeyState, SHIFT_PRESSED));
|
||||
WI_UpdateFlag(xvalue, 0x08, WI_IsAnyFlagSet(modifierKeyState, ALT_PRESSED));
|
||||
WI_UpdateFlag(xvalue, 0x10, WI_IsAnyFlagSet(modifierKeyState, CTRL_PRESSED));
|
||||
|
||||
return xvalue;
|
||||
}
|
||||
|
||||
@@ -3,50 +3,36 @@
|
||||
|
||||
#include "precomp.h"
|
||||
#include "inc/Environment.hpp"
|
||||
#include "wil/token_helpers.h"
|
||||
|
||||
using namespace ::Microsoft::Console::Utils;
|
||||
|
||||
// We cannot use spand or not_null because we're dealing with \0\0-terminated buffers of unknown length
|
||||
#pragma warning(disable : 26481 26429)
|
||||
|
||||
// Function Description:
|
||||
// - Wraps win32's CreateEnvironmentBlock to return a smart pointer.
|
||||
EnvironmentBlockPtr Microsoft::Console::Utils::CreateEnvironmentBlock()
|
||||
{
|
||||
void* newEnvironmentBlock{ nullptr };
|
||||
auto processToken{ wil::open_current_access_token(TOKEN_QUERY | TOKEN_DUPLICATE) };
|
||||
if (!::CreateEnvironmentBlock(&newEnvironmentBlock, processToken.get(), FALSE))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return EnvironmentBlockPtr{ newEnvironmentBlock };
|
||||
}
|
||||
|
||||
// Function Description:
|
||||
// - Updates an EnvironmentVariableMapW with the current process's unicode
|
||||
// environment variables ignoring ones already set in the provided map.
|
||||
// Arguments:
|
||||
// - map: The map to populate with the current processes's environment variables.
|
||||
// - environmentBlock: Optional environment block to use when filling map. If omitted,
|
||||
// defaults to the current environment.
|
||||
// Return Value:
|
||||
// - S_OK if we succeeded, or an appropriate HRESULT for failing
|
||||
HRESULT Microsoft::Console::Utils::UpdateEnvironmentMapW(EnvironmentVariableMapW& map, void* environmentBlock) noexcept
|
||||
HRESULT Microsoft::Console::Utils::UpdateEnvironmentMapW(EnvironmentVariableMapW& map) noexcept
|
||||
try
|
||||
{
|
||||
wchar_t const* activeEnvironmentBlock{ static_cast<wchar_t const*>(environmentBlock) };
|
||||
LPWCH currentEnvVars{};
|
||||
auto freeCurrentEnv = wil::scope_exit([&] {
|
||||
if (currentEnvVars)
|
||||
{
|
||||
FreeEnvironmentStringsW(currentEnvVars);
|
||||
currentEnvVars = nullptr;
|
||||
}
|
||||
});
|
||||
|
||||
wil::unique_environstrings_ptr currentEnvVars;
|
||||
if (!activeEnvironmentBlock)
|
||||
{
|
||||
currentEnvVars.reset(::GetEnvironmentStringsW());
|
||||
RETURN_HR_IF_NULL(E_OUTOFMEMORY, currentEnvVars);
|
||||
activeEnvironmentBlock = currentEnvVars.get();
|
||||
}
|
||||
currentEnvVars = ::GetEnvironmentStringsW();
|
||||
RETURN_HR_IF_NULL(E_OUTOFMEMORY, currentEnvVars);
|
||||
|
||||
// Each entry is NULL-terminated; block is guaranteed to be double-NULL terminated at a minimum.
|
||||
for (wchar_t const* lastCh{ activeEnvironmentBlock }; *lastCh != '\0'; ++lastCh)
|
||||
for (wchar_t const* lastCh{ currentEnvVars }; *lastCh != '\0'; ++lastCh)
|
||||
{
|
||||
// Copy current entry into temporary map.
|
||||
const size_t cchEntry{ ::wcslen(lastCh) };
|
||||
|
||||
@@ -21,12 +21,9 @@ namespace Microsoft::Console::Utils
|
||||
}
|
||||
};
|
||||
|
||||
using EnvironmentBlockPtr = wil::unique_any<void*, decltype(::DestroyEnvironmentBlock), ::DestroyEnvironmentBlock>;
|
||||
[[nodiscard]] EnvironmentBlockPtr CreateEnvironmentBlock();
|
||||
|
||||
using EnvironmentVariableMapW = std::map<std::wstring, std::wstring, WStringCaseInsensitiveCompare>;
|
||||
|
||||
[[nodiscard]] HRESULT UpdateEnvironmentMapW(EnvironmentVariableMapW& map, void* environmentBlock = nullptr) noexcept;
|
||||
[[nodiscard]] HRESULT UpdateEnvironmentMapW(EnvironmentVariableMapW& map) noexcept;
|
||||
|
||||
[[nodiscard]] HRESULT EnvironmentMapToEnvironmentStringsW(EnvironmentVariableMapW& map,
|
||||
std::vector<wchar_t>& newEnvVars) noexcept;
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace Microsoft::Console::Types
|
||||
SHORT Height() const noexcept;
|
||||
SHORT Width() const noexcept;
|
||||
COORD Origin() const noexcept;
|
||||
COORD BottomRightExclusive() const noexcept;
|
||||
COORD EndExclusive() const noexcept;
|
||||
COORD Dimensions() const noexcept;
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ Abstract:
|
||||
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
#include <userenv.h>
|
||||
#include <combaseapi.h>
|
||||
#include <UIAutomation.h>
|
||||
#include <objbase.h>
|
||||
|
||||
@@ -137,6 +137,17 @@ COORD Viewport::Origin() const noexcept
|
||||
return { Left(), Top() };
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - Get a coord representing the bottom right of the viewport in exclusive terms.
|
||||
// Arguments:
|
||||
// - <none>
|
||||
// Return Value:
|
||||
// - the exclusive bottom right coordinates of this viewport.
|
||||
COORD Viewport::BottomRightExclusive() const noexcept
|
||||
{
|
||||
return { RightExclusive(), BottomExclusive() };
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
// - For Accessibility, get a COORD representing the end of this viewport in exclusive terms.
|
||||
// - This is needed to represent an exclusive endpoint in UiaTextRange that includes the last
|
||||
|
||||
@@ -440,10 +440,11 @@ void ConPtyTests::DiesOnClose()
|
||||
VERIFY_IS_TRUE(GetExitCodeProcess(piClient.hProcess, &dwExit));
|
||||
VERIFY_ARE_EQUAL(dwExit, (DWORD)STILL_ACTIVE);
|
||||
|
||||
// Stash the pty process, it'll get zero'd after the call to close
|
||||
const auto hConPtyProcess = pty.hConPtyProcess;
|
||||
// Duplicate the pty process, it'll get closed and zero'd after the call to close
|
||||
wil::unique_handle hConPtyProcess{};
|
||||
THROW_IF_WIN32_BOOL_FALSE(DuplicateHandle(GetCurrentProcess(), pty.hConPtyProcess, GetCurrentProcess(), hConPtyProcess.put(), 0, FALSE, DUPLICATE_SAME_ACCESS));
|
||||
|
||||
VERIFY_IS_TRUE(GetExitCodeProcess(hConPtyProcess, &dwExit));
|
||||
VERIFY_IS_TRUE(GetExitCodeProcess(hConPtyProcess.get(), &dwExit));
|
||||
VERIFY_ARE_EQUAL(dwExit, (DWORD)STILL_ACTIVE);
|
||||
|
||||
Log::Comment(NoThrowString().Format(L"Sleep a bit to let the process attach"));
|
||||
@@ -451,6 +452,6 @@ void ConPtyTests::DiesOnClose()
|
||||
|
||||
_ClosePseudoConsoleMembers(&pty);
|
||||
|
||||
GetExitCodeProcess(hConPtyProcess, &dwExit);
|
||||
GetExitCodeProcess(hConPtyProcess.get(), &dwExit);
|
||||
VERIFY_ARE_NOT_EQUAL(dwExit, (DWORD)STILL_ACTIVE);
|
||||
}
|
||||
|
||||
@@ -269,6 +269,7 @@ void _ClosePseudoConsoleMembers(_In_ PseudoConsole* pPty)
|
||||
}
|
||||
|
||||
TerminateProcess(pPty->hConPtyProcess, 0);
|
||||
CloseHandle(pPty->hConPtyProcess);
|
||||
pPty->hConPtyProcess = nullptr;
|
||||
}
|
||||
// Then take care of the reference handle.
|
||||
|
||||
Reference in New Issue
Block a user