Compare commits

...

2 commits

Author SHA1 Message Date
Mike Griese da6dc0693c fixes #411 2019-09-19 11:46:32 -05:00
Mike Griese 311c4e13a5 Add hidden to the defaults, the userDefaults, and the autogenerated stubs
fixes #2795
2019-09-18 09:20:43 -05:00
6 changed files with 53 additions and 7 deletions

View file

@ -29,6 +29,7 @@ Properties listed below are specific to each unique profile.
| `fontFace` | _Required_ | 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. |
| `fontSize` | _Required_ | Integer | `12` | Sets the font size. |
| `guid` | _Required_ | String | | Unique identifier of the profile. Written in registry format: `"{00000000-0000-0000-0000-000000000000}"`. |
| `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 dynamicially generated profiles, while leaving them in your settings file. |
| `historySize` | _Required_ | Integer | `9001` | The number of lines above the ones displayed in the window you can scroll back to. |
| `name` | _Required_ | String | `PowerShell Core` | Name of the profile. Displays in the dropdown menu. <br>Additionally, this value will be used as the "title" to pass to the shell on startup. Some shells (like `bash`) may choose to ignore this initial value, while others (`cmd`, `powershell`) may use this value over the lifetime of the application. This "title" behavior can be overriden by using `tabTitle`. |
| `padding` | _Required_ | String | `8, 8, 8, 8` | Sets the padding around the text within the window. Can have three different formats: `"#"` sets the same padding for all sides, `"#, #"` sets the same padding for left-right and top-bottom, and `"#, #, #, #"` sets the padding individually for left, top, right, and bottom. |
@ -148,20 +149,20 @@ The most useful URI schemes to remember when customizing background images and i
### Icons
Terminal displays icons for each of your profiles which Terminal generates for any built-in shells - PowerShell Core, PowerShell, and any installed Linux/WSL distros. Each profile refers to a stock icon via the `ms-appx` URI Scheme.
> ⚠ Note: Do not rely on the files referenced by the `ms-appx` URI Scheme - they are considered an internal implementation detail and may change name/location or may be omitted in the future.
> ⚠ Note: Do not rely on the files referenced by the `ms-appx` URI Scheme - they are considered an internal implementation detail and may change name/location or may be omitted in the future.
You can refer to you own icons if you wish, e.g.:
```json
```json
"icon" : "C:\\Users\\richturn\\OneDrive\\WindowsTerminal\\icon-ubuntu-32.png",
```
> 👉 Tip: Icons should be sized to 32x32px in an appropriate raster image format (e.g. .PNG, .GIF, or .ICO) to avoid having to scale your icons during runtime (causing a noticeable delay and loss of quality.)
### Custom Background Images
You can apply a background image to each of your profiles, allowing you to configure/brand/style each of your profiles independently from one another if you wish.
You can apply a background image to each of your profiles, allowing you to configure/brand/style each of your profiles independently from one another if you wish.
To do so, specify your preferred `backgroundImage`, position it using `backgroundImageAlignment`, set its opacity with `backgroundImageOpacity`, and/or specify how your image fill the available space using `backgroundImageStretchMode`.
To do so, specify your preferred `backgroundImage`, position it using `backgroundImageAlignment`, set its opacity with `backgroundImageOpacity`, and/or specify how your image fill the available space using `backgroundImageStretchMode`.
For example:
```json

View file

@ -266,7 +266,9 @@ Json::Value Profile::ToJson() const
Json::Value root = GenerateStub();
///// Profile-specific settings /////
root[JsonKey(HiddenKey)] = _hidden;
// As of #2795, all profile-specific settings were moved to GenerateStub. If
// any new profiles-specific settings are added, they should probably be
// added here instead of in that method.
///// Core Settings /////
if (_defaultForeground)
@ -448,6 +450,8 @@ Json::Value Profile::GenerateStub() const
stub[JsonKey(SourceKey)] = winrt::to_string(_source.value());
}
stub[JsonKey(HiddenKey)] = _hidden;
return stub;
}

View file

@ -15,6 +15,7 @@
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false,
"startingDirectory": "%USERPROFILE%",
"background": "#012456",
"closeOnExit": true,
@ -33,6 +34,7 @@
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false,
"startingDirectory": "%USERPROFILE%",
"closeOnExit": true,
"colorScheme": "Campbell",

View file

@ -10,13 +10,15 @@
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe"
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe"
"commandline": "cmd.exe",
"hidden": false
}
],

View file

@ -68,6 +68,9 @@ SCREEN_INFORMATION::SCREEN_INFORMATION(
LineChar[3] = UNICODE_BOX_DRAW_LIGHT_VERTICAL;
LineChar[4] = UNICODE_BOX_DRAW_LIGHT_UP_AND_RIGHT;
LineChar[5] = UNICODE_BOX_DRAW_LIGHT_UP_AND_LEFT;
// Check if VT mode is enabled. Note that this can be true w/o calling
// SetConsoleMode, if VirtualTerminalLevel is set to !=0 in the registry.
const CONSOLE_INFORMATION& gci = ServiceLocator::LocateGlobals().getConsoleInformation();
if (gci.GetVirtTermLevel() != 0)
{
@ -132,6 +135,16 @@ SCREEN_INFORMATION::~SCREEN_INFORMATION()
const NTSTATUS status = pScreen->_InitializeOutputStateMachine();
if (pScreen->InVTMode())
{
// microsoft/terminal#411: If VT mode is enabled, lets construct the
// VT tab stops. Without this line, if a user has
// VirtualTerminalLevel set, then
// SetConsoleMode(ENABLE_VIRTUAL_TERMINAL_PROCESSING) won't set our
// tab stops, because we're never going from vt off -> on
pScreen->SetDefaultVtTabStops();
}
if (NT_SUCCESS(status))
{
*ppScreen = pScreen;

View file

@ -180,6 +180,8 @@ class ScreenBufferTests
TEST_METHOD(RestoreDownAltBufferWithTerminalScrolling);
TEST_METHOD(ClearAlternateBuffer);
TEST_METHOD(InitializeTabStopsInVTMode);
};
void ScreenBufferTests::SingleAlternateBufferCreationTest()
@ -4347,3 +4349,25 @@ void ScreenBufferTests::ClearAlternateBuffer()
VerifyText(siMain.GetTextBuffer());
}
void ScreenBufferTests::InitializeTabStopsInVTMode()
{
// This is a test for microsoft/terminal#1189. Refer to that issue for more
// context
auto& g = ServiceLocator::LocateGlobals();
auto& gci = g.getConsoleInformation();
VERIFY_IS_FALSE(gci.GetActiveOutputBuffer().AreTabsSet());
// Enable VT mode before we construct the buffer. This emulates setting the
// VirtualTerminalLevel reg key before launching the console.
gci.SetVirtTermLevel(1);
// Clean up the old buffer, and re-create it. This new buffer will be
// created as if the VT mode was always on.
m_state->CleanupGlobalScreenBuffer();
m_state->PrepareGlobalScreenBuffer();
VERIFY_IS_TRUE(gci.GetActiveOutputBuffer().AreTabsSet());
}