- build(deps-dev): bump braces from 3.0.2 to 3.0.3
- build(deps-dev): bump @types/node from 16.18.96 to 16.18.101
- build(deps-dev): bump ts-jest from 29.1.2 to 29.1.5
- build(deps-dev): bump @typescript-eslint/parser from 7.6.0 to 7.14.1
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 7.6.0 to
7.14.1
- build(deps-dev): bump eslint-plugin-jest from 27.9.0 to 28.6.0
- Dependabot/npm and yarn/eslint plugin jest 28.6.0 fixes
Originally, the XAML resources were being applied on the TabView's
ResourceDictionary directly. However, high contrast mode has a few weird
scenarios as it basically reduces the color palette to just a few colors
to ensure high contrast. This PR now stores the resources onto the
ThemeDictionaries so that we have more control over the colors used.
## References and Relevant Issues
Closes#17913Closes#13067
## Validation Steps Performed
Compared the following scenarios to WinUI 2 gallery's TabView when in
High Contrast mode:
✅ (Un)selected tab
✅ hover over x of (un)selected tab
✅ hover over unselected tab
## Summary of the Pull Request
Adds a "Move tab" submenu to the tab's context menu. This submenu includes "move tab to new window", "move left", and "move right".
The new "move left/right" items are disabled if the tab can't be moved in a certain direction.'
Closes#17900
"HighContrast" is not a possible requested theme. So `_UpdateBackgroundForMica()` would force the settings UI to be light or dark. To fix this, we just check if we're in high contrast mode and, if so, we don't bother setting the requested theme.
Turns out that having the styles for the KeyChordText and ParsedCommandLineText be empty for high contrast mode caused the issue. Since we're already using theme resources for the colors, we automatically adjust properly to whatever the high contrast theme is (Thanks XAML!).
Bonus points:
- we didn't need the theme dictionaries anymore, so I just moved them to the ResourceDictionary directly
- ParsedCommandLineTextBlockStyle isn't used. So I removed it altogether.
Validated command palette with multiple high contrast themes. See PR thread for demo.
Closes#17914
Reading through our existing patterns for integer parsing, I noticed
that we'd be better off returning them as optionals.
This also allowed me to improve the implementation to support integers
all the way up to their absolute maximum/minimum.
Furthermore, I noticed that `prefix_split` was unsound:
If the last needle character was the last character in the remaining
text, the remaining text would be updated to an empty string view.
The caller would then have no idea if there's 1 more token left
or if the string is truly empty.
To solve this, this PR introduces an iterator class. This will allow
it to be used in our VT parser code.
## Summary of the Pull Request
This PR is to allow users to set a custom icon for entries in the new tab menu for "action" and "profile" type entries.
## References and Relevant Issues
This PR is in response to #18103
## Detailed Description of the Pull Request / Additional comments
It is now possible to specify an optional "icon" setting for any "action" or "profile" type entry in the "newTabMenu" JSON settings. When specified, this icon will be used as the menu icon for that action/profile in the new tab menu. If not specified, the action/profile definition's default icon will be used instead (if present).
The Cascadia settings schema ("doc/cascadia/profiles.schema.json") has been updated to reflect this.
## Validation Steps Performed
Manually tested with multiple combinations of icon settings:
- ActionEntry:
- valid path in action definition and new tab entry (renders new tab entry icon)
- valid path in action definition but no path in new tab entry (renders action definition icon)
- no path in action definition, valid path in new tab entry (renders new tab entry icon)
- invalid path in action definition, valid path in new tab entry (renders new tab entry icon)
- valid path in action definition, invalid path in new tab entry (renders no icon)
- invalid path in both (renders no icon)
- no path in both (renders no icon)
- ProfileEntry:
- valid path in new tab entry (renders new tab entry icon)
- no path in new tab entry (renders profile's default icon)
- invalid path in new tab entry (renders no icon)
## PR Checklist
- [x] Closes#18103
- [x] Tests added/passed
- [x] Documentation updated
- If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: [#808](https://github.com/MicrosoftDocs/terminal/pull/808)
- [x] Schema updated (if necessary)
I wrote a big comment next to the changes I made.
This is a redo of #17961 which had various issues.
Closes#17916Closes#18070
## Validation Steps Performed
* Pressing Enter within the input line doesn't crash ✅
* Type "Cour" and pick Courier New, press Save = Saved ✅
* Pick any other font from the dropdown, press Save = Saved ✅
* Picking an option dismisses focus but not to the tab row ✅
* The first time after launching the SUI, when the setting is still
unmodified, when you focus the box and pick an option,
it'll unfocus the box ✅
* When the setting is unmodified, and you pick the default
(Cascadia Mono), it'll still unfocus the box ✅
This adds a basic policy check for DisabledProfileSources, so that
organizations can easily disable certain profiles like the Azure one.
Closes#17964
## Validation Steps Performed
* Add a policy to disable Azure under HKCU. Disabled ✅
* Add a policy to disable nothing under HKLM. Enabled ✅
(...because it overrides the HKCU setting.)
The settings UI and settings model allow you to set the icon to "none"
to hide the icon (you can actually see this effect in the settings UI
when changing the value of the profile icon). However, during settings
validation, "none" is considered a file path, which is then failed to be
parsed, resulting in the icon being marked as invalid and immediately
clearing the value.
This PR fixes this issue by considering "none" to be an accepted value
during validation.
Related to #15843Closes#17943
## Validation Steps Performed
When an icon is set to "none", ...
✅ no more warning
✅ the icon is hidden
## Summary of the Pull Request
Adds a global Compatibility page to the settings UI. This page exposes
several existing settings and introduces a few new settings:
- compatibility.allowHeadless
- compatibility.isolatedMode
- compatibility.textMeasurement
- debugFeatures
This also adds a Terminal subpage for profiles in the settings UI. This
page includes:
- suppressApplicationTitle
- compatibility.input.forceVT
- compatibility.allowDECRQCRA
- answerbackMessage
Several smaller changes were accomplished as a part of this PR:
- `experimental.input.forceVT` was renamed to
`compatibility.input.forceVT`
- introduced the `compatibility.allowDECRQCRA` setting
- updated the schema for these new settings and
`compatibility.allowHeadless` (which was missing)
- add `Feature_DebugModeUI` feature flag to control if debug features
should be shown in the SUI
Verified accessible via Accessibility Insights
A part of #10000Closes#16672
## Summary of the Pull Request
Adds the following settings to the settings UI:
- $profile.RainbowSuggestions
- $profile.CellWidth
- $global.SearchWebDefaultQueryUrl
- $global.EnableColorSelection
- $global.ShowAdminShield
- $global.EnableUnfocusedAcrylic
Additionally, the following settings have graduated from experimental 🎓:
- $profile.rightClickContextMenu
Part of #10000
This fixes a lot of subtle issues:
* Avoid emitting another de-/iconify VT sequence when
we encounter a (de)iconify VT sequence during parsing.
* Avoid emitting a de-/iconify VT sequence when
a focus event is received on the signal pipe.
* Avoid emitting such sequences on startup.
* Avoid emitting multiple such sequences
when rapidly un-/focusing the window.
It's also a minor cleanup, because the `GA_ROOTOWNER` is not security
relevant. It was added because there was concern that someone can just
spawn a ConPTY session, tell it that it's focused, and spawn a child
which is now focused. But why would someone do that, when the console
IOCTLs to do so are not just publicly available but also documented?
I also disabled the IME window.
## Validation Steps Performed
* First:
```cpp
int main() {
for (bool show = false;; show = !show) {
printf(show ? "Show in 3s...\n" : "Hide in 3s...\n");
Sleep(3000);
ShowWindow(GetConsoleWindow(), show ? SW_SHOW : SW_HIDE);
}
}
```
* PowerShell 5's `Get-Credential` gains focus ✅
* `sleep 5; Get-Credential` and focus another app. WT should start
blinking in the taskbar. Restore it. The popup has focus ✅
* Run `:hardcopy` in vim: Window is shown centered at (0,0) ✖️
But that's okay because it does that already anyway ✅
* `Connect-AzAccount` doesn't crash PowerShell ✅
This PR adds support for the `S8C1T` and `S7C1T` commands, which enable
an application to choose whether the terminal should use C1 controls
when sending key sequences and query responses.
This also updates the `DOCS` command to set both the input and output
code pages. So when switched to ISO2022 mode, the C1 controls will be
transmitted as 8-bit, which is what legacy systems would be expecting.
## Detailed Description of the Pull Request / Additional comments
While adding the input code page support, I also reworked the way we
handle the code page reset in `RIS`. In the original implementation we
saved the active code page when the `DOCS` sequence was first used, and
that would become the default value for a reset.
With this PR I'm now saving the code pages whenever `SetConsoleCP` or
`SetConsoleOutputCP` is called, so those APIs now control what the
default values will be. This feels more consistent than the previous
approach. And this is how WSL sets its initial code page to UTF-8.
## Validation Steps Performed
I've added a couple of unit tests that check one of each applicable C1
control in the key sequences and query reports.
I also built myself a code page aware telnet client so I could log into
WSL in 8-bit mode, and confirmed that the C1 transmissions are working
as expected in vttest.
Closes#17931
Tests added/passed
`AutoSuggestBox` has a `SuggestionChosen` event and any reasonable
person would assume that this means one of the items was chosen.
But with WinUI it's raised whenever a suggestion is merely highlighted.
`QuerySubmitted` is the right event instead. Clearly that naming is
a lot better than `SuggestionChosen`, since the property to get the
chosen item is called `ChosenSuggestion`.
WinUI, like the unrelenting wilderness of a world indifferent to human
suffering, stands as a testament to the futility of human aspiration.
Closes#17916
## Validation Steps Performed
* Type "Casc"
* Move up/down with the arrow keys
* Neither the filtered list nor the text updates ✅
* Press Enter on an item
* Text updates ✅
Adds the following settings to the Interaction page under a Warnings subsection:
- ConfirmCloseAllTabs
- InputServiceWarning
- WarnAboutLargePaste
- WarnAboutMultiLinePaste
This also changes the JSON keys of those settings to be in the `warning` namespace as a QOL change for JSON users. We still handle the legacy keys, don't worry 😉.
#10000
This adds a "defaultInputScope" setting, hooks it up to our TSF,
and exposes it as a setting in the UI under the startup page.
In order to stay close with the other language setting, I moved that
one from the appearance to the startup page as well.
20 out of the 26 files in this PR are boilerplate unfortunately.
Closes#17816
## Validation Steps Performed
* Install and use the Chinese IME
* Launch WT
* Chinese input ✅
* Change setting to `alphanumericHalfWidth`
* Restart WT
* English input ✅
Without a VT "renderer" there's no implicit output anymore when
calling `ClearPseudoConsole`. The fix is trivial, but it works
slightly different from before: Previously, we would preserve
the line the cursor is on, while this PR doesn't do that.
I felt like there's not much merit in preserving the line,
because it may be a multi-line prompt which won't work with that.
Closes#17867
## Validation Steps Performed
Bind 3 different actions to the 3 variants of "Clear buffer"
and test them. They work. ✅
* Don't reset the position entirely when changing the needle
* Don't change the scroll position when output arrives
* Don't interfere with the search when output arrives constantly
Closes#17301
## Validation Steps Performed
* In pwsh, run `10000..20000 | % { sleep 0.25; $_ }`
* You can search for e.g. `1004` and it'll find 10 results. ✅
* You can scroll up and down past it and it won't snap back
when new output arrives. ✅
* `while ($true) { Write-Host -NoNewline "`e[Ha"; sleep 0.0001; }`
* You can cycle between the hits effortlessly. ✅ (This tests that
the constantly reset `OutputIdle` event won't interfere.)
* On input change, the focused result is near the previous one. ✅
Because `_layoutLine` would never return `column == columnLimit` for
control character visualizers, we'd get a deadlock in `_redisplay`,
as it tries to fill the line until it's full, but never achieve it.
Closes#17893
## Validation Steps Performed
* Press Ctrl-A to insert "^A"
* Press Home to get to the start of the prompt
* Press and hold "A" until the line wraps
* The line wraps and there's no deadlock ✅
## Summary of the Pull Request
The sixel parser has an internal buffer that holds the indexed-color
representation of the image, prior to it being translated to RGB. This
buffer only retains the section of the image that is within the visible
viewport, so we're continually erasing segments from the top of it when
the image is large enough to trigger a scroll.
But there is a problem that arises if the window or font is resized so
that the buffer needs to reflow, because that can result in the image
being pushed entirely offscreen. At that point the segment we're trying
to erase is actually larger than the buffer itself, which can end up
causing the terminal to crash
To fix this, we just need to check for an oversized erase attempt and
simply clear the buffer instead.
## Validation Steps Performed
I could easily reproduce this crash in Windows Terminal by resizing the
font while viewing an animated gif with img2sixel. With this PR applied
the crash no longer occurs.
## PR Checklist
- [x] Closes#17947
This just adds a quick registry check for `EnableHexNumpad`.
Depends on #17774Closes#17762 (again)
## Validation Steps Performed
* Alt + NumpadAdd + 221E doesn't do anything ✅
* Set the `EnableHexNumpad` registry key
* Restart
* Alt + NumpadAdd + 221E inserts ∞ ✅
## Summary of the Pull Request
Fixes some issues with truncated text in the settings UI when 200% text
scaling is applied.
For #17897, a minimum height was applied instead of a plain "height".
This ensures that the desired height is applied in general, but under
200% text scaling, we are allowed to grow past that, thus preventing the
truncation of the text.
For #17898, flyouts have a scroll viewer inside them by default. We
actually don't want the scroll viewer because that means the text will
appear "truncated" when in reality, the user is expected to notice the
small scrollbar and scroll horizontally (why that's the default, I will
never know). This PR introduces a new style that can be applied to these
flyouts to cause text wrapping instead of horizontal scrolling. Looked
through the app for any instances where this happens.
For #12006, simply changing the column width from a static value to
"auto" fixes the issue. Frankly, we care more about the text appearing
as a whole (and as whole words). The name of the actions wrap properly
anyways.
Closes#17897Closes#17898Closes#12006
## Summary of the Pull Request
This improves our `RIS` (hard reset) implementation, so it now also
resets any changes that are made to the color table and color aliases,
which is one of the things it's supposed to be doing.
## References and Relevant Issues
This is also a small step towards implementing the `OSC` sequences that
reset individual color table entries (issue #3719).
## Detailed Description of the Pull Request / Additional comments
The way this works is by having a second copy of the color table and
alias indices to hold the default values in the `RenderSettings` class.
This default set is initially populated at startup with the user's
chosen color scheme, but can also potentially be updated if the user
changes their settings while a session is already in progress.
When we receive an `RIS` request, we just copy the default values back
over the active settings, and refresh the renderer.
## Validation Steps Performed
I've manually tested both OpenConsole and Windows Terminal by changing
my color scheme programmatically, and then confirming that the original
colors are restored when an `RIS` sequence is received.
I've also added some basic unit tests that check both the color aliases
and color table are restored by `RIS`.
## PR Checklist
- [x] Tests added/passed
The underlying issue is that the "Pane" is used both as a model and as
a UI element and so a pane loses its content as soon as it is closed,
but the tree only gets reordered after the animation has finished.
This PR is truly just a hotfix, because it doesn't solve this issue,
it only adds checks to the function that crashes.
Closes#17869Closes#17871
## Validation Steps Performed
* `Split pane` a few times
* Run the "Close all other panes" action
* Doesn't crash ✅
PackageES is deprecated by known scourge-on-earth OneBranch, and is now
the cause of some non-compliance.
I got permission from them to open-source it, so that's coming next.
For now, we can just depend on a package based on our code based on
theirs.
Tested and working for C++ (DLL, EXE), C#, NuGet and MSIX.
## Summary of the Pull Request
This commit fixes the middle mouse button handler. The `PointerReleased` callback is registered, but it is not operational because, on the Release event, the mouse button is no longer pressed. We need to track its state and act accordingly.
Issue was introduced by commit 05e7ea1423ede8ee67c3462fb04538fae5c9f9b2, which changed the event handler from `PointerPressed` to `PointerReleased`, rendering it inoperative. Instead, the default handler is used. The main issue is that when the close button is hidden with the `showCloseButton` option, the default handler no longer closes the tab on middle mouse clicks.
Also made it consistent with the Settings tab, which was never converted to `PointerReleased` and is still handled with a custom handler.
## References and Relevant Issues
Related commit 05e7ea1423ede8ee67c3462fb04538fae5c9f9b2
## Validation Steps Performed
I've been using this commit locally for quite some time, figured out I might as well share it.
Added tab color indicator for the tab switch menu. Tab color indicators
have the same color as the background color of the tabs. If a tab has
the default background color, the indicator is not shown in the tab
switch menu.
Closes#17465
By translating the clip rectangle into a source-relative coordinate
space we can calculate the intersection that must be copied
much much more easily. I should've done that from the start.
Closes#17801
## Validation Steps Performed
* Test code provided in #17801
Under ConPTY we don't load any user settings. `SetUpConsole` notes:
> If we are [ConPTY], we don't want to load any user settings,
> because that could result in some strange rendering results [...]
This enables deduplication by default, which I figured wouldn't cause
any regressions since it's a user-controllable setting anyway, while
it's clearly something the average user wants enabled, for the same
reason that PSReadLine has HistoryNoDuplicates enabled by default.
Closes#17797
## Validation Steps Performed
* Launch conhost, enter 2 commands, press F7, select the older one,
press Enter, press F7. 2 entries ✅
* Launch WT, enter 2 commands, press F7, select the older one,
press Enter, press F7. 2 entries ✅
`GetChar` checks if the vkey is VK_ESCAPE. `CharToKeyEvents` however
tries really hard to figure out the vkeys of all characters.
To avoid these issues all we need to do is to simply use the existing
`WriteString` function we already use for all other VT responses.
If it's good for conhost responses, it's good for ConPTY responses.
Additionally, this removes another `IsVtInputEnabled` which was
redundant with `WriteString` which worked exactly the same internally.
Closes#17813Closes#17851
Probably also related to #17823
## Validation Steps Performed
* Wrote a small app to send and receive a DA1 request. It works ✅
* WSL already worked to begin with (and still works now) ✅
* No double-encoding of mouse input events ✅
## Summary of the Pull Request
When an app makes a VT request that returns a `DCS` response, and it
hasn't also enabled VT input mode, the new passthrough implementation
loses that response. All the app receives is an `Alt`+`\` key press
triggered by the `ST` terminator. This PR fixes that issue.
## References and Relevant Issues
This is one of the unresolved issues tracked in #17643.
## Detailed Description of the Pull Request / Additional comments
The way `DCS` sequences are handled in the input state machine engine is
by returning a nullptr from `ActionDcsDispatch`, which tells the state
machine to ignore that content. But the sequence is still buffered, and
when the `ST` terminator is eventually received, that buffer is flushed,
which passes the whole thing through to the app.
Originally this only worked when VT input mode was enabled, otherwise
the `ST` sequence is converted into a key press, and the buffered `DCS`
content is lost. The way it works now is we set a flag when the `DCS`
introducer is received, and if that flag is set when the `ST` arrives,
we know to trigger a flush rather a key press.
## Validation Steps Performed
I've tested a `DA3` request from the cmd shell (i.e. `echo ^[[=c`), and
confirmed that now works as expected. I've also hacked Windows Terminal
to disable win32-input mode, so I could check how it works with conpty
clients generating standard VT input, and confirmed that an `Alt`+`\`
keypress is still translated correctly.
Worked with @ekoschik on this one.
## Bug the first: the MSAL window `ixptools` spawns
> The auth prompt in pwsh.exe is disabling the terminal window while its
opened and re-enabling it when the window closes. BUT it is enabling
Terminal after dismissing itself, instead of before, which means
terminal is disabled when activated.
>
> Terminal wants focus on the ISLAND window (a grandchild; island is
parented to bridge, which is parented to terminal’s TLW). When it is
activated, it gets a `WM_SETFOCUS` (in response to DefWindowProc
`WM_ACTIVATE`). From `WM_SETFOCUS` it calls `SetFocus` on the bridge
window, and similarly the bridge calls `SetFocus` on the island.
>
> If the TLW is disabled, these `SetFocus` calls fail (see [this
check](#internal-link-redacted) in `SetFocus`). In the case above, this
leaves Terminal’s TLW as focus, and it doesn’t handle keyboard input.
Note that the window IS foreground/active, but because focus is not on
the island it doesn’t see the keyboard input. Another thing to note is
that clicking on the space to the right of the tabs does NOT revive
keyboard input, but clicking on the tabs or main area does.
> **I recommend having the TLW handle WM_ENABLE and call SetFocus on the
island window.**
And guess what, that works!
## Bug the second: When sublime text is the git `EDITOR`, it doesn't
toss focus back to the Terminal
> In this case, Sublime is calling SFW on the pseudo console window. I
don’t have its code, but it is presumably doing something like
SetForegroundWindow(GetConsoleWindow()). This queues an event to the
pseudo window, and when that event is processed the pseudo window
becomes the active and focus window on the queue (which is shared with
Terminal).
>
> The sublime window dismisses itself and does the above SFW call.
Dismissing immediately activates the Terminal TLW, which does the
triple-focus dance (TLW sets focus on itself, then bridge, then island).
This completes but is overwritten immediately when the pseudo window
activates itself. Note that the pseudo window is active at this point
(not the terminal window).
> **I recommend having the Pseudo console window handle WM_ACTIVATE by
calling SetFocus on the island window (and not passing the message to
DefWindowProc).**
And guess what, that works!
----
Closes#15956 (I did test this)
This might be related to #13388, we'll have folks try canary and check
Spacing marks are called so, because they have a positive advance
width, unlike their non-spacing neighbors (as the name indicates).
After this we stop assigning such gc=Mc codepoints a zero width.
Closes#17810