Skip to content

Commit

Permalink
Merge branch 'master' into dev/miniksa/tmux_draw
Browse files Browse the repository at this point in the history
  • Loading branch information
miniksa committed Mar 27, 2020
2 parents e42965c + d7123d5 commit 8560b2c
Show file tree
Hide file tree
Showing 34 changed files with 1,499 additions and 512 deletions.
2 changes: 2 additions & 0 deletions .github/actions/spell-check/dictionary/math.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
powf
sqrtf
1 change: 1 addition & 0 deletions .github/actions/spell-check/dictionary/microsoft.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ microsoft
microsoftonline
osgvsowi
powershell
tdbuildteamid
visualstudio
3 changes: 3 additions & 0 deletions .github/actions/spell-check/dictionary/names.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Illhardt
jantari
jerrysh
Kaiyu
kimwalisch
KMehrain
Kourosh
kowalczyk
Expand Down Expand Up @@ -45,7 +46,9 @@ Somuah
sonph
sonpham
stakx
Walisch
Wirt
Wojciech
zadjii
Zamor
Zoey
Expand Down
9 changes: 9 additions & 0 deletions .github/actions/spell-check/whitelist/whitelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ Clcompile
CLE
cleartype
CLICKACTIVE
clickdown
climits
clipbrd
CLIPCHILDREN
Expand Down Expand Up @@ -595,6 +596,7 @@ deff
DEFFACE
defing
DEFPUSHBUTTON
defterm
DELAYLOAD
deletable
DELETEONRELEASE
Expand Down Expand Up @@ -1143,10 +1145,12 @@ INITDIALOG
initguid
INITMENU
inl
INLINEPREFIX
Inlines
INotify
inout
INPATHROOT
Inplace
inproc
inputdev
Inputkeyinfo
Expand Down Expand Up @@ -1282,6 +1286,7 @@ LEFTALIGN
LEFTSHIFT
len
lhs
libpopcnt
LIMITTEXT
LINEDOWN
LINESELECTION
Expand Down Expand Up @@ -1486,6 +1491,7 @@ msixbundle
msrc
msvcrt
MSVS
msys
msysgit
mui
Mul
Expand Down Expand Up @@ -1781,6 +1787,7 @@ pid
pidl
PIDLIST
pii
pinam
pinvoke
pipename
pipestr
Expand Down Expand Up @@ -2206,6 +2213,8 @@ SOLIDBOX
Solutiondir
somefile
sourced
SOURCESDIRECTORY
SPACEBAR
spammy
spand
Spc
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Spell checking
on:
push:
branches:
- "*"
tags-ignore:
- "*"
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '15 * * * *'
Expand Down
2 changes: 1 addition & 1 deletion doc/cascadia/SettingsSchema.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Properties listed below are specific to each unique profile.
| `cursorColor` | Optional | String | | Sets the cursor color of the profile. Overrides `cursorColor` set in color scheme if `colorscheme` is set. Uses hex color format: `"#rrggbb"`. |
| `cursorHeight` | Optional | Integer | | Sets the percentage height of the cursor starting from the bottom. Only works when `cursorShape` is set to `"vintage"`. Accepts values from 25-100. |
| `cursorShape` | Optional | String | `bar` | Sets the cursor shape for the profile. Possible values: `"vintage"` ( ▃ ), `"bar"` ( ┃ ), `"underscore"` ( ▁ ), `"filledBox"` ( █ ), `"emptyBox"` ( ▯ ) |
| `fontFace` | Optional | String | `Consolas` | Name of the font face used in the profile. We will try to fallback to Consolas if this can't be found or is invalid. |
| `fontFace` | Optional | String | `Cascadia Code` | Name of the font face used in the profile. We will try to fallback to Consolas if this can't be found or is invalid. |
| `fontSize` | Optional | Integer | `12` | Sets the font size. |
| `foreground` | Optional | String | | Sets the foreground color of the profile. Overrides `foreground` set in color scheme if `colorscheme` is set. Uses hex color format: `#rgb` or `"#rrggbb"`. |
| `hidden` | Optional | Boolean | `false` | If set to true, the profile will not appear in the list of profiles. This can be used to hide default profiles and dynamically generated profiles, while leaving them in your settings file. |
Expand Down
2 changes: 1 addition & 1 deletion doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@
"type": "boolean"
},
"fontFace": {
"default": "Consolas",
"default": "Cascadia Code",
"description": "Name of the font face used in the profile.",
"type": "string"
},
Expand Down
12 changes: 12 additions & 0 deletions doc/user-docs/ThirdPartyToolProfiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,16 @@ Assuming that you've installed MSYS2 into `C:/msys64`:
}
````

## Developer Command Prompt for Visual Studio

Assuming that you've installed VS 2019 Professional:

```json
{
"name" : "Developer Command Prompt for VS 2019",
"commandline" : "cmd.exe /k \"C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/Tools/VsDevCmd.bat\"",
"startingDirectory" : "%USERPROFILE%"
}
```

<!-- Adding a tool here? Make sure to add it in alphabetical order! -->
16 changes: 16 additions & 0 deletions doc/user-docs/UsingJsonSettings.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@ add the following to your keybindings:
This will _unbind_ <kbd>Ctrl+Shift+6</kbd>, allowing vim to use the keystroke
instead of the terminal.

### Binding multiple keys

You can have multiple key chords bound to the same action. To do this, simply
add multiple bindings for the same action. For example:

```json
"keybindings" :
[
{ "command": "copy", "keys": "ctrl+shift+c" },
{ "command": "copy", "keys": "ctrl+c" },
{ "command": "copy", "keys": "enter" }
]
```

In this snippet, all three of <kbd>ctrl+shift+c</kbd>, <kbd>ctrl+c</kbd> and <kbd>enter</kbd> are bound to `copy`.

## Profiles

A profile contains the settings applied when a new WT tab is opened. Each
Expand Down
144 changes: 144 additions & 0 deletions src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ namespace TerminalAppLocalTests

TEST_METHOD(TestTerminalArgsForBinding);

TEST_METHOD(FindMissingProfile);
TEST_METHOD(MakeSettingsForProfileThatDoesntExist);
TEST_METHOD(MakeSettingsForDefaultProfileThatDoesntExist);

TEST_METHOD(TestLayerProfileOnColorScheme);

TEST_METHOD(ValidateKeybindingsWarnings);
Expand Down Expand Up @@ -2094,6 +2098,146 @@ namespace TerminalAppLocalTests
}
}

void SettingsTests::FindMissingProfile()
{
// Test that CascadiaSettings::FindProfile returns null for a GUID that
// doesn't exist
const std::string settingsString{ R"(
{
"defaultProfile": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
"profiles": [
{
"name" : "profile0",
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}"
},
{
"name" : "profile1",
"guid": "{6239a42c-2222-49a3-80bd-e8fdd045185c}"
}
]
})" };
const auto settingsJsonObj = VerifyParseSucceeded(settingsString);
auto settings = CascadiaSettings::FromJson(settingsJsonObj);

const auto guid1 = Microsoft::Console::Utils::GuidFromString(L"{6239a42c-1111-49a3-80bd-e8fdd045185c}");
const auto guid2 = Microsoft::Console::Utils::GuidFromString(L"{6239a42c-2222-49a3-80bd-e8fdd045185c}");
const auto guid3 = Microsoft::Console::Utils::GuidFromString(L"{6239a42c-3333-49a3-80bd-e8fdd045185c}");

const Profile* const profile1 = settings->FindProfile(guid1);
const Profile* const profile2 = settings->FindProfile(guid2);
const Profile* const profile3 = settings->FindProfile(guid3);

VERIFY_IS_NOT_NULL(profile1);
VERIFY_IS_NOT_NULL(profile2);
VERIFY_IS_NULL(profile3);

VERIFY_ARE_EQUAL(L"profile0", profile1->GetName());
VERIFY_ARE_EQUAL(L"profile1", profile2->GetName());
}

void SettingsTests::MakeSettingsForProfileThatDoesntExist()
{
// Test that MakeSettings throws when the GUID doesn't exist
const std::string settingsString{ R"(
{
"defaultProfile": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
"profiles": [
{
"name" : "profile0",
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
"historySize": 1
},
{
"name" : "profile1",
"guid": "{6239a42c-2222-49a3-80bd-e8fdd045185c}",
"historySize": 2
}
]
})" };
const auto settingsJsonObj = VerifyParseSucceeded(settingsString);
auto settings = CascadiaSettings::FromJson(settingsJsonObj);

const auto guid1 = Microsoft::Console::Utils::GuidFromString(L"{6239a42c-1111-49a3-80bd-e8fdd045185c}");
const auto guid2 = Microsoft::Console::Utils::GuidFromString(L"{6239a42c-2222-49a3-80bd-e8fdd045185c}");
const auto guid3 = Microsoft::Console::Utils::GuidFromString(L"{6239a42c-3333-49a3-80bd-e8fdd045185c}");

try
{
auto terminalSettings = settings->BuildSettings(guid1);
VERIFY_ARE_NOT_EQUAL(nullptr, terminalSettings);
VERIFY_ARE_EQUAL(1, terminalSettings.HistorySize());
}
catch (...)
{
VERIFY_IS_TRUE(false, L"This call to BuildSettings should succeed");
}

try
{
auto terminalSettings = settings->BuildSettings(guid2);
VERIFY_ARE_NOT_EQUAL(nullptr, terminalSettings);
VERIFY_ARE_EQUAL(2, terminalSettings.HistorySize());
}
catch (...)
{
VERIFY_IS_TRUE(false, L"This call to BuildSettings should succeed");
}

VERIFY_THROWS(auto terminalSettings = settings->BuildSettings(guid3), wil::ResultException, L"This call to BuildSettings should fail");

try
{
const auto [guid, termSettings] = settings->BuildSettings(nullptr);
VERIFY_ARE_NOT_EQUAL(nullptr, termSettings);
VERIFY_ARE_EQUAL(1, termSettings.HistorySize());
}
catch (...)
{
VERIFY_IS_TRUE(false, L"This call to BuildSettings should succeed");
}
}

void SettingsTests::MakeSettingsForDefaultProfileThatDoesntExist()
{
// Test that MakeSettings _doesnt_ throw when we load settings with a
// defaultProfile that's not in the list, we validate the settings, and
// then call MakeSettings(nullopt). The validation should ensure that
// the default profile is something reasonable
const std::string settingsString{ R"(
{
"defaultProfile": "{6239a42c-3333-49a3-80bd-e8fdd045185c}",
"profiles": [
{
"name" : "profile0",
"guid": "{6239a42c-1111-49a3-80bd-e8fdd045185c}",
"historySize": 1
},
{
"name" : "profile1",
"guid": "{6239a42c-2222-49a3-80bd-e8fdd045185c}",
"historySize": 2
}
]
})" };
const auto settingsJsonObj = VerifyParseSucceeded(settingsString);
auto settings = CascadiaSettings::FromJson(settingsJsonObj);
settings->_ValidateSettings();

VERIFY_ARE_EQUAL(2u, settings->_warnings.size());
VERIFY_ARE_EQUAL(2u, settings->_profiles.size());
VERIFY_ARE_EQUAL(settings->_globals.GetDefaultProfile(), settings->_profiles.at(0).GetGuid());
try
{
const auto [guid, termSettings] = settings->BuildSettings(nullptr);
VERIFY_ARE_NOT_EQUAL(nullptr, termSettings);
VERIFY_ARE_EQUAL(1, termSettings.HistorySize());
}
catch (...)
{
VERIFY_IS_TRUE(false, L"This call to BuildSettings should succeed");
}
}

void SettingsTests::TestLayerProfileOnColorScheme()
{
Log::Comment(NoThrowString().Format(
Expand Down
Loading

1 comment on commit 8560b2c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New misspellings found, please review:

  • blankline
  • CCCC
  • DDDD
  • EEEE
  • modeline
  • QQQQ
To accept these changes, run the following commands
remove_obsolete_words=$(mktemp)
echo '#!/usr/bin/perl -ni
my $re=join "|", qw(
Impl
);
next if /^($re)(?:$| .*)/;
print;' > $remove_obsolete_words
chmod +x $remove_obsolete_words
for file in .github/actions/spell-check/whitelist/alphabet.txt .github/actions/spell-check/whitelist/web.txt .github/actions/spell-check/whitelist/whitelist.txt; do $remove_obsolete_words $file; done
rm $remove_obsolete_words
(
echo "
blankline
CCCC
DDDD
EEEE
impl
modeline
QQQQ
"
) | sort -u -f | perl -ne 'next unless /./; print' > new_whitelist.txt && mv new_whitelist.txt '.github/actions/spell-check/whitelist/8560b2cb3e952ab05bf0fc1bbaabaa2eacc74721.txt'

Please sign in to comment.