Compare commits

..

109 Commits

Author SHA1 Message Date
Carlos Zamora
8474eb8329 Update 'restart connection' action to reset internal state (#19971)
## Summary of the Pull Request
I was becoming frustrated with getting in a state where a CLI app (i.e.
Copilot CLI) enters some VT state (like mouse mode) then doesn't unset
it when it accidentally exits. I normally use "Restart connection" to
keep the buffer and connect again. Problem is, "restart connection"
didn't actually reset the internal state! So I would type and get a
bunch of lingering VT escape sequences. This bug is tracked over in
#18425 in a more generic way.

This fixes that bug by doing the following:
- update `ITermDispatch::HardReset()` -->`HardReset(bool erase)`
   - `erase=true` does what `HardReset()` already did
- `erase=false` skips over clearing the screen and resetting the cursor
position
- expose `HardReset(false)` as `HardResetWithoutErase()` by piping it up
through `Terminal` --> `ControlCore` --> `TermControl`
-  update the restart connection handler
- `TerminalPage::_restartPaneConnection()` now calls
`HardResetWithoutErase()` before setting the new connection
- this is also the same route for the "Enter to restart connection"
scenario (text displayed when connection ends)

Relevant notes from PR discussion:
- `PSEUDOCONSOLE_INHERIT_CURSOR` is passed into the new connection via
`_restartPaneConnection()` --> `_duplicateConnectionForRestart()` -->
`_CreateConnectionFromSettings(profile,
*controlSettings.DefaultSettings(), true)`

## Validation Steps Performed
- Used this to enter mouse tracking mode: `Write-Host -NoNewline
"`e[?1003h`e[?1006h"`
- mouse selection doesn't work as usual (expected)
- invoke "restart connection" action
- mouse selection works as usual

Closes #18425

(cherry picked from commit ec939aabda)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgpBL5w
Service-Version: 1.24
2026-04-02 19:15:01 -05:00
Carlos Zamora
d069ea6c29 Fix selection markers appearing on scroll (#20045)
## Summary of the Pull Request
Updates the scroll handler to check the selection mode before updating
the markers.

Introduced in #19974

## Validation Steps Performed
`ls` --> create selection --> scroll away and back
 keyboard selection: markers are present both times
 mouse selection: markers are missing both times

(cherry picked from commit 3104c8feb2)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgo0ICA
Service-Version: 1.24
2026-04-02 19:11:42 -05:00
jason
36bc972e88 Fix Korean IME arrow key inserting character at wrong position (#20039)
Fix a regression introduced in v1.24 where pressing an arrow key during
Korean IME composition caused the committed character to be inserted at
the wrong cursor position.

Before #19738, the Korean IME activated through IMM32 (excluded from TSF
by `TF_TMAE_UIELEMENTENABLEDONLY`) and was not affected by
`TermControl::_KeyHandler` forwarding keys to the PTY during
composition. After #19738, the Korean IME activates through TSF, making
a missing composition guard in `_KeyHandler` visible as a bug.

The sequence of events that causes the bug:

1. User presses Left arrow during active Korean IME composition (e.g.
composing `가`).
2. `_KeyHandler` calls `_TrySendKeyEvent(VK_LEFT)` which enqueues
`\x1b[D` to the PTY input queue. The cursor moves.
3. TSF processes the key. The Korean IME sees the arrow and ends the
composition.
4. `OnEndComposition` schedules `_doCompositionUpdate` with
`TF_ES_ASYNC`.
5. The async session fires, reads finalized text `가`, calls
`HandleOutput("가")`.
6. PTY processes `[\x1b[D, "가"]`: cursor moves left first, then `가` is
inserted at the wrong (already-moved) position.

The fix adds a guard before `_TrySendKeyEvent`, which mirrors the
existing behavior in conhost (windowio.cpp). When TSF has an active
composition, key events are not converted into input. The Korean IME
re-injects navigation and confirmation keys after the composition ends,
at which point `HasActiveComposition()` returns false and they are
forwarded normally.

**Historical note:** This guard was not needed before PR #17067 (v1.22)
because the old implementation used WinRT `CoreTextServices` via XAML
(`TSFInputControl.xaml`). The XAML framework intercepted composition key
events before `_KeyHandler`. The new custom Win32 TSF context in #17067
no longer does this. The bug was latent from v1.22 but only became
visible for Korean in v1.24 when #19738 removed
`TF_TMAE_UIELEMENTENABLEDONLY`.

## Validation Steps Performed

1. Open Windows Terminal with Korean IME (Dubeolsik layout).
2. Type `rk` to begin composing `가` (composition active, syllable not
yet committed).
3. Press the Left arrow key.
4. Before fix: `가` is inserted one cell to the left of the intended
position.
5. After fix: `가` is inserted at the correct position, then cursor moves
left.

Also verified:
- Normal Korean text input (typing without arrow keys) still works
correctly.
- Arrow key navigation when no composition is active still works
correctly.
- English and other IME input is not affected.

Closes #20038
Refs #19738

(cherry picked from commit 14f4271954)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgo0JpQ
Service-Version: 1.24
2026-03-31 17:44:53 -05:00
Dustin L. Howett
6fb0a8f513 conpty: remove accidental bool; use BOOL instead (#20035)
Closes #19102

(cherry picked from commit 01f8a4031d)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgoyJIM
Service-Version: 1.24
2026-03-31 17:23:53 -05:00
Dustin L. Howett
88a2f94f98 Reinstate the (apparently) load-bearing empty bracketed paste (#20037)
Some applications have come to rely on an "empty" bracketed paste packet
to indicate that the clipboard was _requested,_ but not sent. Some
agentic CLI tools use this to guess whether the clipboard contained e.g.
an image or otherwise unserializable data.

Apparently, gnome-terminal and VS Code do this; others as well (I tested
xterm, konsole, gnome-terminal and I can't remember which ones did and
which ones did not.)

Refs #19517

(cherry picked from commit 2870a702f4)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgotgA8
Service-Version: 1.24
2026-03-31 17:23:52 -05:00
gcrtnst
5f7237b0b9 Fix MSB4019 error in ConPTY nupkg (#20029)
This commit fixes the following error that occurs when attempting to use the
`Microsoft.Windows.Console.ConPTY` nupkg in a Visual C++ project:

    MSB4019: The imported project "C:\Microsoft.Windows.Console.ConPTY.props" was not found.

Based on the list of reserved and well-known properties, the property
`MSBuildThisProjectDirectory` does not appear to exist.  This PR
replaces it with the correct property, `MSBuildThisFileDirectory`.

(cherry picked from commit be5dcf8e7a)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgotQIo
Service-Version: 1.24
2026-03-30 17:44:38 -05:00
Sagar
09caec957a Fix copyOnSelect right-click overwriting clipboard with stale selection (#19943)
## Summary of the Pull Request
Fix `copyOnSelect` right-click paste overwriting the clipboard with a
stale selection instead of pasting the current clipboard contents.

## Detailed Description of the Pull Request / Additional comments
When `copyOnSelect` is enabled, the selected text is already copied to
the clipboard on left mouse button release in `PointerReleased`. The
selection is intentionally left visible as a visual reference (the
`_selectionNeedsToBeCopied` flag is set to `false` to track that the
copy already happened).

However, the right-click handler in `PointerPressed` unconditionally
called `CopySelectionToClipboard()` before pasting, ignoring both the
`copyOnSelect` setting and the `_selectionNeedsToBeCopied` flag. This
caused any still-visible selection to be re-copied to the clipboard,
overwriting whatever the user may have copied from another application
(or another terminal tab) in the meantime.

This change splits the right-click behavior based on the `copyOnSelect`
setting:
- **`copyOnSelect: true`** — Skip the redundant copy, clear the
selection, and paste directly. The text was already copied on mouse-up.
- **`copyOnSelect: false`** — Preserve existing behavior: copy the
selection (if any), clear it, and paste only if there was no selection
to copy.

## Validation Steps Performed
1. Set `"copyOnSelect": true` in `settings.json`.
2. Selected text in a terminal pane - verified it was copied to
clipboard on mouse-up.
3. Switched to Notepad, copied different text ("NEW TEXT").
4. Switched back to Terminal (selection still visible), right-clicked —
verified "NEW TEXT" was pasted, not the old selection.
5. Verified right-click with no active selection still pastes clipboard
contents.
6. Verified right-click immediately after selecting (no app switch)
pastes the just-selected text.
7. Set `"copyOnSelect": false` — verified right-click still copies
selection first, then pastes only when no selection exists (original
behavior unchanged).
8. Verified tab-switching with an active selection does not cause stale
clipboard overwrites on right-click.

## PR Checklist
Closes #14465 (dupe of #19942)

---------

Co-authored-by: Sagar Bhure <sagarbhure@microsoft.com>
(cherry picked from commit ad7b34e55f)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgn30Lw
Service-Version: 1.24
2026-03-30 17:44:36 -05:00
Leonard Hecker
96347843d6 Fix a deadlock during cooked reads (#19994)
Closes #19922

## Validation Steps Performed
* The repro now works as expected 
  (`CreatePseudoConsole({1,20})` + `WriteFile("キ")`)

(cherry picked from commit ddf514e99e)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgn2sRY
Service-Version: 1.24
2026-03-30 17:44:34 -05:00
Carlos Zamora
1ad126985e Fix selection markers disappearing after scrolling out of view (#19974)
## Summary of the Pull Request
Pretty straightforward

## Validation Steps Performed
 Selection markers are present after scrolling them out of view and
scrolling back

Closes #17135

(cherry picked from commit 14ee19fc27)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgna-WQ
Service-Version: 1.24
2026-03-30 17:44:33 -05:00
Dustin L. Howett
e0514ffc2d Suppress the invalid media error in Stable (#19969)
It's creating a lot of noise for folks, and it is not particularly
_helpful_ since it does not specify a location or even name which
resource failed to load or parse.

On stable, let's just silently ignore them.

Refs #19964

(cherry picked from commit 6d7fac999a)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgnTk_w
Service-Version: 1.24
2026-03-12 17:13:46 -05:00
Artem Lytkin
87e44682af control: focus terminal on click-drag while search is open (#19931)
## Summary
- Fix inability to copy terminal text via Ctrl+C when the search dialog
is open
- Root cause: click-and-drag doesn't call `Focus()` because `_focused`
is already `true` (set by the search box's bubbling GotFocus)
- Fix: also focus the terminal when the search box contains keyboard
focus

## Detailed Description of the Pull Request / Additional comments
When the search dialog is open and the user click-drags in the terminal
to select text, `_PointerPressedHandler` skips
`Focus(FocusState::Pointer)` because `_focused` is `true`. The
`_focused` flag is `true` because the `SearchBoxControl` is a child of
`TermControl` in the XAML visual tree, so `TermControl`'s
`_GotFocusHandler` fires (via bubbling `GotFocus`) when the search box's
`TextBox` gains focus, setting `_focused = true`.

The fix adds a `ContainsFocus()` check so that focus is explicitly moved
to the terminal when the search box has keyboard focus. This makes
click-drag behavior consistent with tap behavior (`_TappedHandler`
already focuses unconditionally) and uses the same `ContainsFocus()`
pattern already established at lines 1569 and 2366 in the same file.

## Validation Steps Performed
- Verified click-drag + Ctrl+C copies selected text when search dialog
is open
- Verified simple click (tap) in terminal while search is open still
works
- Verified clicking in the search box retains focus in the search box
- Verified typing in search box still works when it has focus
- Verified Escape still closes the search box
- Verified Ctrl+C with no selection while search is open doesn't break
- Code formatted with clang-format

## PR Checklist
 Closes #19908

(cherry picked from commit e2d51636cd)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgnN_t0
Service-Version: 1.24
2026-03-12 17:13:44 -05:00
Leonard Hecker
d310d07598 Make TSF initialization fully fallible (#19958)
Apparently, on some (internal) variants of Windows `TF_CategoryMgr`
can exist while `TF_DisplayAttributeMgr` is absent. This is likely
a variant configuration error, but we shouldn't crash anyway.

Closes MSFT-61309810

(cherry picked from commit 30b1456ffe)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgnOd-c
Service-Version: 1.24
2026-03-12 17:13:43 -05:00
Dustin L. Howett
bf21a15844 vpack: actually, we have to use a 3-segment version number (#19939)
Our last build failed because it tried to pass "10621.0" off as a
uint64. I didn't know it had to be a single number... so let's use the
3-component equivalent (which would have been 1.24.260303001)

(cherry picked from commit 5828fb5ce5)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgms2-I
Service-Version: 1.24
2026-03-12 17:13:41 -05:00
Dustin L. Howett
621e1846a1 Tidy up some of our Velocity features (#19605)
A few features were marked "always disabled" and then enabled in dev,
canary and preview. I simplified those to "always enabled" and disabled
in release instead. This required changes to Generate-FeatureStaging to
make it consider `WindowsInbox` a Release branding (which, honestly, it
always should have been.)

- Feature_DynamicSSHProfiles
- Feature_ShellCompletions
- Feature_SaveSnippet
- Feature_QuickFix

Feature_DisableWebSourceIcons was deprecated in #19143, but the XML file
never got the memo.

(cherry picked from commit afb4752102)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgmV4c4
Service-Version: 1.24
2026-02-27 13:51:16 -06:00
Dustin L. Howett
0e2ef991bf build: make the PGO build work again; upgrade nuget (#19810)
Two main changes:

- the build was failing for ARM64 because the build agents run out of
memory downloading artifacts; this is a known issue that nobody cares to
fix (and it pertains to using the x64 emulated agent host on native
arm64 machines)
   - deleting the PDBs shrinks the build output by 2500MB :P
- we had to switch to a new type of identity for publishing nuget
packages to our cross-org feed

I've verified that we get counts _and_ can even produce final PGO count
packages for both architectures!

(cherry picked from commit 8f3d1d8d01)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgmV1Qg
Service-Version: 1.24
2026-02-27 13:31:56 -06:00
Abhishek Giri
4f490d9216 Fix tab row acrylic material in unfocused windows (#19647)
## Summary
Fixes tab row losing acrylic material when window is unfocused, even
when "Allow acrylic material in unfocused windows" is enabled.

## References
Fixes #19544

## Changes
Modified `_updateThemeColors()` in `TerminalPage.cpp` to check both
window focus state and `EnableUnfocusedAcrylic` setting.

## Testing
- Verified acrylic persists when window loses focus (with setting
enabled)
- Verified acrylic removed when setting disabled (expected behavior)

---------

Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
(cherry picked from commit 28c98c5dc1)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgjj55A
Service-Version: 1.24
2026-02-27 13:21:51 -06:00
Dustin L. Howett
d8efeed904 conpty: Make sure ConDrv is loaded before doing ConPTY things (#19901)
Fixes #4750

(cherry picked from commit 0a3fbdefb3)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgmF1Kk
Service-Version: 1.24
2026-02-27 13:21:49 -06:00
PankajBhojwani
70b1eacf57 Check for command palette's visibility before responding to search text changes (#19885)
Only respond to any search changes in the command palette if the command
palette is visible. Without this check, a previewable action's preview
can appear after the command palette is closed.

## Validation Steps Performed
Preview no longer appears after the command palette is closed

## PR Checklist
Closes #18737

(cherry picked from commit 127775118d)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgmFfaU
Service-Version: 1.24
2026-02-27 13:21:48 -06:00
Dustin L. Howett
785dceaa2f vpack: ensure that we put the right version number in (#19793)
I just submitted a vpack to Windows and it turned out to be version
"0.0.5". Whoops.

(cherry picked from commit 3ec372c176)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgkbCsw
Service-Version: 1.24
2026-02-27 13:21:46 -06:00
Leonard Hecker
d8b5a488a2 Avoid scrolling when the search is open (#19775)
When text scrolls in and out of view, depending on the length
of the scrollback and latency of input, `GetSearchHighlightFocused`
would change which would trigger a `ScrollToSearchHighlight` call.

This PR changes the behavior such that only actively changing the
search mask triggers a search (typing text or pressing enter).

Closes #19754

## Validation Steps Performed
* Brining text in and out of view doesn't scroll 
* Toggling the aA button scrolls results into view 

(cherry picked from commit 71409f84f7)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgkLCdk
Service-Version: 1.24
2026-02-27 13:21:44 -06:00
Carlos Zamora
88891804a8 Replace NullableColorPicker ContentDialog with Flyout (#19572)
## Summary of the Pull Request
Updates the NullableColorPicker to use a flyout instead of a content
dialog. Frankly, it should've been this way from the start.

#19561 is an issue regarding the rectangle on the right side of the
picker. The complaint being that it should be something more useful than
a preview, an idea being that it could be a lightness gradient.
Unfortunately, the WinUI color picker doesn't let you do that. It's just
a plain preview.

That said, there's a lot of customizations that can be added still to
increase value here. To name a few:
- IsColorSliderVisible --> a color slider to adjust the lightness of the
color (as desired in #19561)
- IsHexInputVisible --> an input field to see and adjust the hex value
directly
- IsColorChannelTextInputVisible --> several input fields to adjust
individual RGB channels or switch over to HSV

However, the content dialog doesn't allow for text input due to a WinUI
bug and it's too small to display all of those controls.

Instead, I just discarded the content dialog altogether and opted into a
flyout. This makes it a more consistent experience with the other color
pickers (i.e. tab color, edit color scheme page). This also adds space
for all of the functionality mentioned above (those properties are
enabled by default).

## Validation Steps Performed
 selecting a color still works

Closes #19561

(cherry picked from commit 38d2fdad5f)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgkgbZA
Service-Version: 1.24
2026-02-27 13:21:42 -06:00
Dustin L. Howett
558b90f6bb pgo: train 1.24 separately 2026-02-27 13:21:07 -06:00
Dustin L. Howett
9be0bc6cb9 Remove TerminalAzBridge from sln (missed in 48e2d9333) 2026-02-27 13:20:49 -06:00
William Zhang
eeeb126ab3 Dim the caption buttons for unfocused windows (#19668)
This PR closes #12632 by dimming the caption controls in the titlebar
when unfocused. Leaves them intact when in high contrast mode. The color
used is borrowed from PowerToys' unfocused color.

## Validation Steps Performed
Tested by hovering and unhovering in focused and unfocused states, as
well as in high contrast mode. States are consistent and applied
correctly. I did notice that clicking on the titlebar wouldn't put it
into focus unless I also moved my mouse though, but that is also present
in the release branch.

Closes #12632

(cherry picked from commit 8d94edd7b0)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgkC_KM
Service-Version: 1.24
2026-01-21 18:24:54 -06:00
Leonard Hecker
1e70e182f2 Prevent RPC_E_CANTCALLOUT_ININPUTSYNCCALL during WM_SETTINGCHANGE (#19755)
Closes #19505

(cherry picked from commit e8971c80ae)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgkC_Mg
Service-Version: 1.24
2026-01-21 18:24:53 -06:00
Dustin L. Howett
48e2d93330 Remove TerminalAzBridge and use AzureConnection directly (#19528)
We used to run the cloud shell connector in an intermediate process
because our VT implementation lived mostly in conhost. James fixed that
up over the intervening years, and since #17510 landed Terminal is
exposed to 100% of application-originated VT. That means we no longer
need this workaround, its build steps, or anything else about it.

Closes #4661

(cherry picked from commit 4b946c0d5c)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgkCt5k
Service-Version: 1.24
2026-01-21 16:34:04 -06:00
Dustin L. Howett
6ba10c13d6 Protect more places against not having a XamlRoot (#19753)
We're seeing some crashes where we call `GetFocusedElement(null)`.

MSFT-54686865
MSFT-53824167
Possibly also #19751

(cherry picked from commit 0ee3cfb3fd)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgjzNUE
Service-Version: 1.24
2026-01-21 15:38:45 -06:00
Leonard Hecker
51fd044bd2 Use smart pointers in coroutines (#19752)
After the coroutines resume, `this` may have already been destroyed.
So, this PR adds proper use of `get_weak/strong`.

Closes #19745

(cherry picked from commit a528141fe6)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgjzPAI
Service-Version: 1.24
2026-01-21 15:38:43 -06:00
Dustin L. Howett
633cd6e9dc Wrap window shutdown in a top-level exception handler (#19743)
(cherry picked from commit a0c79b59e6)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgjsATs
Service-Version: 1.24
2026-01-15 13:31:51 -06:00
Leonard Hecker
a3d508a487 Remove TF_TMAE_UIELEMENTENABLEDONLY (#19738)
Closes #19670
Closes #19722

(cherry picked from commit 58f1f3b312)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgjnf9Y
Service-Version: 1.24
2026-01-13 16:47:12 -06:00
Aditya Pandey
0d2e8cecd0 Use theme tabRow color as acrylic tint (#19604) (#19622)
## Summary of the Pull Request
When `useAcrylicInTabRow` is enabled, the theme's `tabRow.background`
color is now used as the acrylic tint instead of being ignored.

## References and Relevant Issues
Fixes #19604

## Detailed Description of the Pull Request / Additional comments
Previously, the code had mutually exclusive branches for handling
`useAcrylicInTabRow` and theme `tabRow.background`. When acrylic was
enabled, the theme color was never evaluated.

This PR extracts the theme's tabRow color first, then uses it as the
acrylic tint if set, falling back to the default if no theme color is
specified.

## Validation Steps Performed
Tested with `useAcrylicInTabRow: true` and custom `tabRow.background` -
acrylic now shows the theme color as tint

## PR Checklist
Closes #19604

(cherry picked from commit 691568195b)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgjj6I8
Service-Version: 1.24
2026-01-13 16:47:11 -06:00
Leonard Hecker
fb3971f681 Fix a freeze when pasting lots of text (#19721)
WinUI doesn't react well to lots of text,
so this PR caps the max. amount shown.

Related to #9232

(cherry picked from commit d05dd85275)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgjXLaM
Service-Version: 1.24
2026-01-13 16:47:10 -06:00
Dustin L. Howett
6115cf31f5 Fix build after backport of 1ca0c76bc7 2025-12-16 18:32:35 -06:00
Anastasia Smigaliova
b277e4b515 Fix cursor being hidden when pressing modifier keys (#19473)
Closes #19445

(cherry picked from commit b357de9897)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgirMuw
Service-Version: 1.24
2025-12-16 18:16:06 -06:00
Samuel D. Leslie
8a8d02f7e1 Minor fixes to the settings schema (#19387)
## Summary of the Pull Request
Fixes a couple of minor issues in the settings schema which can result
in erroneous settings validation failures.

## References and Relevant Issues
None

## Detailed Description of the Pull Request / Additional comments
- `answerbackMessage`
  Permit `null` type (corresponds to the default value).
- `compatibility.input.forceVT`
  Add missing setting (previously was `experimental.input.forceVT`).
- `rendering.graphicsAPI`
  Add missing `automatic` enumeration value.
- Mark several settings as deprecated using the same format and direct
the user to the updated settings to use.

## Validation Steps Performed
Tested updated schema against configuration with above settings present.

## PR Checklist
- [X] Schema updated (if necessary)

---------

Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
(cherry picked from commit fc2d107897)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgirMyU
Service-Version: 1.24
2025-12-16 18:16:04 -06:00
Dustin L. Howett
1ba28b298f env: don't explode when GetShortPathNameW fails (#19284)
It fails inside app containers (!) such as the one used by LocalTests.

(cherry picked from commit 91c9a14a71)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgirMr8
Service-Version: 1.24
2025-12-16 18:16:03 -06:00
Dustin L. Howett
ba6cd3ebd5 When the renderer fails, try to fall back to D2D + WARP; retry changes (#19636)
This commit also ups the number of render failures that are permissible
to 6 (one try plus 5 retries), and moves us to use an exponential
backoff rather than a simple geometric one.

It also suppresses the dialog box in case of present failures for Stable
users. I feel like the warning dialog should be used for something that
the user can actually do something about...

Closes #15601
Closes #18198

(cherry picked from commit 45c5370271)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgiXh2E
Service-Version: 1.24
2025-12-09 17:07:00 -06:00
SEt
5c543bb2be Gracefully handle unavailable TSF from SYSTEM account (#19635)
When run from SYSTEM account TSF seems to be unavailable. The only
missing step to handle that is check during initialization.

Not sure if fail after partial success in `Implementation::Initialize`
should also be gracefully handled.

Closes #19634

(cherry picked from commit 8bb831f628)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgiXm14
Service-Version: 1.24
2025-12-09 17:04:58 -06:00
Dustin L. Howett
8b07837fdd Disallow fragments from containing UNC media paths (#19615)
Fragments are not allowed to declare web-source icons; this is equally
true for UNC paths in the local network (or WebDAV paths!)

(cherry picked from commit 7a7cdec91f)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgiGQDM
Service-Version: 1.24
2025-12-09 11:39:35 -06:00
Windows Console Service Bot
4fd7751d83 Localization Updates - fix ja-jp and fr-fr loc bugs - 12/04/2025 00:46:52 (#19616)
Closes #17191
Closes #18795
Closes #17827

(cherry picked from commit c4668d99b7)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgiGa_k
Service-Version: 1.24
2025-12-09 11:39:33 -06:00
Dustin L. Howett
47da5a11b2 Enable DECRQCRA at compile time for all Terminal builds (#19606)
Support for DECRQCRA Request Checksum of Rectangular Area was added in
#14989, but left disabled at build time because it could be considered a
security risk.

In #17895, we unconditionally added a toggle for it to Terminal's
settings UI and settings schema (`compatibility.allowDECRQCRA`). For
users on Stable and Preview, it didn't actually enable anything. Whoops.

Since we have a way to turn it off (and in so doing, mitigate the risk)
in Terminal, it's high time for us to remove the feature gating.

Conhost doesn't support turning it off for now and so conhost can still
have it compiled out, as a treat.

(cherry picked from commit 3e29d2a316)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgiA9JY
Service-Version: 1.24
2025-12-09 11:29:20 -06:00
penguin-sophist
08a981d7b7 Fix negative delta scroll (#19573)
This fixes the sign extension from 16 to 32 bit by casting
from the unsigned to the signed type first.

Closes #19391
Closes #19484

(cherry picked from commit fb75fb56c0)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzghttY4
Service-Version: 1.24
2025-12-09 11:29:18 -06:00
Leonard Hecker
7e69a2e96f Fix a WPF<>TSF crash by avoiding TF_TMAE_CONSOLE (#19584)
As explained in detail in the diff.

Closes #19562

(cherry picked from commit 1ca0c76bc7)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzghp8js
Service-Version: 1.24
2025-11-24 12:50:58 -06:00
Yash kumar kasaudhan
5205575d4d Fix #19390: Make snap-on-input conditional to prevent blocking programmatic scroll (#19414)
## Summary of the Pull Request
This PR fixes a bug where programmatic scrolling would get stuck. The
fix makes the "snap-on-input" feature conditional, activating it only
for modern applications that use Virtual Terminal (VT) processing. This
restores correct scrolling behavior for legacy applications without
removing the feature for new ones.

## References and Relevant Issues
Fixes #19390: OpenConsole: Cursor visibility prevents programmatic
scrolling

## Detailed Description of the Pull Request / Additional comments
The "snap-on-input" feature introduced in a previous PR caused an
unintended side effect for older console programs that use the
SetConsoleWindowInfo API to manage their own viewport. When such a
program tried to scroll using a key press, the snap feature would
immediately pull the view back to the cursor's position, causing the
screen to flicker and get stuck.

This fix makes the snap-on-input feature smarter by checking the
application's mode first.

## Validation Steps Performed

Compiled the minimal C++ reproduction case from issue #19390.

Ran the test executable inside the newly built OpenConsole.exe.

Confirmed that scrolling with the Up/Down arrow keys now works
correctly, even with a visible cursor. The view no longer flickers or
gets stuck when the cursor moves outside the viewport.

Closes #19390

(cherry picked from commit c28610d016)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgfZNLg
Service-Version: 1.24
2025-11-24 12:50:57 -06:00
Windows Console Service Bot
7a34181fc7 Localization Updates - main - 11/07/2025 03:05:02 (#19532)
It said the equivalent of "Nickname" rather than "aliased".

Co-authored-by: Console Service Bot <consvc@microsoft.com>
(cherry picked from commit 965a121a38)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzghDyBA
Service-Version: 1.24
2025-11-24 12:50:55 -06:00
Leonard Hecker
b38489b67b Allow creating new windows on another virtual desktop (#19458)
Whoops. Closes #18652

<DHowett> I chatted with Leonard to figure out why I kept
misunderstanding this PR. The key is that **this function should not
always return an existing window.** It's supposed to find an existing
window on the current virtual desktop, not literally any window
anywhere.

(cherry picked from commit 5ae95d7df0)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgf7tqY
Service-Version: 1.24
2025-11-24 12:50:54 -06:00
Dustin L. Howett
d25b84d4c1 Make sure UIHelpers' resources are included in the final PRI file (#19461)
OCWildcardResource requires the inclusion of a magic MSBuild target that
we wrote. We forgot to include it here. Oops.

Closes #19444

(cherry picked from commit 0e3d136dad)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgf7udM
Service-Version: 1.24
2025-11-24 12:50:53 -06:00
Windows Console Service Bot
9ab1b7ba3b Localization Updates - main - 10/15/2025 02:48:19 (#19451)
Closes #18849
Closes #19412

Co-authored-by: Console Service Bot <consvc@microsoft.com>
(cherry picked from commit 7f6ab5520e)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgf5KOs
Service-Version: 1.24
2025-11-24 12:50:51 -06:00
Carlos Zamora
d35bc4cee6 Update WinGet CNF for exact command matching (#19432)
## Summary of the Pull Request
Update the WinGet CNF package search to match that of the updated
PowerShell WinGet CNF module. Now, we'll only search for matching
commands instead of by name and moniker.

## References and Relevant Issues
https://github.com/microsoft/winget-command-not-found/pull/29

## Validation Steps Performed
 In CMD, type "vim" and vim packages are suggested

(cherry picked from commit 819987c90e)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgfuACY
Service-Version: 1.24
2025-11-24 12:50:50 -06:00
Carlos Zamora
77ee52b872 Fix unfocusedBackground being used as active tab color (#19424)
## Summary of the Pull Request
Turns out that the `"TabViewItemHeaderBackground"` resource should be
set to the _selected_ color instead of the _deselected_ color.

In 1.22, (pre-#18109) we actually didn't set this resource. But we do
actually need it for high contrast mode! (verified)

## Validation Steps Performed
 High contrast mode looks right
 "Snazzy" theme from bug report looks right

## PR Checklist
 Closes #19343

(cherry picked from commit b62cad640b)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgfrGvI
Service-Version: 1.24
2025-11-24 12:50:48 -06:00
Dustin L. Howett
671552671d Use the actual process image instead of module filename to dedup session (#19415)
Apparently, `GetModuleFileNameW` returns exactly the path (or prefix, in
case of a DLL) passed to `CreateProcess` casing and all. Since we were
using it to generate the uniquing hash for Portable and Unpackaged
instances, this meant that `C:\Terminal\wt` and `C:\TeRmInAl\wt` were
considered different instances. Whoops.

Using `QueryFullProcessImageNameW` instead results in canonicalization.
Maybe the kernel does it. I don't know. What I do know is that it works
more correctly.

(`Query...` goes through the kernel, while `GetModule...` goes through
the loader. Interesting!)

Closes #19253

(cherry picked from commit 9d7ea77cc8)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgfkTuo
Service-Version: 1.24
2025-10-08 17:55:14 -05:00
PankajBhojwani
58a5088735 Only do "keys" fixups for non-nested, non-iterable commands (#19408)
## Summary of the Pull Request
When we introduced action IDs, we separated "commands" from
"keybindings", and introduced fixup logic to rewrite the legacy-style
command blocks into the new version. However we don't do any ID logic
for nested and iterable commands, so make sure we don't inform the
loader for fixups in those cases.

## Validation Steps Performed
We no longer repeatedly attempt to fixup the settings file when we see a
`"keys"` entry in a nested/iterable command block

## PR Checklist
- [x] Closes #18736

(cherry picked from commit 04676bd31a)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgfjzjQ
Service-Version: 1.24
2025-10-08 17:55:13 -05:00
Dustin L. Howett
c5f99b69d5 Remove the leading fire from the taskbar progress handler (#19403)
If the progress state hasn't been set for more than 200ms, we shouldn't
even bother flickering the old state.

This prevents applications from making the tab (and the taskbar icon)
flicker.

We were reviewing #19394 and decided that the _original_ behavior before
Leonard's throttling fix was somewhat unfortunate as well. An
application that sets an indeterminate state for 10ms and then clears it
shouldn't be able to make any part of the application flicker, fast _or_
slow.

Removing the leading fire time from the throttled function ensures that
it will only fire once every 200ms, and only with the state most
recently set. It will not debounce (so setting the progress every 150ms
will not prevent it from updating.)

Closes #19394

(cherry picked from commit 998ab586e1)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgfZOsU PVTI_lADOAF3p4s4BBcTlzgfb1NE
Service-Version: 1.24
2025-10-08 17:55:11 -05:00
Dustin L. Howett
6f5b293a56 Avoid reentrancy issues when dropping AppHost, even harder (#19395)
The previous fix in #19296 moved the _destruction_ of AppHost into the
tail end after we manipulate the `_windows` vector; however, it kept the
part which calls into XAML (`Close`) before the `erase`. I suspect that
we still had some reentrancy issues, where we cached an iterator before
the list was modified by another window close event.

That is:

```mermaid
sequenceDiagram
		Emperor->>Emperor: Close Window
		Emperor->>+AppHost: Close (a)
		AppHost->>XAML: Close
		XAML-->>Emperor: pump loop
		Emperor->>Emperor: Close Window
		Emperor->>+AppHost: Close (b)
		AppHost->>XAML: Close
		XAML-->>Emperor: pump loop
		AppHost->>-Emperor: Closed
		Emperor->>Emperor: erase(b)
		AppHost->>-Emperor: Closed
		Emperor->>Emperor: erase(a)
```

Moving the `Close()` to after the `erase` ensures that there are no
cached iterators that survive beyond XAML pumping the message loop.

Fixes 8d41ace3

(cherry picked from commit 5976de1600)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgfScpM
Service-Version: 1.24
2025-10-08 17:55:10 -05:00
Dustin L. Howett
e33bc3d137 build: separate vpack creation from vpack publication (#19380)
This will allow us to publish vpacks without making the build fail
waiting for us to *merge* those vpacks into Windows. It also gives us
better control over when and where the vpack update gets merged.

(cherry picked from commit 6b428577b9)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgfLAks
Service-Version: 1.24
2025-09-25 13:37:20 -05:00
Dustin L. Howett
6aae2d0b72 Move newTabMenu creation to Settings fixups (#19353)
Some of the other settings fixups require there to be a valid
NewTabMenu, rather than just a temporary object. Since the resolving all
the menu entries after loading already forces the user to have a
`newTabMenu`, let's just codify it as a real fixup.

I've moved the SSH folder fixup after the settings fixup because it
relies on there being a NTM.

I decided not to make this fixup write back to the user's settings.
There are a couple reasons for this, all of which are flimsy.

- There are a number of tests that test fixup behavior, especially those
around actions, which would need to be updated for this new mandatory
key. I did not think it proper to add `newTabMenu` to ten unrelated
tests that only contain actions (for example.)
- We actually don't currently have mandatory keys. But this one was
always being added anyway, in a later phase...
- It's consistent with the existing behavior.

Closes #19356

(cherry picked from commit e80aadd98b)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzge0HjU
Service-Version: 1.24
2025-09-16 18:31:42 -05:00
Dustin L. Howett
148a86c81c VsDev: reject VS instances which do not actually contain devshell/devcmd (#19352)
Closes #19169

(cherry picked from commit 1926c4601c)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzge0Hto
Service-Version: 1.24
2025-09-16 18:31:40 -05:00
Dustin L. Howett
94e96ca048 Avoid generating SSH profiles using stale memory (#19354)
You can't return a `string_view` to a temporary. It's a miracle this
ever worked.

Broken since inception in a5f9c85c39

Closes #19355

(cherry picked from commit 46b9572e60)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzge0HmE
Service-Version: 1.24
2025-09-16 18:31:39 -05:00
Ayman Bagabas
b53d7df066 Add support for VT horizontal mouse wheel events (#19248)
This adds support for horizontal mouse wheel events (`WM_MOUSEHWHEEL`).
With this change, applications running in the terminal can now receive
and respond to horizontal scroll inputs from the mouse/trackpad.

Closes #19245
Closes #10329

(cherry picked from commit 814f78ed2c)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgep1sM
Service-Version: 1.24
2025-09-16 18:31:37 -05:00
Leonard Hecker
1194ad0343 Fix behavior of split-pane for existing windows (#19347)
Closes #18815

## Validation Steps Performed
* `wt -w 0 sp` splits the current tab 

(cherry picked from commit 0aee174e68)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgeV1i4
Service-Version: 1.24
2025-09-16 14:38:44 -05:00
John Cavanaugh
04e1290102 Fix terminal profile schema to allow null in keybinding id (#19332)
Fixes the terminal profile jsonschema to allow for null in the id. This
is to match the current implementation when disabling a built in default
keybind.

(cherry picked from commit eb16eb26ab)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgemwL0
Service-Version: 1.24
2025-09-16 14:38:43 -05:00
Leonard Hecker
f5083714c1 Fix a crash in _makeCursorVisible (#19329)
Fixes the crash and also makes `SnapOnOutput` a bit nicer.

Closes #19325

## Validation Steps Performed
* Launch vim in WSL
* Exit
* No crash 

(cherry picked from commit 384932183f)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgegVZ8
Service-Version: 1.24
2025-09-16 14:38:41 -05:00
Leonard Hecker
7642eec206 Fix right click on tabs closing them (#19273)
I do not like this.

## Validation Steps Performed
* Enable close buttons on tabs
* Open a tab
* Close the tab with middle click
* Open a tab
* Right click the tab
* Tab doesn't close, Menu opens 

(cherry picked from commit 4a34a76504)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgeAlgM
Service-Version: 1.24
2025-09-16 14:38:40 -05:00
Myungchul Keum
37c674dd6e Adjust "Dimidium" color scheme (#19303)
- Add Selection BG color
- Make Bright white brighter

## Summary of the Pull Request
Final tune for Dimidium color scheme before its release.

## References and Relevant Issues
#18563

## Detailed Description of the Pull Request / Additional comments
I made little change to Dimidium color scheme.

<img width="640" height="174" alt="cmp-lightness1c"
src="https://github.com/user-attachments/assets/2e4aa6ca-5864-4901-b323-2e2bb2bf00e8"
/>

![preview-terminal](https://github.com/user-attachments/assets/8a53c54d-942a-44a2-9ee7-9ff8a6d2dfab)

<img width="584" height="207" alt="image"
src="https://github.com/user-attachments/assets/b70b0759-7961-4f8f-aaa7-762fc48e425b"
/>

- Adjusted "Bright white" slightly brighter, hoping it can be
distinguished better from "White".
- Defined "Selection Background" color.

This will be the final tune for Dimidum color scheme.

(cherry picked from commit 8011f3e28c)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgeMuoQ
Service-Version: 1.24
2025-09-05 14:42:10 -05:00
Leonard Hecker
3a57ba54a0 Avoid reentrancy issues when dropping AppHost (#19296)
tl;dr: ~Apphost() may pump the message loop.
That's no bueno. See comments in the diff.

Additionally, this PR enables `_assertIsMainThread` in
release to trace down mysterious crashes in those builds.

(cherry picked from commit 8d41ace320)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgeJeYA
Service-Version: 1.24
2025-09-05 14:42:09 -05:00
Leonard Hecker
fc465bdae6 Fix CoreWindow being destroyed after handoff (#19298)
As per: https://github.com/microsoft/terminal/discussions/19280#discussioncomment-14237148

## Validation Steps Performed
* Launch wtd via handoff (spawn cmd, etc.)
* Shift+Click the tab bar + button to create a new window
* Close the initial window
* UI doesn't lock up 

(cherry picked from commit 7849b00cbd)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgeLN9s
Service-Version: 1.24
2025-09-05 14:42:08 -05:00
Leonard Hecker
04a5dffdcd Fix a race condition around Open/CloseClipboard (#19297)
tl;dr: Open/CloseClipboard are surprisingly not thread-safe.

## Validation Steps Performed
* Copy a large amount of text (>1MB)
* Run `edit.exe`
* Press and hold Ctrl+Shift+V
* Doesn't crash 

(cherry picked from commit 5899343237)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgeLIjw
Service-Version: 1.24
2025-09-05 14:42:07 -05:00
Dustin L. Howett
894e57769b Include Profile.BellSound as a media resource (#19289)
I legitimately cannot figure out how I forgot this. Bell should support
all the same validation as other media resources! Technically this means
you can set `bellSound` to `desktopWallpaper`, but... we'll pretend that
makes sense.

I reworked the viewmodel to be a little more sensible. It no longer
requires somebody else to check that its files exist. The settings UI
now also displays `File not found` in the _preview_ for the bell if it
is a single file which failed validation!

(cherry picked from commit 4272151adc)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgeF9qU
Service-Version: 1.24
2025-09-05 14:42:06 -05:00
Dustin L. Howett
eb206177a4 sb: add appId to the StoreBroker blobs (new AERO requirement) (#19290)
> _I am altering the deal. Pray I do not alter it further._
> -the AERO team, maybe

(cherry picked from commit bd14f69080)
Service-Card-Id: PVTI_lADOAF3p4s4BBcTlzgeF9fQ
Service-Version: 1.24
2025-09-05 14:42:05 -05:00
Dustin L. Howett
ad48162f02 Reflect inbox changes from RS (#19258)
Reflect inbox changes to `onecore/windows/core/console/open`.

* eed3a6fa5 Merged PR 13076689: Update managed TAEF tests that exist in
GE branches to use the new publishing locations of TAEF's managed
reference binaries.
* 718d7d02d Merged PR 12483430: build console* with clang

Somebody internal is trying to build the console with Clang (which is
cool).

---------

Co-authored-by: Dragos Sambotin <dragoss@microsoft.com>
Co-authored-by: Phil Deets <pdeets@microsoft.com>
2025-08-25 19:14:25 +00:00
Dustin L. Howett
6771470c8b PDPs: Preview->Stable, new Preview notes (#19272) 2025-08-25 17:58:06 +00:00
Dustin L. Howett
21cfbf170c Move to CppWinRT 2.0.250303.1 (#19268)
Interesting changes in this update:
- better support for `REFIID,IUnknown**` in `capture`
- `LOAD_LIBRARY_SEARCH_DEFAULT_DIRS` for all SxS DLL loading
- `get_self` reading from classic COM interfaces (rather than WinRT
  ones)
- better incremental builds by ignoring stale winmd files (see
  microsoft/cppwinrt#1404)
- some ability to mix c++17 and c++20 static libraries
- better codegen for `consume` methods

This version of C++/WinRT is better about propagating `protected`
fields from the metadata into the C++ projections. This required
us to switch to the `I...Protected` interfaces for some things
we are _technically_ not allowed access to. We also had some
`overridable` (protected!) members of our own that needed undec-
oration.
2025-08-25 12:46:47 -05:00
Dustin L. Howett
4f391c5e42 build: remove the forced vpack submission; let us do it on our own time (#19271) 2025-08-25 19:44:11 +02:00
Carlos Zamora
d61ad2d9cd Fix unfocused appearance UI in settings (#19263)
The unfocused appearance section in the settings UI looks a little off.
Specifically, the header was too large (larger than the breadcrumbs!)
and the button was weirdly aligned.

This PR reduces the size of the header and creates a style in
CommonResources that manages it. This is the only place it's used, for
now. A vertical alignment was added to the "create appearance" and
"delete appearance" buttons to make them look better. The top margin of
the "Text" header was also removed so that there isn't an awkward gap in
the unfocused appearance section (the 32 that was there was moved to the
bottom of the control preview so that that area remains unaffected.)

Follow-up from #19001
2025-08-25 10:32:49 -07:00
Carlos Zamora
7578209be5 Add telemetry for settings UI traffic (#19156)
## Summary of the Pull Request
Adds a telemetry provider to the Terminal.Settings.Editor project as
well as new telemetry events to track traffic through the settings UI.
Specifically, the following events were added:
- `NavigatedToPage`: Event emitted when the user navigates to a page in
the settings UI
- Has a `PageId` parameter that includes the identifier of the page that
was navigated to
- (conditionally added when PageId = `page.editColorScheme`)
`SchemeName` parameter tracks the name of the color scheme that's being
edited
   - conditionally added when PageId = `page.extensions`:
- `ExtensionPackageCount`: The number of extension packages displayed
- `ProfilesModifiedCount`: The number of profiles modified by enabled
extensions
- `ProfilesAddedCount`: The number of profiles added by enabled
extensions
- `ColorSchemesAddedCount`: The number of color schemes added by enabled
extensions
   - conditionally added when PageId = `page.extensions.extensionView`:
- `FragmentSource`: The source of the fragment included in this
extension package
- `FragmentCount`: The number of fragments included in this extension
package
      - `Enabled`: The enabled status of the extension
- (conditionally added when PageID = `page.newTabMenu`) if the page is
representing a folder view
   - conditionally added when PageID = `page.profile.*`:
- `IsProfileDefaults`: if the modified profile is the profile.defaults
object
      - `ProfileGuid`: the guid of the profile that was navigated to
      - `ProfileSource`: the source of the profile that was navigated to
- conditionally added when PageID = `page.profile` (aka the base profile
page):
         - `Orphaned`: tracks if the profile was orphaned
         - `Hidden`: tracks if the profile is hidden
- (conditionally added when PageID = `page.profile.appearance`)
`HasBackgroundImage`: `if the profile has a background image defined`
- (conditionally added when PageID = `page.profile.appearance`)
`HasUnfocusedAppearance`: `if the profile has an unfocused appearance
defined`
- `AddNewProfile`: Event emitted when the user adds a new profile
`IsExtensionView` parameter tracks if the page is representing a view of
an extension
- Has a `Type` parameter that represents the type of the creation method
(i.e. empty profile, duplicate)
- `ResetApplicationState`: Event emitted when the user resets their
application state (via the UI)
- `ResetToDefaultSettings`: Event emitted when the user resets their
settings to their default value (via the UI)
- `OpenJson`: Event emitted when the user clicks the Open JSON button in
the settings UI
- Has a `SettingsTarget` parameter that represents the target settings
file (i.e. settings.json vs defaults.json)
- `CreateUnfocusedAppearance`: Event emitted when the user creates an
unfocused appearance for a profile
- `IsProfileDefaults`: if the modified profile is the profile.defaults
object
   - `ProfileGuid`: the guid of the profile that was navigated to
   - `ProfileSource`: the source of the profile that was navigated to
- `DeleteProfile`: Event emitted when the user deletes a profile
- also includes `ProfileGuid`, `ProfileSource`, `Orphaned` from the
`NavigatedToPage` section above

The page ids can be reused later as a serialized reference to the page.
We already use the one for the extensions page for the "new" badge.
2025-08-21 19:06:20 -05:00
Carlos Zamora
2c666aa292 Clear Name, Source, and Commandline from Profiles.Defaults (#19225)
The Name, Source, and Commandline profile settings should not be allowed
to be set on the Profiles.Defaults object. This just enforces that by
clearing them (as is done with Guid).

These profile settings are omitted from the settings UI's profile
defaults page.

Closes #19202
2025-08-21 19:05:27 -05:00
Dustin L. Howett
68b723c16c Remove ProfileName from the surface of CoreSettings (#19261)
You know how much I hate squirreling away information on objects we have
to pass halfway across the universe just to get back.

In this case, `StartingTitle` will always be the name of the profile. We
only used ProfileName in places where we _needed a Title_, so this makes
it much more obvious what we're doing.
2025-08-20 17:03:47 -05:00
Carlos Zamora
642a2aa41e [Conhost] Fix off-by-1 error when copying and coloring selections (#19259)
## Summary of the Pull Request
Fixes a bug where copying and coloring selected text would be off by
one. This was introduced in #18106 when selection was updated to be
stored as an exclusive range. `Selection::_RegenerateSelectionSpans()`
was updated then, but copying text and coloring selection didn't rely on
selection spans.

Copying text relies on `GetSelectionAnchors()`. This function has now
been updated to increment the bottom-right point of the selection. This
way, `GetTextSpans()` operates on the expected _exclusive_ range.

Coloring selection relies on `TextBuffer::SearchText()`,
`TextBuffer::GetTextRects` and `GetSelectionSpans()`. Both
`Selection::ColorSelection()` were updated to use `rect` over
`inclusive_rect` to emphasize that they are exclusive ranges. Converting
between the two improves clarity and fixes the bug.

## References and Relevant Issues
Introduced in #18106 

## Validation Steps Performed
Copying text works in the following scenarios:
 single line, left-to-right and right-to-left
 multi-line, diagonal directions
 block selection

Coloring text works in the following scenarios:
ctrl+# --> color instance
ctrl+shift+# --> color all instances

Closes #19053
2025-08-20 10:43:26 -07:00
Carlos Zamora
7055b99acc Fix names and types of a few telemetry events (#19257)
Fixes a few issues with some telemetry events:
- The macro is organized as such: `TraceLoggingX(value, argName,
[argDescription])`. A few args had a description set on the spot where
the name should be. I added a name for a few of these.
- `TraceLoggingBool` --> `TraceLoggingInt32` for `themeChoice` (we
shouldn't be casting the evaluated int as a bool; it loses some of the
data we care about)
- improves the description for `themeChoice` to include information
about the legacy values

Checked through all our telemetry events and all of the args have a
proper name set. We tend to use `TraceLoggingValue` too which
automatically figures out the type that's being used, so that's also
handled.
2025-08-19 19:13:58 +00:00
Dustin L. Howett
837e86c18c Bust TerminalSettingsCache down to a plain old C++ class (#19254) 2025-08-19 09:35:27 -05:00
Leonard Hecker
e97388cb27 Fix SnapOnOutput not always snapping (#19247)
`IsOn` is the blinker on/off state, which `IsVisible`
is the actual cursor visibility on/off state.

## Validation Steps Performed
* Run bash/zsh in WSL
* (Repeatedly) Quickly scroll right and press A-Z
* Scrolls to the left 
2025-08-15 20:34:29 +00:00
Carlos Zamora
1b2aad6504 Add SSH folder to NTM for dynamic SSH profiles (#19239)
Automatically generates an "SSH" folder in the new tab menu that
contains all profiles generated by the SSH profile generator. This
folder is created if the SSH generator created some profiles and the
folder hasn't been created before. Detecting if the folder was generated
is done via the new `bool ApplicationState::SSHFolderGenerated`. The
logic is similar to `SettingsLoader::DisableDeletedProfiles()`.

Found a bug on new tab menu's folder inlining feature where we were
counting the number of raw entries to determine whether to inline or
not. Since the folder only contained the match profiles entry, this bug
made it so that the profile entries would always be inlined. The fix was
very simple: count the number of _resolved_ entries instead of the raw
entries. This can be pulled into its own PR and serviced, if desired.

## References and Relevant Issues
#18814 
#14042 

## Validation Steps Performed
 Existing users get an SSH folder if profiles were generated

## PR Checklist
Closes #19043
2025-08-13 15:43:27 -07:00
Dustin L. Howett
abaa9488d9 Switch to the @Local view on TerminalDependencies (#19243)
Due to an unexpected decision on behalf of the Azure Artifacts folks,
the default view for a feed with upstream sources reports all packages,
even if they are not actually populated into the feed.

This results in (uncontrolled) 401 errors whenever a new package appears
upstream, because the feed tells our users and our build system that it
is available, but fails when the download actually begins because it is
not allowed to "write" the upstream version to the feed.
2025-08-13 16:27:01 +00:00
Leonard Hecker
6b19d21845 Fix a output marks performance regression (#19242)
An alternative approach for #18291. Improves perf by ~7%.
2025-08-13 18:10:18 +02:00
Dustin L. Howett
0d23624fa9 Use a new API to propagate foreground state to child processes (#19192)
Windows 11 uses some additional signals to determine what the user cares
about and give it a bit of a QoS boost. One of those signals is whether
it is associated with a window that is in the foreground or which has
input focus.

Association today takes two forms:
- Process has a window which is in the foreground or which has input
  focus
- Process has a *parent* that meets the above criterion.

Console applications that are spawned "inside" terminal by handoff do
not fall into either bucket. They don't have a window. Their parent is
`dllhost` or `explorer`, who is definitely not in focus.

We are piloting a new API that allows us to associate those processes
with Terminal's window.

When Terminal is in focus, it will attach every process from the active
tab to its QoS group. This means that whatever is running in that tab
is put into the "foreground" bucket, and everything running in other
background tabs is not.

When Terminal is out of focus, it attaches every process to its QoS
group. This ensures that they all go into the "background" bucket
together, following the window.
2025-08-13 00:09:50 +00:00
Leonard Hecker
8a05910e3c Implement snap-on-input/output for conhost (#17453)
This extends our current behavior in conhost to scroll to the
cursor position when typing. This is especially relevant in WSL,
where this won't happen at all, otherwise.

Closes #18073
Closes MSFT:49027268
2025-08-12 12:22:33 -07:00
Windows Console Service Bot
a0f7b332fa Localization Updates - multi line paste - 08/09/2025 03:04:06 (#19230) 2025-08-12 10:39:45 -05:00
Leonard Hecker
0c064905b3 Revert "ConPTY: Emit DSR CPR on resize (#19089)" (#19237)
This reverts commit c55aca508b
because it is unaware of the VT state and may inject the DSR CPR
while e.g. a DCS is going on.

Reopens #18725
2025-08-11 17:48:35 +00:00
Leonard Hecker
e2f3e53064 Don't trim bracketed pastes (#19067)
* Moves clipboard writing from `ControlCore` to `TerminalPage`.
  This requires adding a bunch of event types and logic.
  This is technically not needed anymore after changing the
  direction of this PR, but I kept it because it's better.
* Add a `WarnAboutMultiLinePaste` enum to differentiate between
  "paste without warning always/never/if-bracketed-paste-disabled".

Closes #13014
Closes https://github.com/microsoft/edit/issues/279

## Validation Steps Performed
* Launch Microsoft Edit and copy text with a trailing newline
* Paste it with Ctrl+Shift+V
* It's pasted as it was copied 
* Changing the setting to "always" always warns 

Co-authored-by: Dustin L. Howett <duhowett@microsoft.com>
2025-08-08 20:53:42 +00:00
Leonard Hecker
5b41f14660 Disable WIN32IM on shutdown (#19229)
Closes #19153

## Validation Steps Performed
I tried reproducing the issue on Windows 10 and couldn't.
I'm not sure what I did wrong. But I tested it under a
debugger with VtPipeTerm and it wrote the sequences to stdout.
2025-08-08 19:48:52 +02:00
Windows Console Service Bot
514da89b63 Localization Updates - main - 08/06/2025 03:04:16 (#19219) 2025-08-07 07:30:29 -05:00
Dustin L. Howett
6c2f38c732 Profiles Editor: make sure we notify the IconPath property (#19223)
There were instances where changing the icon or resetting it did not
result in the text box changing.

Regressed in #19143
2025-08-06 16:09:47 -07:00
Leonard Hecker
6fb70eb510 Throttle incoming handoffs so WinUI can layout them (#19220)
As explained in the diff itself.

Closes #13136

## Validation Steps Performed
* In conhost, with `wtd` not running, execute:
  ```pwsh
1..10 | % { wt -w 1 nt --title=$_ pwsh -NoExit -Command "Get-Date
-Format HH:mm:ss.ffff" }
  ```
* Every tab is up and running immediately 
2025-08-06 18:55:29 +00:00
Leonard Hecker
c55aca508b ConPTY: Emit DSR CPR on resize (#19089)
This will help terminals with a reflow behavior unlike
the one implemented in ConPTY, such as VS Code.

Closes #18725

## Validation Steps Performed
* Tested under a debugger 
* Use PowerShell 5 and reflow lines in the ConPTY buffer until they're
  pushed outside the top viewport. Then type something in the prompt.
  Cursor is in a consistent position, even if slightly off. 
2025-08-06 13:06:44 +02:00
Dustin L. Howett
666a75bc70 Fix hot reload for icon, bell, close on exit; regressed in #16172 (#19217)
In #16172, we removed the propagation of the profile down into the
Terminal Pane Content.

It was holding on to the profile from the _old_ settings model (😱).

This also broke background image hot reload.
2025-08-05 21:18:43 +00:00
Dustin L. Howett
c0f9a198c6 Rewrite media resource handling (relative path icons, web URLs) (#19143)
This pull request broadly rewrites how we handle all media resources in
the Terminal settings model.

## What is a media resource?

A media resource is any JSON property that refers to a file on disk,
including:

- `icon` on profile
- `backgroundImage` on profile (appearance)
- `pixelShaderPath` and `pixelShaderImagePath` on profile (appearance)
- `icon` on command and the new tab menu entries

The last two bullet points were newly discovered during the course of
this work.

## Description of Changes

In every place the settings model used to store a string for a media
path, it now stores an `IMediaResource`.

A media resource must be _resolved_ before it's used. When resolved, it
can report whether it is `Ok` (found, valid) and what the final
normalized path was.

This allows the settings model to apply some new behaviors.

One of those new behaviors is resolving media paths _relative to the
JSON file that referred to them._ This means fragments and user settings
can now contain _local_ images, pixel shaders and more and refer to them
by filename.

Relative path support requires us to track the path from which every
media resource "container" was read[^2]. For "big" objects like Profile,
we track it directly in the object and for each layer. This means that
fragments **updating** a profile pass their relative base path into the
mix. For some of the entries such as those in `newTabMenu`, we just wing
it (#19191). For everything that is recursively owned by a parent that
has a path (say each Command inside an ActionMap), we pass it in from
the parent during media resolution.

During resolution, we now track _exactly which layer_ an icon,
background image, or pixel shader path came from and read the "base
path" from only that layer. The base path is not inherited.

Another new behavior is in the handling of web and other URLs.

Canonical and a few other WSL distributors had to resort to web URLs for
icons because we did not support loading them from the package. Julia
tried to use `ms-appx://JuliaPackageNameHere/path/to/icon` for the same
reason. Neither was intended, and of the two the second _should_ have
worked but never could[^1].

For both `http(s?)` URLs and `ms-appx://` URLs which specify a package
name, we now strip everything except the filename. As an example...

If my fragment specifies `https://example.net/assets/foo.ico`, and my
fragment was loaded from `C:\Fragments`, Terminal will look *only* at
`C:\Fragments\foo.ico`.

This works today for Julia (they put their icon in the fragment folder
hoping that one day we would support this.) It will require some work
from existing WSL distributors.

I'm told that this is similar to how XML schema documents work.

Now, icons are special. They support _Emoji_ and _Segoe Icons_. This PR
adds an early pass to avoid resolving anything that looks like an
emoji.

This PR intentionally expands the heuristic definition of an emoji. It
used to only cover 1-2 code unit emoji, which prevented the use of any
emoji more complicated than "man in business suite levitating."

An icon path will now be considered an emoji or symbol icon if it is
composed of a single grapheme cluster (as measured by ICU.)

This is not perfect, as it errs on the side of allowing too many
things... but each of those things is technically a single grapheme
cluster and is a perfectly legal FontIcon ;)

Profile icons are _even more special_ than icons. They have an
additional fallback behavior which we had to preserve. When a profile
icon fails validation, or is expressly set to `null`, we fall back to
the EXE specified in the command line.

Because we do this fallback during resolution, _and the icon may be
inherited by any higher profile,_ we can only resolve it against the
commandline at the same level as the failed or nulled icon.

Therefore, if you specify `icon: null` in your `defaults` profile, it
will only ever resolve to `cmd.exe` for any profile that inherits it
(unless you change `defaults.commandline`).

This change expands support for the magic keywords `desktopWallpaper`
and `none` to all media paths (yes, even `pixelShaderPath`... but also,
`pixelShaderImagePath`!) It also expands support for _environment
variables_ to all of those places. Yes, we had like forty different
handlers for different types of string path. They are now uniform.

## Resource Validation

Media resources which are not found are "rejected". If a rejected
resource lives in _user_ settings, we will generate a warning and
display it.

In the future, we could detect this in the Settings UI and display a
warning inline.

## Surprises

I learned that `Windows.Foundation.Uri` parses file paths into `file://`
URIs, but does not offer you a way to get the original file path back
out. If you pass `C:\hello world`, _`Uri.Path`_ will return
`/C:/hello%20world`. I kid you not.

As a workaround, we bail out of URL handling if the `:` is too close to
the start (indicating an absolute file path).

## Testing

I added a narow test hook in the media resource resolver, which is
removed completely by link-time code generation. It is a real joy.

The test cases are all new and hopefully comprehensive.

Closes #19075
Closes #16295
Closes #10359 (except it doesn't support fonts)
Supersedes #16949 somewhat (`WT_SETTINGS_DIR`)
Refs #18679

Refs #19215 (future work)
Refs #19201 (future work)
Refs #19191 (future work)

[^1]: Handling a `ms-appx` path requires us to _add their package to our
dependency graph_ for the entire duration during which the resource will
be used. For us, that could be any time (like opening the command
palette for the first time!)

[^2]: We don't bother tracking where the defaults came from, because we
control everything about them.
2025-08-05 20:47:50 +00:00
Dustin L. Howett
a258d7d3df Fix title being stuck after toggling "showTerminalTitleInTitlebar" (#19212)
We already have the logic to fall back when the setting is disabled, we
just _also_ had a terrible eventing architecture and never used the
`Title` getter that was smart enough to figure it out.

This pull request somewhat disentangles the mess that is title handling.
For example, TerminalPage had a facility to get its current title! It
was never used. Once we started using it, it wouldn't work for the
Settings page... because it only read the title out of the active
control.

Closes #12871
Closes #19139 (superseded)

---------

Co-authored-by: techypanda <jonathan_wright@hotmail.com>
2025-08-04 17:46:55 -07:00
Leonard Hecker
0a6394270e Fix WSL PATH corruption & potential use-after-free (#19211)
Closes #19152

## Validation Steps Performed
* Set `PATH` on a linux profile
* `PATH` isn't messed up inside WSL 
2025-08-04 22:42:26 +00:00
MQY
88ab154f22 Prevent cursor repositioning during mouse selection (#19182)
- Modify the cursor repositioning logic to check if a selection is in
progress
- Only reposition the cursor when the mouse is used for positioning, not
during selection operations

Closes #19181
2025-08-04 21:09:08 +00:00
Leonard Hecker
dbf740cf2c Extend lead/trail edge support for throttled_func (#19210)
You can now create throttled functions which trigger both on the leading
and trailing edge. This was then also ported to `ThrottledFunc` for
`DispatcherQueue`s and used for title/taskbar updates.

Closes #19188

## Validation Steps Performed
* In CMD run:
  ```batch
  FOR /L %N IN () DO @echo %time%
  ```
* Doesn't hang the UI 
2025-08-04 20:25:37 +02:00
Leonard Hecker
9ab7cf312f Remove dependency on .NET 6 and Framework 4.8 (#19199)
* .NET 6 is EOL
* Framework 4.7.2 comes by default with VS, but 4.8 doesn't
2025-08-04 13:09:22 -05:00
zwJimRaynor
a5d916f5d3 Update the version of WinUI required by the Canary appinstaller (#19048) 2025-07-29 14:12:13 -05:00
Leonard Hecker
dfcc8f3c62 Fix use-after-free when disabling the ASB (#19186)
Closes #17515

## Validation Steps Performed
* Disable the ASB while there's a pending cooked read
* Type some text
* No crash 
2025-07-29 13:48:33 -05:00
Quaylyn Rimer
e818dafa6d Fix scrollbar marks not appearing until scroll or resize (#19185)
This PR resolves an issue where scrollbar marks created by shell
integration sequences (OSC 133 FTCS, OSC 1337 iTerm2, and OSC 9;12
ConEmu sequences) were not visible on the scrollbar until the user
manually scrolled.

The problem was that while marks were being created in the buffer
correctly, the UI wasn't being notified to refresh the scrollbar
display. The fix adds a new NotifyShellIntegrationMark() method to the
ITerminalApi interface that calls _NotifyScrollEvent() to trigger
scrollbar refresh, and updates all shell integration sequence handlers
in AdaptDispatch to call this notification method after creating marks.
This ensures scrollbar marks appear immediately when shell integration
sequences are processed, bringing feature parity between auto-detected
and shell-integration-based marks.

Closes #19104
2025-07-29 12:20:47 -05:00
Leonard Hecker
0c3002c1b9 Remove ColorHelper (#19187)
Most of `ColorHelper` was unused and one of them had UB.

Related to #19183

## Validation Steps Performed
* Set a custom tabRow theme color
  Split button looks similar to before 
* White/black FG color decision for colored
  tabs is similar to before 
2025-07-29 11:35:48 -05:00
Weichen Li
7d6e0c8b8e Fix WSLENV environment variable duplication in ConptyConnection (#19167)
This PR fixes issue #7130 where WT_SESSION and WT_PROFILE_ID environment
variables were being duplicated in the WSLENV environment variable when
multiple terminal sessions were created.

The previous implementation always appended WT_SESSION:WT_PROFILE_ID: to
WSLENV without checking if these variables already existed, causing
duplication.

Closes #7130

Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
2025-07-29 01:47:06 +00:00
Dustin L. Howett
65788d9099 Filter Command Palette in English in addition to local language (#19166)
The bulk of this work is changing `Command::Name` (and its descendants
like `GenerateName`) to support looking up names in English and in the
local language.

When matching a "palette item" with a "subtitle" (a new field introduced
to store the English command name when the current language is not
English), the weight of the subtitle is used only if it is greater than
the weight of the name. This ensures that we do not penalize or
over-promote results that contain similar Latin letters in both fields.

Refs #19130, #19131, #19132, #19165
Closes #7039
2025-07-28 19:08:48 +00:00
Windows Console Service Bot
671440206c Localization Updates - main - 07/25/2025 16:15:20 (#19174)
scroll to zoom + scroll to do opacity
2025-07-25 16:52:27 +00:00
Dustin L. Howett
482980c336 Command: realize resource-key names when they are requested, not at load (#19165)
Right now, when a Command's name is `{"key": "ResourceName"}` we resolve
the resource immediately at load time. That prevents us from looking it
up later in another language if we need to.

This pull request introduces an intermediate representation for command
names which is be resolved during `Command::Name`.

Refs #7039
2025-07-24 12:53:09 -05:00
347 changed files with 6362 additions and 3444 deletions

View File

@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"XamlStyler.Console": {
"version": "3.2311.2",
"version": "3.2501.8",
"commands": [
"xstyler"
]

View File

@@ -174,9 +174,11 @@ tokeninfo
tolower
toupper
TRACKMOUSEEVENT
ubrk
UChar
UFIELD
ULARGE
UNCEx
UOI
UPDATEINIFILE
urlmon

View File

@@ -34,6 +34,7 @@ issecret
libucrt
libucrtd
LOCKFILE
LTCG
Lxss
makepri
microsoft

View File

@@ -28,6 +28,7 @@ jerrysh
Kaiyu
leonardder
lhecker
Lovecraft
masserano
menger
migrie

View File

@@ -115,7 +115,6 @@ BKCOLOR
BKGND
BKMK
Bksp
blds
Blt
blu
BLUESCROLL
@@ -142,6 +141,7 @@ BValue
Cacafire
CALLCONV
CANDRABINDU
CANTCALLOUT
capslock
CARETBLINKINGENABLED
CARRIAGERETURN
@@ -181,7 +181,6 @@ CLIPCHILDREN
CLIPSIBLINGS
closetest
cloudconsole
CLOUDT
cloudvault
CLSCTX
clsids
@@ -811,6 +810,7 @@ inclusivity
INCONTEXT
INFOEX
inheritcursor
ININPUTSYNCCALL
INITCOMMONCONTROLSEX
INITDIALOG
INITGUID
@@ -824,6 +824,7 @@ INPUTSCOPE
INSERTMODE
INTERACTIVITYBASE
INTERCEPTCOPYPASTE
internalevent
INTERNALNAME
intsafe
INVALIDARG
@@ -962,6 +963,7 @@ lstatus
lstrcmp
lstrcmpi
LTEXT
lto
ltsc
LUID
luma
@@ -1061,6 +1063,7 @@ Mypair
Myval
NAMELENGTH
namestream
NCACTIVATE
NCCALCSIZE
NCCREATE
NCLBUTTONDOWN
@@ -1091,6 +1094,8 @@ NEXTLINE
nfe
NLSMODE
NOACTIVATE
NOACTIVATEKEYBOARDLAYOUT
NOACTIVATETIP
NOAPPLYNOW
NOCLIP
NOCOMM
@@ -1505,7 +1510,6 @@ scrolllock
scrolloffset
SCROLLSCALE
SCROLLSCREENBUFFER
scursor
sddl
SDKDDK
segfault
@@ -1703,13 +1707,16 @@ TEXTMETRIC
TEXTMETRICW
textmode
texttests
TFCAT
THUMBPOSITION
THUMBTRACK
tilunittests
TIPCAP
titlebars
TITLEISLINKNAME
TLDP
TLEN
Tlgg
TMAE
TMPF
tmultiple
@@ -1756,6 +1763,8 @@ UIACCESS
uiacore
uiautomationcore
uielem
UIELEMENTENABLED
UIELEMENTENABLEDONLY
UINTs
uld
uldash
@@ -1972,6 +1981,7 @@ WRITECONSOLEOUTPUT
WRITECONSOLEOUTPUTSTRING
wrkstr
WRL
wrl
wrp
WRunoff
WSLENV

View File

@@ -17,7 +17,6 @@
"Microsoft.VisualStudio.Component.AppInsights.Tools",
"Microsoft.Net.Component.4.8.TargetingPack",
"Microsoft.VisualStudio.Component.DiagnosticTools",
"Microsoft.NetCore.Component.Runtime.6.0",
"Microsoft.VisualStudio.Component.ClassDesigner",
"Microsoft.VisualStudio.Component.GraphDocument",
"Microsoft.VisualStudio.Component.CodeMap",

View File

@@ -33,17 +33,6 @@
A:\;
E:\;
$(windir)\**;
$(MSBuildBinPath)\**;
$(MSBuildToolsPath32)\**;
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
<!--
Unit tests may write to TEMP, but should not be considered outputs. However, $(Temp) is using the DOS path (C:\Users\CLOUDT~1\AppData\Local\Temp), which
isn't accounted for in these globs. So we're building up to TEMP using $(LOCALAPPDATA) instead.
-->
<MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
$(MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns);
$(LOCALAPPDATA)\Temp\**;
</MSBuildCacheAllowFileAccessAfterProjectFinishFilePatterns>
<!--
@@ -57,15 +46,6 @@
-->
<MSBuildCacheIdenticalDuplicateOutputPatterns>$(MSBuildCacheIdenticalDuplicateOutputPatterns);obj\*\vcpkg\**</MSBuildCacheIdenticalDuplicateOutputPatterns>
<!--
Ensure the MSBuildCache ignores collecting outputs under vcpkg's build tree, which is a working directory used to build vcpkg packages and not intended to be consumed by anything else in the build.
Note: We cannot use $(VcpkgInstalledDir) directly since it differs between projects, so use a pattern which encompasses all possibilities.
-->
<MSBuildCacheIgnoredOutputPatterns>
$(MSBuildCacheIgnoredOutputPatterns);
$(SolutionDir)\obj\*\vcpkg*\vcpkg\blds\**;
</MSBuildCacheIgnoredOutputPatterns>
<!-- version of MSBuildCache is not part of the cache key -->
<PackagesConfigFile>$(MSBuildThisFileDirectory)\dep\nuget\packages.config</PackagesConfigFile>
<MSBuildCacheIgnoredInputPatterns>$(MSBuildCacheIgnoredInputPatterns);$(PackagesConfigFile)</MSBuildCacheIgnoredInputPatterns>

View File

@@ -4,7 +4,7 @@
<clear />
<!-- Dependencies that we can turn on to force override for testing purposes before uploading. -->
<!--<add key="Static Package Dependencies" value="dep\packages" />-->
<add key="TerminalDependencies" value="https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies/nuget/v3/index.json" />
<add key="TerminalDependencies" value="https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies%40Local/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />

View File

@@ -309,11 +309,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{D3EF
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winconpty.Tests.Feature", "src\winconpty\ft_pty\winconpty.FeatureTests.vcxproj", "{024052DE-83FB-4653-AEA4-90790D29D5BD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TerminalAzBridge", "src\cascadia\TerminalAzBridge\TerminalAzBridge.vcxproj", "{067F0A06-FCB7-472C-96E9-B03B54E8E18D}"
ProjectSection(ProjectDependencies) = postProject
{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B} = {CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfTerminalTestNetCore", "src\cascadia\WpfTerminalTestNetCore\WpfTerminalTestNetCore.csproj", "{1588FD7C-241E-4E7D-9113-43735F3E6BAD}"
ProjectSection(ProjectDependencies) = postProject
{CA5CAD1A-F542-4635-A069-7CAEFB930070} = {CA5CAD1A-F542-4635-A069-7CAEFB930070}
@@ -1703,30 +1698,6 @@ Global
{024052DE-83FB-4653-AEA4-90790D29D5BD}.Release|x64.Build.0 = Release|x64
{024052DE-83FB-4653-AEA4-90790D29D5BD}.Release|x86.ActiveCfg = Release|Win32
{024052DE-83FB-4653-AEA4-90790D29D5BD}.Release|x86.Build.0 = Release|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.AuditMode|Any CPU.ActiveCfg = AuditMode|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.AuditMode|ARM64.Build.0 = AuditMode|ARM64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.AuditMode|x64.ActiveCfg = Release|x64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.AuditMode|x86.ActiveCfg = AuditMode|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.AuditMode|x86.Build.0 = AuditMode|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Debug|Any CPU.ActiveCfg = Debug|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Debug|ARM64.ActiveCfg = Debug|ARM64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Debug|ARM64.Build.0 = Debug|ARM64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Debug|x64.ActiveCfg = Debug|x64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Debug|x64.Build.0 = Debug|x64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Debug|x86.ActiveCfg = Debug|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Debug|x86.Build.0 = Debug|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Fuzzing|x64.ActiveCfg = Fuzzing|x64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Release|Any CPU.ActiveCfg = Release|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Release|ARM64.ActiveCfg = Release|ARM64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Release|ARM64.Build.0 = Release|ARM64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Release|x64.ActiveCfg = Release|x64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Release|x64.Build.0 = Release|x64
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Release|x86.ActiveCfg = Release|Win32
{067F0A06-FCB7-472C-96E9-B03B54E8E18D}.Release|x86.Build.0 = Release|Win32
{1588FD7C-241E-4E7D-9113-43735F3E6BAD}.AuditMode|Any CPU.ActiveCfg = Debug|Any CPU
{1588FD7C-241E-4E7D-9113-43735F3E6BAD}.AuditMode|ARM64.ActiveCfg = Debug|Any CPU
{1588FD7C-241E-4E7D-9113-43735F3E6BAD}.AuditMode|x64.ActiveCfg = Debug|Any CPU
@@ -2303,7 +2274,6 @@ Global
{6B5A44ED-918D-4747-BFB1-2472A1FCA173} = {04170EEF-983A-4195-BFEF-2321E5E38A1E}
{D3EF7B96-CD5E-47C9-B9A9-136259563033} = {04170EEF-983A-4195-BFEF-2321E5E38A1E}
{024052DE-83FB-4653-AEA4-90790D29D5BD} = {E8F24881-5E37-4362-B191-A3BA0ED7F4EB}
{067F0A06-FCB7-472C-96E9-B03B54E8E18D} = {61901E80-E97D-4D61-A9BB-E8F2FDA8B40C}
{1588FD7C-241E-4E7D-9113-43735F3E6BAD} = {4DAF0299-495E-4CD1-A982-9BAC16A45932}
{506FD703-BAA7-4F6E-9361-64F550EC8FCA} = {61901E80-E97D-4D61-A9BB-E8F2FDA8B40C}
{416FD703-BAA7-4F6E-9361-64F550EC8FCA} = {61901E80-E97D-4D61-A9BB-E8F2FDA8B40C}

View File

@@ -56,9 +56,9 @@ This is an open source project and we welcome community participation. To partic
<ReleaseNotes _locID="App_ReleaseNotes">
<!-- _locComment_text="{MaxLength=1500} {Locked=__VERSION_NUMBER__}{Locked=wt.exe} App Release Note" -->Version __VERSION_NUMBER__
- We've added dozens of settings to the UI that once only existed in the JSON file, including a new page for customizing the layout of your New Tab menu!
- We have rearchitected window management to improve reliability; please file any bugs you encounter with the wt.exe alias
- Profiles now show an icon if they've been hidden or refer to programs which were uninstalled.
- A whole new Extensions page that shows what has been installed into your Terminal
- Command Palette now shows up in your native language as well as English
- New VT features such as synchronized rendering, new color schemes, configuration for quick mouse actions like zooming, and more
Please see our GitHub releases page for additional details.
</ReleaseNotes>

View File

@@ -20,6 +20,7 @@
"DisableAutoPackageNameFormatting": false
},
"appSubmission": {
"appId": "9N8G5RFZ9XK3",
"productId": "00014050269303149694",
"targetPublishMode": "NotSet",
"targetPublishDate": null,

View File

@@ -54,14 +54,11 @@ This is an open source project and we welcome community participation. To partic
<!-- _locComment_text="{MaxLength=255} App DevStudio" -->
</DevStudio>
<ReleaseNotes _locID="App_ReleaseNotes">
<!-- _locComment_text="{MaxLength=1500} {Locked=__VERSION_NUMBER__} App Release Note" -->Version __VERSION_NUMBER__
<!-- _locComment_text="{MaxLength=1500} {Locked=__VERSION_NUMBER__}{Locked=wt.exe} App Release Note" -->Version __VERSION_NUMBER__
- We've rewritten how console applications are hosted inside Terminal! Please report any bugs you encounter.
- Terminal now supports Sixels!
- You can now open a docked panel containing snippets of commands you have saved to use later
- Command Prompt users on the latest Windows 11 release may see a "quick tip" icon that suggests installable software from WinGet
- Selected text will now be much more visible (and customizable!)
- A number of reliabilty bugs, convenience issues and annoyances have been fixed.
- We've added dozens of settings to the UI that once only existed in the JSON file, including a new page for customizing the layout of your New Tab menu!
- We have rearchitected window management to improve reliability; please file any bugs you encounter with the wt.exe alias
- Profiles now show an icon if they've been hidden or refer to programs which were uninstalled.
Please see our GitHub releases page for additional details.
</ReleaseNotes>

View File

@@ -20,6 +20,7 @@
"DisableAutoPackageNameFormatting": false
},
"appSubmission": {
"appId": "9N0DX20HK701",
"productId": "00013926773940052066",
"targetPublishMode": "NotSet",
"targetPublishDate": null,

View File

@@ -4,7 +4,7 @@
"collection": "microsoft",
"project": "OS",
"repo": "os.2020",
"name": "official/rs_we_adept_e4d2",
"name": "official/ge_current_directwinpd_deep",
"workitem": "38106206",
"CheckinFiles": [
{

View File

@@ -17,7 +17,6 @@
"PackageContents/WindowsTerminalShellExt.dll",
// The rest
"PackageContents/TerminalAzBridge.exe",
"PackageContents/wt.exe",
"PackageContents/WindowsTerminal.exe",
"PackageContents/elevate-shim.exe"

View File

@@ -2,7 +2,7 @@
{
"MatchedPath": [
"WpfTerminalControl/net472/Microsoft.Terminal.Wpf.dll",
"WpfTerminalControl/net6.0-windows/Microsoft.Terminal.Wpf.dll"
"WpfTerminalControl/net8.0-windows/Microsoft.Terminal.Wpf.dll"
],
"SigningInfo": {
"Operations": [

View File

@@ -14,21 +14,21 @@
<Package
Name="Microsoft.UI.Xaml.2.8"
Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
Version="8.2305.5001.0"
Version="8.2306.22001.0"
ProcessorArchitecture="x64"
Uri="https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.4/Microsoft.UI.Xaml.2.8.x64.appx" />
Uri="https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.5/Microsoft.UI.Xaml.2.8.x64.appx" />
<Package
Name="Microsoft.UI.Xaml.2.8"
Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
Version="8.2305.5001.0"
Version="8.2306.22001.0"
ProcessorArchitecture="x86"
Uri="https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.4/Microsoft.UI.Xaml.2.8.x86.appx" />
Uri="https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.5/Microsoft.UI.Xaml.2.8.x86.appx" />
<Package
Name="Microsoft.UI.Xaml.2.8"
Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
Version="8.2305.5001.0"
Version="8.2306.22001.0"
ProcessorArchitecture="arm64"
Uri="https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.4/Microsoft.UI.Xaml.2.8.arm64.appx" />
Uri="https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.5/Microsoft.UI.Xaml.2.8.arm64.appx" />
</Dependencies>
<UpdateSettings>

View File

@@ -9,7 +9,7 @@
<PropertyGroup>
<!-- Optional, defaults to main. Name of the branch which will be used for calculating branch point. -->
<PGOBranch>main</PGOBranch>
<PGOBranch>release-1.24</PGOBranch>
<!-- Mandatory. Name of the NuGet package which will contain PGO databases for consumption by build system. -->
<PGOPackageName>Microsoft.Internal.Windows.Terminal.PGODatabase</PGOPackageName>

View File

@@ -84,7 +84,7 @@ stages:
buildEverything: true
keepAllExpensiveBuildOutputs: false
${{ if eq(variables['System.PullRequest.IsFork'], 'False') }}:
enableMsBuildCaching: true
enableCaching: true
- ${{ if eq(parameters.runTests, true) }}:
- stage: Test_${{ platform }}

View File

@@ -25,8 +25,6 @@ pr:
variables:
- name: runCodesignValidationInjectionBG
value: false
- name: EnablePipelineCache
value: true
# 0.0.yyMM.dd##
# 0.0.1904.0900
@@ -47,10 +45,6 @@ parameters:
- x64
- x86
- arm64
- name: enableMsBuildCaching
type: boolean
displayName: "Enable MSBuild Caching"
default: true
stages:
- ${{ if eq(parameters.auditMode, true) }}:
@@ -93,8 +87,6 @@ stages:
buildConfigurations: [Release]
buildEverything: true
keepAllExpensiveBuildOutputs: false
${{ if eq(variables['System.PullRequest.IsFork'], 'False') }}:
enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }}
- ${{ if eq(parameters.runTests, true) }}:
- stage: Test_${{ platform }}

View File

@@ -53,8 +53,12 @@ parameters:
displayName: "Publish Symbols to MSDL"
type: boolean
default: true
- name: createVpack
displayName: "Create a VPack for Windows"
type: boolean
default: false
- name: publishVpackToWindows
displayName: "Publish VPack to Windows"
displayName: "Publish above VPack to Windows"
type: boolean
default: false
@@ -89,6 +93,7 @@ extends:
clientId: $(SigningOriginalClientId)
terminalInternalPackageVersion: ${{ parameters.terminalInternalPackageVersion }}
publishSymbolsToPublic: ${{ parameters.publishSymbolsToPublic }}
createVpack: ${{ parameters.createVpack }}
publishVpackToWindows: ${{ parameters.publishVpackToWindows }}
symbolPublishingSubscription: $(SymbolPublishingServiceConnection)
symbolPublishingProject: $(SymbolPublishingProject)

View File

@@ -50,6 +50,7 @@ stages:
buildEverything: true
pgoBuildMode: Instrument
artifactStem: -instrumentation
keepAllExpensiveBuildOutputs: false # the ARM64 build agent runs out of memory downloading the artifacts...
- stage: RunPGO
displayName: Run PGO

View File

@@ -68,7 +68,7 @@ parameters:
- name: signingIdentity
type: object
default: {}
- name: enableMsBuildCaching
- name: enableCaching
type: boolean
default: false
@@ -144,7 +144,7 @@ jobs:
}
displayName: Prepare Build and Sign Targets
- ${{ if eq(parameters.enableMsBuildCaching, true) }}:
- ${{ if eq(parameters.enableCaching, true) }}:
- pwsh: |-
$MSBuildCacheParameters = ""
$MSBuildCacheParameters += " -graph"
@@ -183,7 +183,7 @@ jobs:
configuration: $(BuildConfiguration)
msbuildArchitecture: x64
maximumCpuCount: true
${{ if eq(parameters.enableMsBuildCaching, true) }}:
${{ if eq(parameters.enableCaching, true) }}:
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
@@ -192,7 +192,7 @@ jobs:
artifact: logs-$(BuildPlatform)-$(BuildConfiguration)${{ parameters.artifactStem }}
condition: always()
displayName: Publish Build Log
- ${{ if eq(parameters.enableMsBuildCaching, true) }}:
- ${{ if eq(parameters.enableCaching, true) }}:
- publish: $(Build.SourcesDirectory)\MSBuildCacheLogs
artifact: logs-msbuildcache-$(BuildPlatform)-$(BuildConfiguration)${{ parameters.artifactStem }}
condition: always()
@@ -203,7 +203,7 @@ jobs:
inputs:
contents: $(Build.SourcesDirectory)/msbuild.binlog
TargetFolder: $(Terminal.BinDir)
- ${{ if eq(parameters.enableMsBuildCaching, true) }}:
- ${{ if eq(parameters.enableCaching, true) }}:
- task: CopyFiles@2
displayName: Copy MSBuildCache Logs
inputs:

View File

@@ -86,7 +86,7 @@ jobs:
$MachineToken = $env:SYSTEM_ACCESSTOKEN | ConvertTo-SecureString -AsPlainText -Force
$Credential = [PSCredential]::new("ONEBRANCH_TOKEN", $MachineToken)
$MachineToken = $null
$Feed = "https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies/nuget/v3/index.json"
$Feed = "https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies%40Local/nuget/v3/index.json"
Register-PSResourceRepository -Name "PSGalleryUpstream" -Uri $Feed -Trusted
Get-PSResourceRepository

View File

@@ -26,6 +26,7 @@ jobs:
pgoToolsPath: $(Build.SourcesDirectory)\build\PGO
nuspecPath: $(pgoToolsPath)\NuSpecs
nuspecFilename: PGO.nuspec
nugetFeed: "https://pkgs.dev.azure.com/shine-oss/terminal/_packaging/TerminalDependencies/nuget/v3/index.json"
steps:
- checkout: self
@@ -45,7 +46,8 @@ jobs:
- task: NuGetAuthenticate@1
inputs:
nuGetServiceConnections: 'Terminal Public Artifact Feed'
azureDevOpsServiceConnection: 'Terminal Public Artifact Feed'
feedUrl: $(nugetFeed)
# In the Microsoft Azure DevOps tenant, NuGetCommand is ambiguous.
# This should be `task: NuGetCommand@2`
@@ -68,15 +70,7 @@ jobs:
artifact: pgo-nupkg-${{ parameters.buildConfiguration }}${{ parameters.artifactStem }}
displayName: "Publish Pipeline Artifact"
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: 'NuGet push'
inputs:
command: push
nuGetFeedType: external
packagesToPush: $(Build.ArtifactStagingDirectory)/*.nupkg
# The actual URL and PAT for this feed is configured at
# https://microsoft.visualstudio.com/Dart/_settings/adminservices
# This is the name of that connection
publishFeedCredentials: 'Terminal Public Artifact Feed'
feedsToUse: config
nugetConfigPath: '$(Build.SourcesDirectory)/NuGet.config'
- pwsh: |-
$nupkg = Get-Item "$(Build.ArtifactStagingDirectory)/*.nupkg"
& nuget push -ApiKey az -Source "$(nugetFeed)" "$nupkg"
displayName: NuGet push

View File

@@ -45,6 +45,10 @@ jobs:
displayName: Extract the unpackaged build for PGO
- template: steps-ensure-nuget-version.yml
parameters:
${{ if eq(parameters.buildPlatform, 'arm64') }}:
# The ARM64 agents do not seem to have NuGet installed
forceNugetInstallation: true
- powershell: |-
$Package = 'Microsoft.Internal.Windows.Terminal.TestContent'

View File

@@ -69,10 +69,3 @@ jobs:
artifact: $(JobOutputArtifactName)
displayName: 'Publish VPack Manifest to Drop'
- task: PkgESFCIBGit@12
displayName: 'Submit VPack Manifest to Windows'
inputs:
configPath: '$(Build.SourcesDirectory)\build\config\GitCheckin.json'
artifactsDirectory: $(XES_VPACKMANIFESTDIRECTORY)
prTimeOut: 5

View File

@@ -49,6 +49,9 @@ parameters:
- name: symbolExpiryTime
type: string
default: 36530 # This is the default from PublishSymbols@2
- name: createVpack
type: boolean
default: false
- name: publishVpackToWindows
type: boolean
default: false
@@ -192,8 +195,8 @@ extends:
ob_outputDirectory: $(JobOutputDirectory)
ob_artifactBaseName: $(JobOutputArtifactName)
### This job is also in charge of submitting the vpack to Windows if it's enabled
ob_createvpack_enabled: ${{ and(parameters.buildTerminal, parameters.publishVpackToWindows) }}
ob_updateOSManifest_enabled: ${{ and(parameters.buildTerminal, parameters.publishVpackToWindows) }}
ob_createvpack_enabled: ${{ and(parameters.buildTerminal, parameters.createVpack) }}
ob_updateOSManifest_enabled: ${{ and(parameters.buildTerminal, parameters.createVpack, parameters.publishVpackToWindows) }}
### If enabled above, these options are in play.
ob_createvpack_packagename: 'WindowsTerminal.app'
ob_createvpack_owneralias: 'conhost@microsoft.com'
@@ -207,6 +210,8 @@ extends:
ob_createvpack_taskLogVerbosity: Detailed
ob_createvpack_verbose: true
ob_createvpack_vpackdirectory: '$(JobOutputDirectory)\vpack'
ob_createvpack_versionAs: string
ob_createvpack_version: '$(XES_PACKAGEVERSIONNUMBER)'
ob_updateOSManifest_gitcheckinConfigPath: '$(Build.SourcesDirectory)\build\config\GitCheckin.json'
# We're skipping the 'fetch' part of the OneBranch rules, but that doesn't mean
# that it doesn't expect to have downloaded a manifest directly to some 'destination'
@@ -229,7 +234,7 @@ extends:
New-Item "$(JobOutputDirectory)/vpack" -Type Directory
displayName: Make sure the vpack directory exists
- ${{ if parameters.publishVpackToWindows }}:
- ${{ if parameters.createVpack }}:
- pwsh: |-
Copy-Item -Verbose -Path "$(MsixBundlePath)" -Destination (Join-Path "$(JobOutputDirectory)/vpack" 'Microsoft.WindowsTerminal_8wekyb3d8bbwe.msixbundle')
displayName: Stage msixbundle for vpack

View File

@@ -1,5 +1,10 @@
parameters:
- name: forceNugetInstallation
type: boolean
default: false
steps:
- ${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
- ${{ if and(ne(parameters.forceNugetInstallation, true), eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564')) }}:
- pwsh: |-
Write-Host "Assuming NuGet is already installed..."
& nuget.exe help
@@ -7,6 +12,6 @@ steps:
- ${{ else }}:
- task: NuGetToolInstaller@1
displayName: Use NuGet 6.6.1
displayName: Use NuGet 7.0.1
inputs:
versionSpec: 6.6.1
versionSpec: 7.0.1

View File

@@ -4,8 +4,8 @@
<!-- Native packages -->
<package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
<package id="Microsoft.Taef" version="10.93.240607003" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.230207.1" targetFramework="native" />
<package id="Microsoft.Internal.Windows.Terminal.ThemeHelpers" version="0.7.230706001" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
<package id="Microsoft.Internal.Windows.Terminal.ThemeHelpers" version="0.8.250811004" targetFramework="native" />
<package id="Microsoft.VisualStudio.Setup.Configuration.Native" version="2.3.2262" targetFramework="native" developmentDependency="true" />
<package id="Microsoft.UI.Xaml" version="2.8.4" targetFramework="native" />
<package id="Microsoft.Web.WebView2" version="1.0.1661.34" targetFramework="native" />
@@ -20,7 +20,7 @@
<package id="Selenium.WebDriver" version="3.5.0" targetFramework="net45" />
<!-- MSBuildCache -->
<package id="Microsoft.MSBuildCache.AzurePipelines" version="0.1.318-preview" />
<package id="Microsoft.MSBuildCache.Local" version="0.1.318-preview" />
<package id="Microsoft.MSBuildCache.SharedCompilation" version="0.1.318-preview" />
<package id="Microsoft.MSBuildCache.AzurePipelines" version="0.1.283-preview" />
<package id="Microsoft.MSBuildCache.Local" version="0.1.283-preview" />
<package id="Microsoft.MSBuildCache.SharedCompilation" version="0.1.283-preview" />
</packages>

View File

@@ -2302,8 +2302,15 @@
"additionalProperties": false,
"properties": {
"id": {
"description": "The ID of the command this keybinding should execute.",
"type": "string"
"description": "The ID of the command this keybinding should execute (or null to disable a default).",
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"keys": {
"description": "Defines the key combinations used to call the command. It must be composed of...\n -any number of modifiers (ctrl/alt/shift)\n -a non-modifier key",
@@ -2459,6 +2466,7 @@
"description": "Direct3D 11 provides a more performant and feature-rich experience, whereas Direct2D is more stable. The default option \"Automatic\" will pick the API that best fits your graphics hardware. If you experience significant issues, consider using Direct2D.",
"type": "string",
"enum": [
"automatic",
"direct2d",
"direct3d11"
]
@@ -2472,8 +2480,9 @@
"type": "boolean"
},
"experimental.input.forceVT": {
"description": "Force the terminal to use the legacy input encoding. Certain keys in some applications may stop working when enabling this setting.",
"type": "boolean"
"type": "boolean",
"description": "[Deprecated] Replaced with the \"compatibility.input.forceVT\" profile setting.",
"deprecated": true
},
"experimental.useBackgroundImageForWindow": {
"default": false,
@@ -2520,14 +2529,14 @@
"type": "string"
},
"rowsToScroll": {
"default": "system",
"description": "This parameter once allowed you to override the systemwide \"choose how many lines to scroll at one time\" setting. It no longer does so. However, you can customize the number of lines to scroll in \"scrollUp\" and \"scrollDown\" bindings.",
"maximum": 999,
"minimum": 0,
"type": [
"integer",
"string"
],
"description": "[Deprecated] This setting no longer has any effect. However, you can customize the number of lines to scroll using the \"rowsToScroll\" argument on the \"scrollUp\" and \"scrollDown\" actions.",
"default": "system",
"minimum": 0,
"maximum": 999,
"deprecated": true
},
"minimizeToNotificationArea": {
@@ -2573,9 +2582,12 @@
"$ref": "#/$defs/NewTabMenu"
},
"language": {
"default": "",
"type": [
"string",
"null"
],
"description": "Sets an override for the app's preferred language, expressed as a BCP-47 language tag like en-US.",
"type": "string"
"default": null
},
"theme": {
"default": "dark",
@@ -2639,19 +2651,19 @@
"type": "boolean"
},
"useTabSwitcher": {
"description": "[Deprecated] Replaced with the \"tabSwitcherMode\" setting.",
"default": true,
"description": "Deprecated. Please use \"tabSwitcherMode\" instead.",
"oneOf": [
{
"type": "boolean"
},
{
"type": "string",
"enum": [
"mru",
"inOrder",
"disabled"
],
"type": "string"
]
}
],
"deprecated": true
@@ -2708,12 +2720,12 @@
"type": "object",
"properties": {
"acrylicOpacity": {
"type": "number",
"description": "[Deprecated] Replaced with the \"opacity\" setting.",
"default": 0.5,
"description": "[deprecated] Please use `opacity` instead.",
"deprecated": true,
"maximum": 1,
"minimum": 0,
"type": "number"
"maximum": 1,
"deprecated": true
},
"antialiasingMode": {
"default": "grayscale",
@@ -2739,6 +2751,11 @@
"description": "When set to true, when opening a new tab or pane it will get reloaded environment variables.",
"type": "boolean"
},
"compatibility.input.forceVT": {
"default": false,
"description": "Force the terminal to use the legacy input encoding. Certain keys in some applications may stop working when enabling this setting.",
"type": "boolean"
},
"compatibility.allowDECRQCRA": {
"default": false,
"description": "When set to true, the terminal will support the DECRQCRA (Request Checksum of Rectangular Area) escape sequence.",
@@ -2910,24 +2927,29 @@
"type": "boolean"
},
"experimental.autoMarkPrompts": {
"deprecated": true,
"description": "This has been replaced by autoMarkPrompts in 1.21",
"type": "boolean"
"type": "boolean",
"description": "[Deprecated] Replaced with the \"autoMarkPrompts\" setting.",
"deprecated": true
},
"experimental.retroTerminalEffect": {
"description": "When set to true, enable retro terminal effects. This is an experimental feature, and its continued existence is not guaranteed.",
"type": "boolean"
},
"experimental.showMarksOnScrollbar": {
"deprecated": true,
"description": "This has been replaced by showMarksOnScrollbar in 1.21",
"type": "boolean"
"type": "boolean",
"description": "[Deprecated] Replaced with the \"showMarksOnScrollbar\" setting.",
"deprecated": true
},
"showMarksOnScrollbar": {
"default": false,
"description": "When set to true, marks added to the buffer via the addMark action will appear on the scrollbar.",
"type": "boolean"
},
"experimental.rainbowSuggestions": {
"type": "boolean",
"description": "Enables displaying command suggestions in the terminal in RGB (all the colors of the rainbow!).",
"default": false
},
"experimental.rightClickContextMenu": {
"default": false,
"description": "When true, right-click shows a context menu; otherwise, it pastes from the clipboard or copies selection.",
@@ -2943,23 +2965,29 @@
"type": "string"
},
"fontFace": {
"default": "Cascadia Mono",
"description": "[deprecated] Define 'face' within the 'font' object instead.",
"type": "string",
"description": "[Deprecated] Replaced with the \"face\" setting within the \"font\" object.",
"default": "Cascadia Mono",
"deprecated": true
},
"fontSize": {
"default": 12,
"description": "[deprecated] Define 'size' within the 'font' object instead.",
"minimum": 1,
"type": "number",
"description": "[Deprecated] Replaced with the \"size\" setting within the \"font\" object.",
"default": 12,
"minimum": 1,
"deprecated": true
},
"fontWeight": {
"description": "[Deprecated] Replaced with the \"weight\" setting within the \"font\" object.",
"default": "normal",
"description": "[deprecated] Define 'weight' within the 'font' object instead.",
"oneOf": [
{
"type": "integer",
"minimum": 100,
"maximum": 990
},
{
"type": "string",
"enum": [
"thin",
"extra-light",
@@ -2972,13 +3000,7 @@
"extra-bold",
"black",
"extra-black"
],
"type": "string"
},
{
"maximum": 990,
"minimum": 100,
"type": "integer"
]
}
],
"deprecated": true
@@ -3089,7 +3111,10 @@
},
"answerbackMessage": {
"description": "The response that is sent when an ENQ control character is received.",
"type": "string"
"type": [
"string",
"null"
]
},
"source": {
"description": "Stores the name of the profile generator that originated this profile.",

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.230207.1" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
<package id="Microsoft.UI.Xaml" version="2.8.4" targetFramework="native" />
<package id="Microsoft.Web.WebView2" version="1.0.1661.34" targetFramework="native" />
</packages>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.CppWinRT" version="2.0.230207.1" targetFramework="native" />
<package id="Microsoft.Windows.CppWinRT" version="2.0.250303.1" targetFramework="native" />
<package id="Microsoft.UI.Xaml" version="2.8.4" targetFramework="native" />
<package id="Microsoft.Web.WebView2" version="1.0.1661.34" targetFramework="native" />
</packages>

View File

@@ -942,12 +942,12 @@ void ROW::_resizeChars(uint16_t colEndDirty, uint16_t chBegDirty, size_t chEndDi
}
}
til::small_rle<TextAttribute, uint16_t, 1>& ROW::Attributes() noexcept
RowAttributes& ROW::Attributes() noexcept
{
return _attr;
}
const til::small_rle<TextAttribute, uint16_t, 1>& ROW::Attributes() const noexcept
const RowAttributes& ROW::Attributes() const noexcept
{
return _attr;
}

View File

@@ -14,6 +14,11 @@
class ROW;
class TextBuffer;
// Because MarkKind::Output gets set only on the actually written text,
// most rows will end up having at least 2 runs: The start of the line
// with MarkKind::Output and the rest of the line with MarkKind::None.
using RowAttributes = til::small_rle<TextAttribute, uint16_t, 2>;
enum class DelimiterClass
{
ControlChar,
@@ -149,8 +154,8 @@ public:
void ReplaceText(RowWriteState& state);
void CopyTextFrom(RowCopyTextFromState& state);
til::small_rle<TextAttribute, uint16_t, 1>& Attributes() noexcept;
const til::small_rle<TextAttribute, uint16_t, 1>& Attributes() const noexcept;
RowAttributes& Attributes() noexcept;
const RowAttributes& Attributes() const noexcept;
TextAttribute GetAttrByColumn(til::CoordType column) const;
std::vector<uint16_t> GetHyperlinks() const;
ImageSlice* SetImageSlice(ImageSlice::Pointer imageSlice) noexcept;
@@ -298,7 +303,7 @@ private:
std::span<uint16_t> _charOffsets;
// _attr is a run-length-encoded vector of TextAttribute with a decompressed
// length equal to _columnCount (= 1 TextAttribute per column).
til::small_rle<TextAttribute, uint16_t, 1> _attr;
RowAttributes _attr;
// The width of the row in visual columns.
uint16_t _columnCount = 0;
// Stores double-width/height (DECSWL/DECDWL/DECDHL) attributes.

View File

@@ -77,9 +77,6 @@
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\WindowsTerminal\WindowsTerminal.vcxproj">
<Project>{CA5CAD1A-1754-4A9D-93D7-857A9D17CB1B}</Project>
</ProjectReference>
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalAzBridge\TerminalAzBridge.vcxproj">
<Project>{067F0A06-FCB7-472C-96E9-B03B54E8E18D}</Project>
</ProjectReference>
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\ShellExtension\WindowsTerminalShellExt.vcxproj">
<Project>{f2ed628a-db22-446f-a081-4cc845b51a2b}</Project>
</ProjectReference>

View File

@@ -21,6 +21,7 @@ namespace TerminalAppLocalTests
_value{ value } {}
winrt::hstring Name() { return _value; }
winrt::hstring Subtitle() { return {}; }
winrt::hstring KeyChordText() { return {}; }
winrt::hstring Icon() { return {}; }

View File

@@ -24,6 +24,7 @@
<PropertyGroup Label="NuGet Dependencies">
<!-- TerminalCppWinrt is intentionally not set -->
<TerminalMUX>true</TerminalMUX>
<TerminalThemeHelpers>true</TerminalThemeHelpers>
</PropertyGroup>
<Import Project="$(SolutionDir)\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />

View File

@@ -548,7 +548,9 @@ namespace winrt::TerminalApp::implementation
{
if (const auto& realArgs = args.ActionArgs().try_as<CopyTextArgs>())
{
const auto handled = _CopyText(realArgs.DismissSelection(), realArgs.SingleLine(), realArgs.WithControlSequences(), realArgs.CopyFormatting());
const auto copyFormatting = realArgs.CopyFormatting();
const auto format = copyFormatting ? copyFormatting.Value() : _settings.GlobalSettings().CopyFormatting();
const auto handled = _CopyText(realArgs.DismissSelection(), realArgs.SingleLine(), realArgs.WithControlSequences(), format);
args.Handled(handled);
}
}
@@ -898,7 +900,10 @@ namespace winrt::TerminalApp::implementation
co_return;
}
// Hop to the BG thread
// ShellExecuteExW may block, so do it on a background thread.
//
// NOTE: All remaining code of this function doesn't touch `this`, so we don't need weak/strong_ref.
// NOTE NOTE: Don't touch `this` when you make changes here.
co_await winrt::resume_background();
// This will get us the correct exe for dev/preview/release. If you
@@ -1451,6 +1456,8 @@ namespace winrt::TerminalApp::implementation
safe_void_coroutine TerminalPage::_doHandleSuggestions(SuggestionsArgs realArgs)
{
const auto weak = get_weak();
const auto dispatcher = Dispatcher();
const auto source = realArgs.Source();
std::vector<Command> commandsCollection;
Control::CommandHistoryContext context{ nullptr };
@@ -1517,7 +1524,12 @@ namespace winrt::TerminalApp::implementation
}
}
co_await wil::resume_foreground(Dispatcher());
co_await wil::resume_foreground(dispatcher);
const auto strong = weak.get();
if (!strong)
{
co_return;
}
// Open the palette with all these commands in it.
_OpenSuggestions(_GetActiveControl(),

View File

@@ -135,15 +135,24 @@ namespace winrt::TerminalApp::implementation
_isElevated = ::Microsoft::Console::Utils::IsRunningElevated();
_canDragDrop = ::Microsoft::Console::Utils::CanUwpDragDrop();
_reloadSettings = std::make_shared<ThrottledFuncTrailing<>>(winrt::Windows::System::DispatcherQueue::GetForCurrentThread(), std::chrono::milliseconds(100), [weakSelf = get_weak()]() {
if (auto self{ weakSelf.get() })
{
self->ReloadSettings();
}
});
_reloadSettings = std::make_shared<ThrottledFunc<>>(
DispatcherQueue::GetForCurrentThread(),
til::throttled_func_options{
.delay = std::chrono::milliseconds{ 100 },
.debounce = true,
.trailing = true,
},
[weakSelf = get_weak()]() {
if (auto self{ weakSelf.get() })
{
self->ReloadSettings();
}
});
_languageProfileNotifier = winrt::make_self<LanguageProfileNotifier>([this]() {
_reloadSettings->Run();
// TODO: This is really bad, because we reset any current user customizations.
// See GH#11522.
ReloadSettingsThrottled();
});
// Do this here, rather than at the top of main. This will prevent us from
@@ -323,7 +332,7 @@ namespace winrt::TerminalApp::implementation
if (modifiedBasename == settingsBasename)
{
_reloadSettings->Run();
ReloadSettingsThrottled();
}
});
}
@@ -429,6 +438,11 @@ namespace winrt::TerminalApp::implementation
SettingsChanged.raise(*this, *ev);
}
void AppLogic::ReloadSettingsThrottled()
{
_reloadSettings->Run();
}
// This is a continuation of AppLogic::Create() and includes the more expensive parts.
void AppLogic::NotifyRootInitialized()
{

View File

@@ -36,6 +36,7 @@ namespace winrt::TerminalApp::implementation
bool IsRunningElevated() const noexcept;
bool CanDragDrop() const noexcept;
void ReloadSettings();
void ReloadSettingsThrottled();
void NotifyRootInitialized();
bool HasSettingsStartupActions() const noexcept;
@@ -64,7 +65,7 @@ namespace winrt::TerminalApp::implementation
bool _hasSettingsStartupActions{ false };
::TerminalApp::AppCommandlineArgs _settingsAppArgs;
std::shared_ptr<ThrottledFuncTrailing<>> _reloadSettings;
std::shared_ptr<ThrottledFunc<>> _reloadSettings;
std::vector<Microsoft::Terminal::Settings::Model::SettingsLoadWarnings> _warnings{};
@@ -80,7 +81,6 @@ namespace winrt::TerminalApp::implementation
[[nodiscard]] HRESULT _TryLoadSettings() noexcept;
void _ProcessLazySettingsChanges();
void _RegisterSettingsChange();
safe_void_coroutine _DispatchReloadSettings();
void _setupFolderPathEnvVar();

View File

@@ -25,6 +25,7 @@ namespace TerminalApp
Boolean HasSettingsStartupActions();
void ReloadSettings();
void ReloadSettingsThrottled();
Microsoft.Terminal.Settings.Model.CascadiaSettings Settings { get; };
TerminalWindow CreateNewWindow();

View File

@@ -1,267 +0,0 @@
#include "ColorHelper.h"
using namespace winrt::TerminalApp;
// Method Description:
// Determines whether or not a given color is light
// Arguments:
// - color: this color is going to be examined whether it
// is light or not
// Return Value:
// - true if light, false if dark
bool ColorHelper::IsBrightColor(const winrt::Windows::UI::Color& color)
{
// https://www.w3.org/TR/AERT#color-contrast
auto brightness = (color.R * 299 + color.G * 587 + color.B * 114) / 1000.f;
return brightness > 128.f;
}
// Method Description:
// Converts a rgb color to an hsl one
// Arguments:
// - color: the rgb color, which is going to be converted
// Return Value:
// - a hsl color with the following ranges
// - H: [0.f -360.f]
// - L: [0.f - 1.f] (rounded to the third decimal place)
// - S: [0.f - 1.f] (rounded to the third decimal place)
HSL ColorHelper::RgbToHsl(const winrt::Windows::UI::Color& color)
{
// https://www.rapidtables.com/convert/color/rgb-to-hsl.html
auto epsilon = std::numeric_limits<float>::epsilon();
auto r = color.R / 255.f;
auto g = color.G / 255.f;
auto b = color.B / 255.f;
auto max = std::max(r, std::max(g, b));
auto min = std::min(r, std::min(g, b));
auto delta = max - min;
auto h = 0.f;
auto s = 0.f;
auto l = (max + min) / 2;
if (delta < epsilon || max < epsilon) /* delta == 0 || max == 0*/
{
l = std::roundf(l * 1000) / 1000;
return HSL{ h, s, l };
}
s = l > 0.5 ? delta / (2 - max - min) : delta / (max + min);
if (max - r < epsilon) // max == r
{
h = (g - b) / delta + (g < b ? 6 : 0);
}
else if (max - g < epsilon) // max == g
{
h = (b - r) / delta + 2;
}
else if (max - b < epsilon) // max == b
{
h = (r - g) / delta + 4;
}
// three decimal places after the comma ought
// to be enough for everybody - Bill Gates, 1981
auto finalH = std::roundf(h * 60);
auto finalS = std::roundf(s * 1000) / 1000;
auto finalL = std::roundf(l * 1000) / 1000;
return HSL{ finalH, finalS, finalL };
}
// Method Description:
// Converts a hsl color to rgb one
// Arguments:
// - color: the hsl color, which is going to be converted
// Return Value:
// - the rgb color (r,g,b - [0, 255] range)
winrt::Windows::UI::Color ColorHelper::HslToRgb(const HSL& color)
{
auto epsilon = std::numeric_limits<float>::epsilon();
auto h = (color.H - 1.f > epsilon) ? color.H / 360.f : color.H;
auto s = (color.S - 1.f > epsilon) ? color.S / 100.f : color.S;
auto l = (color.L - 1.f > epsilon) ? color.L / 100.f : color.L;
auto r = l;
auto g = l;
auto b = l;
if (s > epsilon)
{
auto q = l < 0.5 ? l * (1 + s) : l + s - l * s;
auto p = 2 * l - q;
r = HueToRgb(p, q, h + 1.f / 3.f);
g = HueToRgb(p, q, h);
b = HueToRgb(p, q, h - 1.f / 3.f);
}
auto finalR = static_cast<uint8_t>(std::roundf(r * 255));
auto finalG = static_cast<uint8_t>(std::roundf(g * 255));
auto finalB = static_cast<uint8_t>(std::roundf(b * 255));
uint8_t finalA = 255; //opaque
return winrt::Windows::UI::ColorHelper::FromArgb(finalA, finalR, finalG, finalB);
}
float ColorHelper::HueToRgb(float p, float q, float t)
{
auto epsilon = std::numeric_limits<float>::epsilon();
if (t < 0)
t += 1;
if (t > 1)
t -= 1;
if (t - (1.f / 6.f) < epsilon)
return p + (q - p) * 6 * t;
if (t - .5f < epsilon)
return q;
if (t - 2.f / 3.f < epsilon)
return p + (q - p) * (2.f / 3.f - t) * 6;
return p;
}
// Method Description:
// Lightens a color by a given amount
// Arguments:
// - color: the color which is going to be lightened
// - amount: the lighten amount (0-100)
// Return Value:
// - the lightened color in RGB format
winrt::Windows::UI::Color ColorHelper::Lighten(const winrt::Windows::UI::Color& color, float amount /* = 10.f*/)
{
auto hsl = RgbToHsl(color);
hsl.L += amount / 100;
hsl.L = std::clamp(hsl.L, 0.f, 1.f);
return HslToRgb(hsl);
}
// Method Description:
// Darkens a color by a given amount
// Arguments:
// - color: the color which is going to be darkened
// - amount: the darken amount (0-100)
// Return Value:
// - the darkened color in RGB format
winrt::Windows::UI::Color ColorHelper::Darken(const winrt::Windows::UI::Color& color, float amount /* = 10.f*/)
{
auto hsl = RgbToHsl(color);
hsl.L -= amount / 100;
hsl.L = std::clamp(hsl.L, 0.f, 1.f);
return HslToRgb(hsl);
}
// Method Description:
// Gets an accent color to a given color. Basically, generates
// 16 shades of the color and finds the first which has a good
// contrast according to https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
// Readability ratio of 3.5 seems to look quite nicely
// Arguments:
// - color: the color for which we need an accent
// Return Value:
// - the accent color in RGB format
winrt::Windows::UI::Color ColorHelper::GetAccentColor(const winrt::Windows::UI::Color& color)
{
auto accentColor = RgbToHsl(color);
if (accentColor.S < 0.15)
{
accentColor.S = 0.15f;
}
constexpr auto shadeCount = 16;
constexpr auto shadeStep = 1.f / shadeCount;
auto shades = std::map<float, HSL>();
for (auto i = 0; i < 15; i++)
{
auto shade = HSL{ accentColor.H, accentColor.S, i * shadeStep };
auto contrast = GetReadability(shade, accentColor);
shades.insert(std::make_pair(contrast, shade));
}
// 3f is quite nice if the whole non-client area is painted
constexpr auto readability = 1.75f;
for (auto shade : shades)
{
if (shade.first >= readability)
{
return HslToRgb(shade.second);
}
}
return HslToRgb(shades.end()->second);
}
// Method Description:
// Gets the readability of two colors according to
// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
// Arguments:
// - firstColor: the first color for the readability check (hsl)
// - secondColor: the second color for the readability check (hsl)
// Return Value:
// - the readability of the colors according to (WCAG Version 2)
float ColorHelper::GetReadability(const HSL& first, const HSL& second)
{
return GetReadability(HslToRgb(first), HslToRgb(second));
}
// Method Description:
// Gets the readability of two colors according to
// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
// Arguments:
// - firstColor: the first color for the readability check (rgb)
// - secondColor: the second color for the readability check (rgb)
// Return Value:
// - the readability of the colors according to (WCAG Version 2)
float ColorHelper::GetReadability(const winrt::Windows::UI::Color& first, const winrt::Windows::UI::Color& second)
{
auto l1 = GetLuminance(first);
auto l2 = GetLuminance(second);
return (std::max(l1, l2) + 0.05f) / std::min(l1, l2) + 0.05f;
}
// Method Description:
// Calculates the luminance of a given color according to
// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
// Arguments:
// - color: its luminance is going to be calculated
// Return Value:
// - the luminance of the color
float ColorHelper::GetLuminance(const winrt::Windows::UI::Color& color)
{
auto epsilon = std::numeric_limits<float>::epsilon();
float R, G, B;
auto RsRGB = color.R / 255.f;
auto GsRGB = color.G / 255.f;
auto BsRGB = color.B / 255.f;
if (RsRGB - 0.03928f <= epsilon)
{
R = RsRGB / 12.92f;
}
else
{
R = std::pow(((RsRGB + 0.055f) / 1.055f), 2.4f);
}
if (GsRGB - 0.03928f <= epsilon)
{
G = GsRGB / 12.92f;
}
else
{
G = std::pow(((GsRGB + 0.055f) / 1.055f), 2.4f);
}
if (BsRGB - 0.03928f <= epsilon)
{
B = BsRGB / 12.92f;
}
else
{
B = std::pow(((BsRGB + 0.055f) / 1.055f), 2.4f);
}
auto luminance = (0.2126f * R) + (0.7152f * G) + (0.0722f * B);
return std::roundf(luminance * 10000) / 10000.f;
}

View File

@@ -1,31 +0,0 @@
#pragma once
#include <winrt/Windows.UI.h>
namespace winrt::TerminalApp
{
class HSL
{
public:
float H;
float S;
float L;
};
class ColorHelper
{
public:
static bool IsBrightColor(const Windows::UI::Color& color);
static HSL RgbToHsl(const Windows::UI::Color& color);
static Windows::UI::Color HslToRgb(const HSL& color);
static Windows::UI::Color Lighten(const Windows::UI::Color& color, float amount = 10.f);
static Windows::UI::Color Darken(const Windows::UI::Color& color, float amount = 10.f);
static Windows::UI::Color GetAccentColor(const Windows::UI::Color& color);
static float GetLuminance(const Windows::UI::Color& color);
static float GetReadability(const Windows::UI::Color& first, const Windows::UI::Color& second);
static float GetReadability(const HSL& first, const HSL& second);
private:
static float HueToRgb(float p, float q, float t);
};
}

View File

@@ -929,6 +929,17 @@ namespace winrt::TerminalApp::implementation
void CommandPalette::_filterTextChanged(const IInspectable& /*sender*/,
const Windows::UI::Xaml::RoutedEventArgs& /*args*/)
{
// GH#18737: Only respond to this change if we are visible:
// _close calls _searchBox().Text(L"") to reset the search text, which lands us
// in here after the command palette is dismissed. Since we have a code path here that
// could potentially lead to an action being previewed (specifically if there is a
// preview-able action as the first entry in the command list), that preview will
// appear after the palette is dismissed without this check.
if (Visibility() != Visibility::Visible)
{
return;
}
// When we are executing the _SelectNextTab in the TabManagement.cpp, this method
// is getting triggered because we set up the default value for that CommandPalette
// with an empty string. Therefore, to avoid the reset of the index when executing

View File

@@ -44,6 +44,12 @@
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}" />
</Style>
<Style x:Key="SubtitleTextStyle"
TargetType="TextBlock">
<Setter Property="FontSize" Value="10" />
<Setter Property="Foreground" Value="{ThemeResource SystemBaseMediumColor}" />
</Style>
<DataTemplate x:Key="ListItemTemplate"
x:DataType="local:FilteredCommand">
<ListViewItem HorizontalContentAlignment="Stretch"
@@ -71,11 +77,19 @@
Height="16"
Content="{x:Bind Item.ResolvedIcon, Mode=OneWay}" />
<local:HighlightedTextControl Grid.Column="1"
HorizontalAlignment="Left"
HighlightedRuns="{x:Bind NameHighlights, Mode=OneWay}"
Text="{x:Bind Item.Name, Mode=OneWay}" />
<StackPanel Grid.Column="1"
HorizontalAlignment="Left"
Orientation="Vertical">
<local:HighlightedTextControl HorizontalAlignment="Left"
HighlightedRuns="{x:Bind NameHighlights, Mode=OneWay}"
Text="{x:Bind Item.Name, Mode=OneWay}" />
<local:HighlightedTextControl HorizontalAlignment="Left"
HighlightedRuns="{x:Bind SubtitleHighlights, Mode=OneWay}"
Text="{x:Bind Item.Subtitle, Mode=OneWay}"
TextBlockStyle="{StaticResource SubtitleTextStyle}"
Visibility="{x:Bind HasSubtitle, Mode=OneWay}" />
</StackPanel>
<!--
The block for the key chord is only visible
when there's actual text set as the label.
@@ -122,10 +136,19 @@
Height="16"
Content="{x:Bind Item.ResolvedIcon, Mode=OneWay}" />
<local:HighlightedTextControl Grid.Column="1"
HorizontalAlignment="Left"
HighlightedRuns="{x:Bind NameHighlights, Mode=OneWay}"
Text="{x:Bind Item.Name, Mode=OneWay}" />
<StackPanel Grid.Column="1"
HorizontalAlignment="Left"
Orientation="Vertical">
<local:HighlightedTextControl HorizontalAlignment="Left"
HighlightedRuns="{x:Bind NameHighlights, Mode=OneWay}"
Text="{x:Bind Item.Name, Mode=OneWay}" />
<local:HighlightedTextControl HorizontalAlignment="Left"
HighlightedRuns="{x:Bind SubtitleHighlights, Mode=OneWay}"
Text="{x:Bind Item.Subtitle, Mode=OneWay}"
TextBlockStyle="{StaticResource SubtitleTextStyle}"
Visibility="{x:Bind HasSubtitle, Mode=OneWay}" />
</StackPanel>
<!--
The block for the key chord is only visible

View File

@@ -17,6 +17,31 @@ namespace winrt::TerminalApp::implementation
ActionPaletteItem(const Microsoft::Terminal::Settings::Model::Command& command, const winrt::hstring keyChordText) :
_Command{ command }, _name{ command.Name() }, _keyChordText{ keyChordText }
{
static bool shouldShowSubtitles = [] {
try
{
const auto context{ winrt::Windows::ApplicationModel::Resources::Core::ResourceContext::GetForViewIndependentUse() };
const auto qualifiers{ context.QualifierValues() };
if (const auto language{ qualifiers.TryLookup(L"language") })
{
return !til::starts_with_insensitive_ascii(*language, L"en-");
}
}
catch (...)
{
LOG_CAUGHT_EXCEPTION();
}
return false;
}();
if (shouldShowSubtitles)
{
const auto subtitle = _Command.LanguageNeutralName();
if (subtitle != _name)
{
_subtitle = std::move(subtitle);
}
}
}
winrt::hstring Name()
@@ -24,6 +49,11 @@ namespace winrt::TerminalApp::implementation
return _name;
}
winrt::hstring Subtitle()
{
return _subtitle;
}
winrt::hstring KeyChordText()
{
return _keyChordText;
@@ -31,7 +61,7 @@ namespace winrt::TerminalApp::implementation
winrt::hstring Icon()
{
return _Command.IconPath();
return _Command.Icon().Resolved();
}
WINRT_PROPERTY(Microsoft::Terminal::Settings::Model::Command, Command, nullptr);
@@ -39,6 +69,7 @@ namespace winrt::TerminalApp::implementation
private:
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _commandChangedRevoker;
winrt::hstring _name;
winrt::hstring _subtitle;
winrt::hstring _keyChordText;
};
@@ -54,6 +85,11 @@ namespace winrt::TerminalApp::implementation
return _CommandLine;
}
winrt::hstring Subtitle()
{
return {};
}
winrt::hstring KeyChordText()
{
return {};
@@ -87,6 +123,11 @@ namespace winrt::TerminalApp::implementation
return {};
}
winrt::hstring Subtitle()
{
return {};
}
winrt::hstring KeyChordText()
{
return {};

View File

@@ -34,9 +34,15 @@ namespace winrt::Microsoft::TerminalApp::implementation
// before actually starting the connection to the client app. This
// will ensure both controls are initialized before the client app
// is.
const auto weak = get_weak();
co_await winrt::resume_background();
_pairedTap->_start.wait();
const auto strong = weak.get();
if (!strong)
{
co_return;
}
_pairedTap->_start.wait();
_wrappedConnection.Start();
}
void WriteInput(const winrt::array_view<const char16_t> buffer)

View File

@@ -26,11 +26,16 @@ namespace winrt::TerminalApp::implementation
{
// Recompute the highlighted name if the item name changes
// Our Item will not change, so we don't need to update the revoker if it does.
_itemChangedRevoker = _Item.as<winrt::Windows::UI::Xaml::Data::INotifyPropertyChanged>().PropertyChanged(winrt::auto_revoke, [weakThis{ get_weak() }](auto& /*sender*/, auto& e) {
auto filteredCommand{ weakThis.get() };
if (filteredCommand && e.PropertyName() == L"Name")
_itemChangedRevoker = _Item.as<winrt::Windows::UI::Xaml::Data::INotifyPropertyChanged>().PropertyChanged(winrt::auto_revoke, [=](auto& /*sender*/, auto& e) {
const auto property{ e.PropertyName() };
if (property == L"Name")
{
filteredCommand->_update();
_update();
}
else if (property == L"Subtitle")
{
_update();
PropertyChanged.raise(*this, winrt::Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"HasSubtitle" });
}
});
}
@@ -46,6 +51,11 @@ namespace winrt::TerminalApp::implementation
}
}
bool FilteredCommand::HasSubtitle()
{
return !_Item.Subtitle().empty();
}
static std::tuple<std::vector<winrt::TerminalApp::HighlightedRun>, int32_t> _matchedSegmentsAndWeight(const std::shared_ptr<fzf::matcher::Pattern>& pattern, const winrt::hstring& haystack)
{
std::vector<winrt::TerminalApp::HighlightedRun> segments;
@@ -68,7 +78,17 @@ namespace winrt::TerminalApp::implementation
void FilteredCommand::_update()
{
auto [segments, weight] = _matchedSegmentsAndWeight(_pattern, _Item.Name());
auto itemName = _Item.Name();
auto [segments, weight] = _matchedSegmentsAndWeight(_pattern, itemName);
decltype(segments) subtitleSegments;
if (HasSubtitle())
{
auto itemSubtitle = _Item.Subtitle();
int32_t subtitleWeight = 0;
std::tie(subtitleSegments, subtitleWeight) = _matchedSegmentsAndWeight(_pattern, itemSubtitle);
weight = std::max(weight, subtitleWeight);
}
if (segments.empty())
{
@@ -79,6 +99,15 @@ namespace winrt::TerminalApp::implementation
NameHighlights(winrt::single_threaded_vector(std::move(segments)));
}
if (subtitleSegments.empty())
{
SubtitleHighlights(nullptr);
}
else
{
SubtitleHighlights(winrt::single_threaded_vector(std::move(subtitleSegments)));
}
Weight(weight);
}

View File

@@ -24,9 +24,12 @@ namespace winrt::TerminalApp::implementation
static int Compare(const winrt::TerminalApp::FilteredCommand& first, const winrt::TerminalApp::FilteredCommand& second);
bool HasSubtitle();
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(winrt::TerminalApp::IPaletteItem, Item, PropertyChanged.raise, nullptr);
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::Foundation::Collections::IVector<winrt::TerminalApp::HighlightedRun>, NameHighlights, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::Foundation::Collections::IVector<winrt::TerminalApp::HighlightedRun>, SubtitleHighlights, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(int, Weight, PropertyChanged.raise);
private:

View File

@@ -13,6 +13,8 @@ namespace TerminalApp
IPaletteItem Item { get; };
IVector<HighlightedRun> NameHighlights { get; };
IVector<HighlightedRun> SubtitleHighlights { get; };
Boolean HasSubtitle { get; };
Int32 Weight;
}
}

View File

@@ -16,6 +16,7 @@ namespace TerminalApp
{
PaletteItemType Type { get; };
String Name { get; };
String Subtitle { get; };
String KeyChordText { get; };
String Icon { get; };
Windows.UI.Xaml.Controls.IconElement ResolvedIcon { get; };

View File

@@ -19,41 +19,6 @@ DEFINE_PROPERTYKEY(PKEY_AppUserModel_DestListLogoUri, 0x9F4C2855, 0x9F79, 0x4B39
{ 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 }, 29 \
}
// Function Description:
// - This function guesses whether a string is a file path.
static constexpr bool _isProbableFilePath(std::wstring_view path)
{
// "C:X", "C:\X", "\\?", "\\."
// _this function rejects \??\ as a path_
if (path.size() >= 3)
{
const auto firstColon{ path.find(L':') };
if (firstColon == 1)
{
return true;
}
const auto prefix{ path.substr(0, 2) };
return prefix == LR"(//)" || prefix == LR"(\\)";
}
return false;
}
// Function Description:
// - DestListLogoUri cannot take paths that are separated by / unless they're URLs.
// This function uses std::filesystem to normalize strings that appear to be file
// paths to have the "correct" slash direction.
static std::wstring _normalizeIconPath(std::wstring_view path)
{
const auto fullPath{ wil::ExpandEnvironmentStringsW<std::wstring>(path.data()) };
if (_isProbableFilePath(fullPath))
{
std::filesystem::path asPath{ fullPath };
return asPath.make_preferred().wstring();
}
return std::wstring{ fullPath };
}
// Method Description:
// - Updates the items of the Jumplist based on the given settings.
// Arguments:
@@ -78,6 +43,9 @@ safe_void_coroutine Jumplist::UpdateJumplist(const CascadiaSettings& settings) n
// make sure to capture the settings _before_ the co_await
const auto strongSettings = settings;
// Explorer APIs may block, so do it on a background thread.
//
// NOTE: Jumplist has no members, so we don't need to hold onto `this` here.
co_await winrt::resume_background();
try
@@ -124,7 +92,7 @@ void Jumplist::_updateProfiles(IObjectCollection* jumplistItems, winrt::Windows:
auto args = fmt::format(FMT_COMPILE(L"-p {}"), to_hstring(profile.Guid()));
// Create the shell link object for the profile
const auto normalizedIconPath{ _normalizeIconPath(profile.Icon()) };
const auto normalizedIconPath{ profile.Icon().Resolved() };
const auto shLink = _createShellLink(profile.Name(), normalizedIconPath, args);
THROW_IF_FAILED(jumplistItems->AddObject(shLink.get()));
}

View File

@@ -35,17 +35,23 @@ namespace winrt::TerminalApp::implementation
// (which should be the default, see:
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-trackmouseevent#remarks)
unsigned int hoverTimeoutMillis{ 400 };
LOG_IF_WIN32_BOOL_FALSE(SystemParametersInfoW(SPI_GETMOUSEHOVERTIME, 0, &hoverTimeoutMillis, 0));
const auto toolTipInterval = std::chrono::milliseconds(hoverTimeoutMillis);
if (FAILED(SystemParametersInfoW(SPI_GETMOUSEHOVERTIME, 0, &hoverTimeoutMillis, 0)))
{
hoverTimeoutMillis = 400;
}
// Create a ThrottledFunc for opening the tooltip after the hover
// timeout. If we hover another button, we should make sure to call
// Run() with the new button. Calling `_displayToolTip.Run(nullptr)`,
// which will cause us to not display a tooltip, which is used when we
// leave the control entirely.
_displayToolTip = std::make_shared<ThrottledFuncTrailing<Controls::Button>>(
_displayToolTip = std::make_shared<ThrottledFunc<Controls::Button>>(
dispatcher,
toolTipInterval,
til::throttled_func_options{
.delay = std::chrono::milliseconds{ hoverTimeoutMillis },
.debounce = true,
.trailing = true,
},
[weakThis = get_weak()](Controls::Button button) {
// If we provide a button, then open the tooltip on that button.
// We can "dismiss" this throttled func by calling it with null,
@@ -83,6 +89,18 @@ namespace winrt::TerminalApp::implementation
CloseClick.raise(*this, e);
}
bool MinMaxCloseControl::Focused() const
{
return _focused;
}
void MinMaxCloseControl::Focused(bool focused)
{
_focused = focused;
ReleaseButtons();
}
void MinMaxCloseControl::SetWindowVisualState(WindowVisualState visualState)
{
// Look up the heights we should use for the caption buttons from our
@@ -164,25 +182,25 @@ namespace winrt::TerminalApp::implementation
// animate the fade in/out transition between colors.
case CaptionButton::Minimize:
VisualStateManager::GoToState(MinimizeButton(), L"PointerOver", true);
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
_displayToolTip->Run(MinimizeButton());
closeToolTipForButton(MaximizeButton());
closeToolTipForButton(CloseButton());
break;
case CaptionButton::Maximize:
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
VisualStateManager::GoToState(MaximizeButton(), L"PointerOver", true);
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
closeToolTipForButton(MinimizeButton());
_displayToolTip->Run(MaximizeButton());
closeToolTipForButton(CloseButton());
break;
case CaptionButton::Close:
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
VisualStateManager::GoToState(CloseButton(), L"PointerOver", true);
closeToolTipForButton(MinimizeButton());
@@ -205,17 +223,17 @@ namespace winrt::TerminalApp::implementation
{
case CaptionButton::Minimize:
VisualStateManager::GoToState(MinimizeButton(), L"Pressed", true);
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
break;
case CaptionButton::Maximize:
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
VisualStateManager::GoToState(MaximizeButton(), L"Pressed", true);
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
break;
case CaptionButton::Close:
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
VisualStateManager::GoToState(CloseButton(), L"Pressed", true);
break;
}
@@ -228,9 +246,9 @@ namespace winrt::TerminalApp::implementation
void MinMaxCloseControl::ReleaseButtons()
{
_displayToolTip->Run(nullptr);
VisualStateManager::GoToState(MinimizeButton(), L"Normal", true);
VisualStateManager::GoToState(MaximizeButton(), L"Normal", true);
VisualStateManager::GoToState(CloseButton(), L"Normal", true);
VisualStateManager::GoToState(MinimizeButton(), _normalState(), true);
VisualStateManager::GoToState(MaximizeButton(), _normalState(), true);
VisualStateManager::GoToState(CloseButton(), _normalState(), true);
closeToolTipForButton(MinimizeButton());
closeToolTipForButton(MaximizeButton());
@@ -238,4 +256,11 @@ namespace winrt::TerminalApp::implementation
_lastPressedButton = std::nullopt;
}
const winrt::param::hstring& MinMaxCloseControl::_normalState() const
{
static const winrt::param::hstring normal = L"Normal";
static const winrt::param::hstring unfocused = L"Unfocused";
return (_focused ? normal : unfocused);
}
}

View File

@@ -21,6 +21,9 @@ namespace winrt::TerminalApp::implementation
void PressButton(CaptionButton button);
void ReleaseButtons();
bool Focused() const;
void Focused(bool focused);
void _MinimizeClick(const winrt::Windows::Foundation::IInspectable& sender,
const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
void _MaximizeClick(const winrt::Windows::Foundation::IInspectable& sender,
@@ -32,8 +35,12 @@ namespace winrt::TerminalApp::implementation
til::typed_event<TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs> MaximizeClick;
til::typed_event<TerminalApp::MinMaxCloseControl, winrt::Windows::UI::Xaml::RoutedEventArgs> CloseClick;
std::shared_ptr<ThrottledFuncTrailing<winrt::Windows::UI::Xaml::Controls::Button>> _displayToolTip{ nullptr };
bool _focused{ false };
std::shared_ptr<ThrottledFunc<winrt::Windows::UI::Xaml::Controls::Button>> _displayToolTip{ nullptr };
std::optional<CaptionButton> _lastPressedButton{ std::nullopt };
private:
const winrt::param::hstring& _normalState() const;
};
}

View File

@@ -14,6 +14,7 @@ namespace TerminalApp
void HoverButton(CaptionButton button);
void PressButton(CaptionButton button);
void ReleaseButtons();
Boolean Focused { get; set; };
event Windows.Foundation.TypedEventHandler<MinMaxCloseControl, Windows.UI.Xaml.RoutedEventArgs> MinimizeClick;
event Windows.Foundation.TypedEventHandler<MinMaxCloseControl, Windows.UI.Xaml.RoutedEventArgs> MaximizeClick;

View File

@@ -32,6 +32,10 @@
ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="CaptionButtonForegroundPressed"
ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="CaptionButtonForegroundUnfocusedColor"
ResourceKey="TextFillColorDisabled" />
<SolidColorBrush x:Key="CaptionButtonForegroundUnfocused"
Color="{ThemeResource CaptionButtonForegroundUnfocusedColor}" />
<SolidColorBrush x:Key="CaptionButtonBackground"
Color="Transparent" />
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
@@ -66,6 +70,10 @@
ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="CaptionButtonForegroundPressed"
ResourceKey="SystemControlForegroundBaseHighBrush" />
<StaticResource x:Key="CaptionButtonForegroundUnfocusedColor"
ResourceKey="TextFillColorDisabled" />
<SolidColorBrush x:Key="CaptionButtonForegroundUnfocused"
Color="{ThemeResource CaptionButtonForegroundUnfocusedColor}" />
<SolidColorBrush x:Key="CaptionButtonBackground"
Color="Transparent" />
<Color x:Key="CaptionButtonBackgroundColor">Transparent</Color>
@@ -103,6 +111,10 @@
Color="{ThemeResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="CaptionButtonForegroundPressed"
Color="{ThemeResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="CaptionButtonForegroundUnfocused"
Color="{ThemeResource SystemColorButtonTextColor}" />
<StaticResource x:Key="CaptionButtonForegroundUnfocusedColor"
ResourceKey="SystemColorButtonTextColor" />
<SolidColorBrush x:Key="CloseButtonBackgroundPointerOver"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="CloseButtonForegroundPointerOver"
@@ -189,6 +201,20 @@
Duration="0:0:0.1" />
</Storyboard>
</VisualTransition>
<VisualTransition From="PointerOver"
To="Unfocused">
<Storyboard>
<ColorAnimation Storyboard.TargetName="ButtonBaseElement"
Storyboard.TargetProperty="(UIElement.Background).(SolidColorBrush.Color)"
To="{ThemeResource CaptionButtonBackgroundColor}"
Duration="0:0:0.15" />
<ColorAnimation Storyboard.TargetName="ButtonIcon"
Storyboard.TargetProperty="(UIElement.Foreground).(SolidColorBrush.Color)"
To="{ThemeResource CaptionButtonForegroundUnfocusedColor}"
Duration="0:0:0.1" />
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Normal">
@@ -198,6 +224,13 @@
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Unfocused">
<VisualState.Setters>
<Setter Target="ButtonBaseElement.Background" Value="{ThemeResource CaptionButtonBackground}" />
<Setter Target="ButtonIcon.Foreground" Value="{ThemeResource CaptionButtonForegroundUnfocused}" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="ButtonBaseElement.Background" Value="{ThemeResource CaptionButtonBackgroundPointerOver}" />

View File

@@ -1161,10 +1161,12 @@ void Pane::SetActive()
// focused, else the profile of the last control to be focused
Profile Pane::GetFocusedProfile()
{
auto lastFocused = GetActivePane();
if (const auto& terminalPane{ lastFocused->_getTerminalContent() })
if (auto lastFocused{ GetActivePane() })
{
return terminalPane.GetProfile();
if (const auto& terminalPane{ lastFocused->_getTerminalContent() })
{
return terminalPane.GetProfile();
}
}
return nullptr;
}

View File

@@ -44,10 +44,6 @@ namespace winrt::TerminalApp::implementation
{
_args = { value.begin(), value.end() };
_parseResult = _parsed.ParseArgs(_args);
if (_parseResult == 0)
{
_parsed.ValidateStartupCommands();
}
}
winrt::com_array<winrt::hstring> CommandlineArgs::Commandline()

View File

@@ -270,13 +270,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Registerkarte kopieren</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>Profil mit einem ungültigen "backgroundImage" gefunden. Dieses Profil hat standardmäßig kein Hintergrundbild. Stellen Sie sicher, dass beim Festlegen eines "backgroundImage" der Wert ein gültiger Dateipfad zu einem Bild ist.</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>Profil mit einem ungültigen "icon" gefunden. Dieses Profil hat standardmäßig kein Symbol. Stellen Sie sicher, dass beim Festlegen eines "icon" der Wert ein gültiger Dateipfad zu einem Bild ist.</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>Mindestens eine in den Einstellungen angegebene Ressource (z. B. icon oder backgroundImage) wurde nicht gefunden.</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>Beim Analysieren Ihrer Tastenzuordnungen wurden Warnungen gefunden:</value>

View File

@@ -271,13 +271,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Duplicate tab</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>Found a profile with an invalid "backgroundImage". Defaulting that profile to have no background image. Make sure that when setting a "backgroundImage", the value is a valid file path to an image.</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>Found a profile with an invalid "icon". Defaulting that profile to have no icon. Make sure that when setting an "icon", the value is a valid file path to an image.</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>One or more resources (such as icon or backgroundImage) specified in your settings could not be found.</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>Warnings were found while parsing your keybindings:</value>

View File

@@ -267,13 +267,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Duplicar pestaña</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>Se encontró un perfil con un "backgroundImage" no válido. Si se predetermina que ese perfil no tiene imagen de fondo. Asegúrese de que al establecer "backgroundImage", el valor sea una ruta de acceso de archivo válida a una imagen.</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>Se encontró un perfil con un "icon" no válido. Estableciendo ese perfil para no tener icono. Asegúrese de que, al establecer un "icon", el valor es una ruta de acceso de archivo válida a una imagen.</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>No se encontraron uno o varios recursos (como icon o backgroundImage) especificados en la configuración.</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>Se encontraron advertencias al analizar los enlaces de teclado:</value>

View File

@@ -267,13 +267,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Dupliquer longlet</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>Profil détecté avec une "backgroundImage" non valide. Par défaut, ce profil ne possède pas dimage darrière-plan. Assurez-vous que lorsque vous définissez une "backgroundImage", la valeur est un chemin daccès de fichier valide vers une image.</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>Profil détecté avec une "icon" non valide. Par défaut, ce profil ne possède pas dicône. Assurez-vous que lorsque vous définissez une "icon", la valeur est un chemin daccès de fichier valide vers une image.</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>Une ou plusieurs ressources (telles que icon ou backgroundImage) spécifiées dans vos paramètres sont introuvables.</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>Des avertissements ont été détectés lors de lanalyse de vos combinaisons de touches :</value>
@@ -891,7 +887,7 @@
<value>Déplacer l'onglet vers une nouvelle fenêtre </value>
</data>
<data name="RunAsAdminFlyout.Text" xml:space="preserve">
<value>Exécuter en temps qu'administrateur (restreint)</value>
<value>Exécuter en tant qu'administrateur (restreint)</value>
<comment>This text is displayed on context menu for profile entries in add new tab button.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">

View File

@@ -267,13 +267,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Duplica scheda</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>È stato trovato un profilo con un "backgroundImage" non valido. Impostazione predefinita per il profilo non è disponibile un'immagine di sfondo. Accertarsi che quando si imposta un "backgroundImage", il valore è un percorso di file valido per un'immagine.</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>Trovato un profilo con "icon" non valida. Impostare il profilo senza icon. Assicurarsi che, quando si imposta una "icon", il valore abbia un percorso file valido per un'immagine.</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>Impossibile trovare una o più risorse, ad esempio icon o backgroundImage, specificate nelle impostazioni.</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>Sono stati trovati avvisi durante l'analisi delle associazioni di tasti:</value>

View File

@@ -185,7 +185,7 @@
<value>終了</value>
</data>
<data name="MultiplePanes" xml:space="preserve">
<value>複数ウィンドウ</value>
<value>複数ペイン</value>
</data>
<data name="TabCloseSubMenu" xml:space="preserve">
<value>閉じる</value>
@@ -203,13 +203,13 @@
<value>タブを閉じる</value>
</data>
<data name="PaneClose" xml:space="preserve">
<value>ウィンドウを閉じる</value>
<value>ペインを閉じる</value>
</data>
<data name="SplitTabText" xml:space="preserve">
<value>タブを分割</value>
</data>
<data name="SplitPaneText" xml:space="preserve">
<value>ウィンドウを分割する</value>
<value>ペインを分割する</value>
</data>
<data name="SplitPaneToolTipText" xml:space="preserve">
<value>分割する方向を右クリック - 右/下/上/左</value>
@@ -230,7 +230,7 @@
<value>複製</value>
</data>
<data name="SwapPaneText" xml:space="preserve">
<value>ウィンドウを入れ替える</value>
<value>ペインを入れ替える</value>
</data>
<data name="SwapPaneDownText" xml:space="preserve">
<value>下とペインを入れ替え</value>
@@ -245,10 +245,10 @@
<value>左とペインを入れ替え</value>
</data>
<data name="TogglePaneZoomText" xml:space="preserve">
<value>ウィンドウのズームの切り替え</value>
<value>ペインのズームの切り替え</value>
</data>
<data name="CloseOtherPanesText" xml:space="preserve">
<value>他のウィンドウを閉じる</value>
<value>他のペインを閉じる</value>
</data>
<data name="SearchWebText" xml:space="preserve">
<value>Web 検索</value>
@@ -268,13 +268,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>タブを複製する</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>無効な "backgroundImage" を持つプロファイルが見つかりました。既定では、そのプロファイルに背景画像はありません。"backgroundImage" を設定するときに、値が画像への有効なファイル パスとなっていることをご確認ください。</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>無効な "icon" を持つプロファイルが見つかりました。既定では、そのプロファイルにアイコンはありません。"icon" を設定するときに、値が画像への有効なファイル パスとなっていることをご確認ください。</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>設定で指定された 1 つ以上のリソース (icon や backgroundImage など) が見つかりませんでした。</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>キー バインドの解析中に警告が検出されました:</value>
@@ -321,7 +317,7 @@
<value>同じ名前ですが大文字と小文字が異なる環境変数が複数見つかりました。使用される値は 1 つだけです。</value>
</data>
<data name="CmdCommandArgDesc" xml:space="preserve">
<value>新しいタブまたはウィンドウで生成されるオプションのコマンドと引数</value>
<value>新しいタブまたはペインで生成されるオプションのコマンドと引数</value>
</data>
<data name="SaveSnippetDesc" xml:space="preserve">
<value>コマンド ラインを入力アクションとして保存する</value>
@@ -349,17 +345,17 @@
<value>指定されたインデックスのタブにフォーカスを移動する</value>
</data>
<data name="CmdMovePaneTabArgDesc" xml:space="preserve">
<value>フォーカスされたウィンドウを指定されたインデックスのタブに移動する</value>
<value>フォーカスされたペインを指定されたインデックスのタブに移動する</value>
</data>
<data name="CmdMovePaneDesc" xml:space="preserve">
<value>フォーカスされたウィンドウを別のタブに移動する</value>
<value>フォーカスされたペインを別のタブに移動する</value>
</data>
<data name="CmdMPDesc" xml:space="preserve">
<value>"move-pane" サブコマンドのエイリアス。</value>
<comment>{Locked="\"move-pane\""}</comment>
</data>
<data name="CmdSplitPaneSizeArgDesc" xml:space="preserve">
<value>サイズを親ウィンドウに対する割合として指定します。有効な値は (0,1) の間で、排他的です。</value>
<value>サイズを親ペインに対する割合として指定します。有効な値は (0,1) の間で、排他的です。</value>
</data>
<data name="CmdNewTabDesc" xml:space="preserve">
<value>新しいタブの作成</value>
@@ -369,14 +365,14 @@
<comment>{Locked="\"new-tab\""}</comment>
</data>
<data name="CmdFocusPaneDesc" xml:space="preserve">
<value>別のウィンドウにフォーカスを移動する</value>
<value>別のペインにフォーカスを移動する</value>
</data>
<data name="CmdFPDesc" xml:space="preserve">
<value>"focus-pane" サブコマンドのエイリアス。</value>
<comment>{Locked="\"focus-pane\""}</comment>
</data>
<data name="CmdFocusPaneTargetArgDesc" xml:space="preserve">
<value>指定されたインデックスのウィンドウをフォーカスする</value>
<value>指定されたインデックスのペインをフォーカスする</value>
</data>
<data name="CmdProfileArgDesc" xml:space="preserve">
<value>指定されたプロファイルで開きます。プロファイルの名前または GUID を指定できます</value>
@@ -385,20 +381,20 @@
<value>WT_SESSION 変数を設定します; GUID である必要があります</value>
</data>
<data name="CmdSplitPaneDesc" xml:space="preserve">
<value>新しい分割ウィンドウの作成</value>
<value>新しい分割ペインの作成</value>
</data>
<data name="CmdSPDesc" xml:space="preserve">
<value>"split-pane" サブコマンドのエイリアス。</value>
<comment>{Locked="\"split-pane\""}</comment>
</data>
<data name="CmdSplitPaneHorizontalArgDesc" xml:space="preserve">
<value>新しいウィンドウを水平方向に分割して作成します ([-]と考えてください)</value>
<value>新しいペインを水平方向に分割して作成します ([-]と考えてください)</value>
</data>
<data name="CmdSplitPaneVerticalArgDesc" xml:space="preserve">
<value>新しいウィンドウを垂直方向に分割して作成します ([|]と考えてください)</value>
<value>新しいペインを垂直方向に分割して作成します ([|]と考えてください)</value>
</data>
<data name="CmdSplitPaneDuplicateArgDesc" xml:space="preserve">
<value>フォーカスされたウィンドウのプロファイルを複製して、新しいウィンドウを作成します</value>
<value>フォーカスされたペインのプロファイルを複製して、新しいペインを作成します</value>
</data>
<data name="CmdStartingDirArgDesc" xml:space="preserve">
<value>プロファイルの "startingDirectory" の設定ではなく、指定されたディレクトリで開きます</value>
@@ -416,7 +412,7 @@
<comment>{Locked="\"tabTitle\""}</comment>
</data>
<data name="CmdInheritEnvDesc" xml:space="preserve">
<value>新しい環境ブロックを作成するのではなく、新しいタブまたはウィンドウを作成するときに、ターミナル独自の環境変数を継承します。これは、"command" が渡されたときに既定で設定されます。 </value>
<value>新しい環境ブロックを作成するのではなく、新しいタブまたはペインを作成するときに、ターミナル独自の環境変数を継承します。これは、"command" が渡されたときに既定で設定されます。 </value>
<comment>{Locked="\"command\""}</comment>
</data>
<data name="CmdColorSchemeArgDesc" xml:space="preserve">
@@ -433,7 +429,7 @@
<value>ウィンドウを全画面表示モードで起動する</value>
</data>
<data name="CmdMoveFocusDesc" xml:space="preserve">
<value>指定した方向にある隣のウィンドウにフォーカスを移動する</value>
<value>指定した方向にある隣のペインにフォーカスを移動する</value>
</data>
<data name="CmdMFDesc" xml:space="preserve">
<value>"move-focus" サブコマンドのエイリアス。</value>
@@ -443,10 +439,10 @@
<value>フォーカスを移動する方向</value>
</data>
<data name="CmdSwapPaneDesc" xml:space="preserve">
<value>フォーカスされたウィンドウを、指定された方向の隣接するウィンドウと入れ替える</value>
<value>フォーカスされたペインを、指定された方向の隣接するペインと入れ替える</value>
</data>
<data name="CmdSwapPaneDirectionArgDesc" xml:space="preserve">
<value>フォーカスされたウィンドウを移動する方向</value>
<value>フォーカスされたペインを移動する方向</value>
</data>
<data name="CmdFocusDesc" xml:space="preserve">
<value>ウィンドウをフォーカス モードで起動</value>
@@ -861,7 +857,7 @@
<value>設定ページを開きます</value>
</data>
<data name="SplitTabToolTip" xml:space="preserve">
<value>現在のディレクトリのアクティブなプロファイルを使用して新しいウィンドウを開きます</value>
<value>現在のディレクトリのアクティブなプロファイルを使用して新しいペインを開きます</value>
</data>
<data name="TabCloseAfterToolTip" xml:space="preserve">
<value>このタブの右側にあるすべてのタブを閉じます</value>
@@ -876,10 +872,10 @@
<value>なし</value>
</data>
<data name="ClosePaneText" xml:space="preserve">
<value>ウィンドウを閉じる</value>
<value>ペインを閉じる</value>
</data>
<data name="ClosePaneToolTip" xml:space="preserve">
<value>複数のウィンドウが存在する場合は、アクティブなウィンドウを閉じます</value>
<value>複数のペインが存在する場合は、アクティブなペインを閉じます</value>
</data>
<data name="TabColorClearButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.FullDescription" xml:space="preserve">
<value>タブの色をリセット</value>
@@ -896,7 +892,7 @@
<comment>This text is displayed on context menu for profile entries in add new tab button.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<value>アクティブなウィンドウを [{0}] タブに移動しました</value>
<value>アクティブなペインを [{0}] タブに移動しました</value>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab the pane was moved to.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
@@ -912,19 +908,19 @@
<comment>{Locked="{0}"}{Locked="{1}"}This text is read out by screen readers upon a successful tab movement. {0} is the name of the tab. {1} is the new tab index in the tab row.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow" xml:space="preserve">
<value>アクティブなウィンドウを "{1}" ウィンドウの [{0}] タブに移動しました</value>
<value>アクティブなペインを "{1}" ウィンドウの [{0}] タブに移動しました</value>
<comment>{Locked="{0}"}{Locked="{1}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab the pane was moved to. {1} is the name of the window the pane was moved to. Replaced in 1.19 by TerminalPage_PaneMovedAnnouncement_ExistingWindow2</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<value>アクティブなウィンドウを "{0}" ウィンドウに移動しました</value>
<value>アクティブなペインを "{0}" ウィンドウに移動しました</value>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window the pane was moved to.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>アクティブなウィンドウを新しいウィンドウに移動しました</value>
<value>アクティブなペインを新しいウィンドウに移動しました</value>
<comment>This text is read out by screen readers upon a successful pane movement to a new window.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewTab" xml:space="preserve">
<value>アクティブなウィンドウを新しいタブに移動しました</value>
<value>アクティブなペインを新しいタブに移動しました</value>
<comment>This text is read out by screen readers upon a successful pane movement to a new tab within the existing window.</comment>
</data>
<data name="CmdAppendCommandLineDesc" xml:space="preserve">
@@ -934,7 +930,7 @@
<value>接続の再起動</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>アクティブウィンドウ接続を再起動します</value>
<value>アクティブ ペイン接続を再起動します</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>抜粋</value>
@@ -965,10 +961,10 @@
<value>操作の保存に失敗しました</value>
</data>
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>ウィンドウを閉じる</value>
<value>ペインを閉じる</value>
</data>
<data name="CloseSnippetsPaneButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>ウィンドウを閉じる</value>
<value>ペインを閉じる</value>
</data>
<data name="TabMoveLeft" xml:space="preserve">
<value>左へ移動</value>

View File

@@ -267,13 +267,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>탭 복제</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>잘못된 "backgroundImage" 프로필을 찾았습니다. 해당 프로필을 배경 이미지가 없는 기본값으로 설정합니다. "backgroundImage"설정할 때 값이 이미지에 대한 유효한 파일 경로인지 확인합니다.</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>잘못된 "icon"이 있는 프로필을 발견했습니다. 해당 프로필에 아이콘이 없도록 기본값을 설정합니다. "icon" 설정 시 값이 이미지에 대한 올바른 파일 경로인지 확인합니다.</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>설정에 지정된 하나 이상의 리소스(예: icon 또는 backgroundImage)찾을 수 없습니다.</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>키 바인딩 구문을 분석하는 동안 경고를 발견했습니다.</value>

View File

@@ -267,13 +267,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Duplicar guia</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>Foi encontrado um perfil com um "backgroundImage" inválido. O perfil deve ser o padrão para que não haja nenhuma imagem de tela de fundo. Certifique-se de que, ao definir um "backgroundImage", o valor é um caminho de arquivo válido para uma imagem.</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>Foi encontrado um perfil com um "icon" inválido. Padronize esse perfil para ele não ter ícone. Certifique-se de que, ao definir um "icon", o valor seja um caminho de arquivo válido para uma imagem.</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>Um ou mais recursos (como icon ou backgroundImage) especificados em suas configurações não foram encontrados.</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>Os avisos foram encontrados durante a análise das suas ligações de teclas:</value>

View File

@@ -271,13 +271,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Ďϋφľіčάтέ τàв !!! </value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>₣σúŋδ ą φѓοƒĩļé ẃϊţħ äй ïηνàĺìď "backgroundImage". Đēƒãųŀŧϊпğ ťнªт φѓőƒĭļè το нªνе πō ьąçќġгθúпδ ιмãġė. Маĸē śμѓē ŧћäţ ẁђēή šêťτϊлġ å "backgroundImage", ţĥě νаłųё ïŝ ά νάľîď ƒĩŀê φąťħ ţŏ άń ΐмąġė. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>₣ǿũиđ à рřöƒϊℓз ŵĩţн аñ įņνàŀїδ "icon". Ðěƒаúľτīŋğ ţħаτ ρřόƒìŀё тб ђâνє пǿ íčой. Мàĸë ŝùřë ŧĥаţ ωĥĕл ŝеτŧīлĝ ăй "icon", τħε νāłϋë ïŝ ă νàľīđ ƒïŀè рªтн ţő äи ïмäģё. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! </value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>Ωňę бггě яėŝǿüґсėş (šυćн âş icon ōя backgroundImage) ŝрěçìƒįєð ίπ ýőūŕ ŝėтťīлġš ċòŭĺð йöŧ вέ ƒòúпď. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! </value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>Щαѓńΐňģš ώĕřе ƒбŭπδ ώħīļë рăяşìⁿġ ўσυŕ κёỳвĩиðīήġş: !!! !!! !!! !!! !!!</value>

View File

@@ -271,13 +271,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Ďϋφľіčάтέ τàв !!! </value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>₣σúŋδ ą φѓοƒĩļé ẃϊţħ äй ïηνàĺìď "backgroundImage". Đēƒãųŀŧϊпğ ťнªт φѓőƒĭļè το нªνе πō ьąçќġгθúпδ ιмãġė. Маĸē śμѓē ŧћäţ ẁђēή šêťτϊлġ å "backgroundImage", ţĥě νаłųё ïŝ ά νάľîď ƒĩŀê φąťħ ţŏ άń ΐмąġė. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>₣ǿũиđ à рřöƒϊℓз ŵĩţн аñ įņνàŀїδ "icon". Ðěƒаúľτīŋğ ţħаτ ρřόƒìŀё тб ђâνє пǿ íčой. Мàĸë ŝùřë ŧĥаţ ωĥĕл ŝеτŧīлĝ ăй "icon", τħε νāłϋë ïŝ ă νàľīđ ƒïŀè рªтн ţő äи ïмäģё. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! </value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>Ωňę бггě яėŝǿüґсėş (šυćн âş icon ōя backgroundImage) ŝрěçìƒįєð ίπ ýőūŕ ŝėтťīлġš ċòŭĺð йöŧ вέ ƒòúпď. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! </value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>Щαѓńΐňģš ώĕřе ƒбŭπδ ώħīļë рăяşìⁿġ ўσυŕ κёỳвĩиðīήġş: !!! !!! !!! !!! !!!</value>

View File

@@ -271,13 +271,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Ďϋφľіčάтέ τàв !!! </value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>₣σúŋδ ą φѓοƒĩļé ẃϊţħ äй ïηνàĺìď "backgroundImage". Đēƒãųŀŧϊпğ ťнªт φѓőƒĭļè το нªνе πō ьąçќġгθúпδ ιмãġė. Маĸē śμѓē ŧћäţ ẁђēή šêťτϊлġ å "backgroundImage", ţĥě νаłųё ïŝ ά νάľîď ƒĩŀê φąťħ ţŏ άń ΐмąġė. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>₣ǿũиđ à рřöƒϊℓз ŵĩţн аñ įņνàŀїδ "icon". Ðěƒаúľτīŋğ ţħаτ ρřόƒìŀё тб ђâνє пǿ íčой. Мàĸë ŝùřë ŧĥаţ ωĥĕл ŝеτŧīлĝ ăй "icon", τħε νāłϋë ïŝ ă νàľīđ ƒïŀè рªтн ţő äи ïмäģё. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! </value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>Ωňę бггě яėŝǿüґсėş (šυćн âş icon ōя backgroundImage) ŝрěçìƒįєð ίπ ýőūŕ ŝėтťīлġš ċòŭĺð йöŧ вέ ƒòúпď. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! </value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>Щαѓńΐňģš ώĕřе ƒбŭπδ ώħīļë рăяşìⁿġ ўσυŕ κёỳвĩиðīήġş: !!! !!! !!! !!! !!!</value>

View File

@@ -267,13 +267,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>Дублировать вкладку</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>Найден профиль с недопустимым объектом "backgroundImage". По умолчанию для этого профиля не используется фоновое изображение. Убедитесь, что значение, заданное для "backgroundImage", является допустимым путем файла к изображению.</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>Найден профиль с недопустимым объектом "icon". По умолчанию для этого профиля не используется значок. Убедитесь, что значение, заданное для "icon", является допустимым путем файла к изображению.</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>Не удалось найти один или несколько ресурсов (icon или backgroundImage), указанных в параметрах.</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>При анализе настраиваемых сочетаний клавиш найдены предупреждения:</value>

View File

@@ -267,13 +267,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>复制标签页</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>找到一个具有无效 "backgroundImage" 的配置文件。将该配置文件设置为默认设置为不包含背景图像。请确保在设置 "backgroundImage" 时,该值是指向图像的有效文件路径。</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>找到一个带有无效 "icon" 的配置文件。将该配置文件默认为无图标。确保设置 "icon" 时,该值是图像的有效文件路径。</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>找不到设置中指定的一个或多个资源 (,如 icon 或 backgroundImage)。</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>分析键绑定时发现警告:</value>

View File

@@ -267,13 +267,9 @@
<data name="DuplicateTabText" xml:space="preserve">
<value>複製索引標籤</value>
</data>
<data name="InvalidBackgroundImage" xml:space="preserve">
<value>找到具有無效 "backgroundImage" 的設定檔。將該設定檔的預設值設為沒有背景影像。請確定設定 "backgroundImage" 時,該值是影像的有效檔案路徑。</value>
<comment>{Locked="\"backgroundImage\""}</comment>
</data>
<data name="InvalidIcon" xml:space="preserve">
<value>已發現具有無效 "icon" 的設定檔。將該設定檔預設為無圖示。設定 "icon" 時,請確認值是有效的影像檔案路徑。</value>
<comment>{Locked="\"icon\""} The word "icon" in quotes is locked, the word icon OUTSIDE of quotes should be localized.</comment>
<data name="InvalidMediaResource" xml:space="preserve">
<value>找不到一或多個資源 (,例如在您的設定中指定的 icon 或 backgroundImage)。</value>
<comment>{Locked="icon","backgroundImage"} Indicates that something has gone wrong while reading a user's settings.</comment>
</data>
<data name="AtLeastOneKeybindingWarning" xml:space="preserve">
<value>剖析金鑰繫結時發現警告:</value>

View File

@@ -48,13 +48,22 @@ namespace winrt::TerminalApp::implementation
{
_settings = settings;
const auto dispatcher = Dispatcher();
const auto weak = get_weak();
// You'd think that `FilterToSendInput(queryString)` would work. It
// doesn't! That uses the queryString as the current command the user
// has typed, then relies on the suggestions UI to _also_ filter with that
// string.
const auto tasks = co_await _settings.GlobalSettings().ActionMap().FilterToSnippets(winrt::hstring{}, winrt::hstring{}); // IVector<Model::Command>
co_await wil::resume_foreground(Dispatcher());
co_await wil::resume_foreground(dispatcher);
const auto strong = weak.get();
if (!strong)
{
co_return;
}
_allTasks.Clear();
for (const auto& t : tasks)

View File

@@ -8,8 +8,8 @@
#include "SettingsPaneContent.h"
#include "Tab.g.cpp"
#include "Utils.h"
#include "ColorHelper.h"
#include "AppLogic.h"
#include "../../types/inc/ColorFix.hpp"
using namespace winrt;
using namespace winrt::Windows::UI::Xaml;
@@ -1035,27 +1035,48 @@ namespace winrt::TerminalApp::implementation
void Tab::_AttachEventHandlersToContent(const uint32_t paneId, const TerminalApp::IPaneContent& content)
{
auto weakThis{ get_weak() };
auto dispatcher = TabViewItem().Dispatcher();
auto dispatcher = DispatcherQueue::GetForCurrentThread();
ContentEventTokens events{};
auto throttledTitleChanged = std::make_shared<ThrottledFunc<>>(
dispatcher,
til::throttled_func_options{
.delay = std::chrono::milliseconds{ 200 },
.leading = true,
.trailing = true,
},
[weakThis]() {
if (const auto tab = weakThis.get())
{
tab->UpdateTitle();
}
});
events.TitleChanged = content.TitleChanged(
winrt::auto_revoke,
[dispatcher, weakThis](auto&&, auto&&) -> safe_void_coroutine {
// The lambda lives in the `std::function`-style container owned by `control`. That is, when the
// `control` gets destroyed the lambda struct also gets destroyed. In other words, we need to
// copy `weakThis` onto the stack, because that's the only thing that gets captured in coroutines.
// See: https://devblogs.microsoft.com/oldnewthing/20211103-00/?p=105870
const auto weakThisCopy = weakThis;
co_await wil::resume_foreground(dispatcher);
// Check if Tab's lifetime has expired
if (auto tab{ weakThisCopy.get() })
[func = std::move(throttledTitleChanged)](auto&&, auto&&) {
func->Run();
});
auto throttledTaskbarProgressChanged = std::make_shared<ThrottledFunc<>>(
dispatcher,
til::throttled_func_options{
.delay = std::chrono::milliseconds{ 200 },
.trailing = true,
},
[weakThis]() {
if (const auto tab = weakThis.get())
{
// The title of the control changed, but not necessarily the title of the tab.
// Set the tab's text to the active panes' text.
tab->UpdateTitle();
tab->_UpdateProgressState();
}
});
events.TaskbarProgressChanged = content.TaskbarProgressChanged(
winrt::auto_revoke,
[func = std::move(throttledTaskbarProgressChanged)](auto&&, auto&&) {
func->Run();
});
events.TabColorChanged = content.TabColorChanged(
winrt::auto_revoke,
[dispatcher, weakThis](auto&&, auto&&) -> safe_void_coroutine {
@@ -1071,18 +1092,6 @@ namespace winrt::TerminalApp::implementation
}
});
events.TaskbarProgressChanged = content.TaskbarProgressChanged(
winrt::auto_revoke,
[dispatcher, weakThis](auto&&, auto&&) -> safe_void_coroutine {
const auto weakThisCopy = weakThis;
co_await wil::resume_foreground(dispatcher);
// Check if Tab's lifetime has expired
if (auto tab{ weakThisCopy.get() })
{
tab->_UpdateProgressState();
}
});
events.ConnectionStateChanged = content.ConnectionStateChanged(
winrt::auto_revoke,
[dispatcher, weakThis](auto&&, auto&&) -> safe_void_coroutine {
@@ -2117,9 +2126,9 @@ namespace winrt::TerminalApp::implementation
// - The value to populate in the title run of the tool tip
winrt::hstring Tab::_CreateToolTipTitle()
{
if (const auto& control{ GetActiveTerminalControl() })
if (const auto profile{ GetFocusedProfile() })
{
const auto profileName{ control.Settings().ProfileName() };
const auto profileName{ profile.Name() };
if (profileName != Title())
{
return winrt::hstring{ fmt::format(FMT_COMPILE(L"{}: {}"), profileName, Title()) };
@@ -2275,11 +2284,13 @@ namespace winrt::TerminalApp::implementation
// the background color
// - This method should only be called on the UI thread.
// Arguments:
// - color: the color the user picked for their tab
// - uiColor: the color the user picked for their tab
// Return Value:
// - <none>
void Tab::_ApplyTabColorOnUIThread(const winrt::Windows::UI::Color& color)
void Tab::_ApplyTabColorOnUIThread(const winrt::Windows::UI::Color& uiColor)
{
constexpr auto lightnessThreshold = 0.6f;
const til::color color{ uiColor };
Media::SolidColorBrush selectedTabBrush{};
Media::SolidColorBrush deselectedTabBrush{};
Media::SolidColorBrush fontBrush{};
@@ -2292,7 +2303,7 @@ namespace winrt::TerminalApp::implementation
// calculate the luminance of the current color and select a font
// color based on that
// see https://www.w3.org/TR/WCAG20/#relativeluminancedef
if (TerminalApp::ColorHelper::IsBrightColor(color))
if (ColorFix::GetLightness(color) >= lightnessThreshold)
{
auto subtleFillColorSecondary = winrt::Windows::UI::Colors::Black();
subtleFillColorSecondary.A = 0x09;
@@ -2312,8 +2323,8 @@ namespace winrt::TerminalApp::implementation
}
// The tab font should be based on the evaluated appearance of the tab color layered on tab row.
const auto layeredTabColor = til::color{ color }.layer_over(_tabRowColor);
if (TerminalApp::ColorHelper::IsBrightColor(layeredTabColor))
const auto layeredTabColor = color.layer_over(_tabRowColor);
if (ColorFix::GetLightness(layeredTabColor) >= lightnessThreshold)
{
fontBrush.Color(winrt::Windows::UI::Colors::Black());
auto secondaryFontColor = winrt::Windows::UI::Colors::Black();
@@ -2333,8 +2344,7 @@ namespace winrt::TerminalApp::implementation
selectedTabBrush.Color(color);
// Start with the current tab color, set to Opacity=.3
til::color deselectedTabColor{ color };
deselectedTabColor = deselectedTabColor.with_alpha(77); // 255 * .3 = 77
auto deselectedTabColor = color.with_alpha(77); // 255 * .3 = 77
// If we DON'T have a color set from the color picker, or the profile's
// tabColor, but we do have a unfocused color in the theme, use the
@@ -2376,7 +2386,7 @@ namespace winrt::TerminalApp::implementation
// We don't want that to result in white text on a white tab row for
// inactive tabs.
const auto deselectedActualColor = deselectedTabColor.layer_over(_tabRowColor);
if (TerminalApp::ColorHelper::IsBrightColor(deselectedActualColor))
if (ColorFix::GetLightness(deselectedActualColor) >= lightnessThreshold)
{
deselectedFontBrush.Color(winrt::Windows::UI::Colors::Black());
}
@@ -2407,7 +2417,7 @@ namespace winrt::TerminalApp::implementation
const auto& currentDictionary = v.as<ResourceDictionary>();
// TabViewItem.Background
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackground"), deselectedTabBrush);
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackground"), selectedTabBrush);
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackgroundSelected"), selectedTabBrush);
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPointerOver"), isHighContrast ? fontBrush : hoverTabBrush);
currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPressed"), selectedTabBrush);

View File

@@ -21,8 +21,8 @@ namespace TerminalApp
UInt32 TabViewIndex;
UInt32 TabViewNumTabs;
overridable void Focus(Windows.UI.Xaml.FocusState focusState);
overridable void Shutdown();
void Focus(Windows.UI.Xaml.FocusState focusState);
void Shutdown();
void SetDispatch(ShortcutActionDispatch dispatch);
}

View File

@@ -18,7 +18,6 @@
#include <LibraryResources.h>
#include "TabRowControl.h"
#include "ColorHelper.h"
#include "DebugTapConnection.h"
#include "..\TerminalSettingsModel\FileUtils.h"
@@ -158,12 +157,7 @@ namespace winrt::TerminalApp::implementation
// Set this tab's icon to the icon from the content
_UpdateTabIcon(*newTabImpl);
// This is necessary, because WinUI does not have support for middle clicks.
// Its Tapped event doesn't provide the information what button was used either.
tabViewItem.PointerPressed({ this, &TerminalPage::_OnTabPointerPressed });
tabViewItem.PointerReleased({ this, &TerminalPage::_OnTabPointerReleased });
tabViewItem.PointerExited({ this, &TerminalPage::_OnTabPointerExited });
tabViewItem.PointerEntered({ this, &TerminalPage::_OnTabPointerEntered });
// When the tab requests close, try to close it (prompt for approval, if required)
newTabImpl->CloseRequested([weakTab, weakThis{ get_weak() }](auto&& /*s*/, auto&& /*e*/) {
@@ -403,12 +397,18 @@ namespace winrt::TerminalApp::implementation
// - tab: the tab to remove
winrt::Windows::Foundation::IAsyncAction TerminalPage::_HandleCloseTabRequested(winrt::TerminalApp::Tab tab)
{
winrt::com_ptr<TerminalPage> strong;
if (tab.ReadOnly())
{
const auto weak = get_weak();
auto warningResult = co_await _ShowCloseReadOnlyDialog();
strong = weak.get();
// If the user didn't explicitly click on close tab - leave
if (warningResult != ContentDialogResult::Primary)
if (!strong || warningResult != ContentDialogResult::Primary)
{
co_return;
}
@@ -665,7 +665,7 @@ namespace winrt::TerminalApp::implementation
// Method Description:
// - returns a tab corresponding to a view item. This might return null,
// so make sure to check the result!
winrt::TerminalApp::Tab TerminalPage::_GetTabByTabViewItem(const Microsoft::UI::Xaml::Controls::TabViewItem& tabViewItem) const noexcept
winrt::TerminalApp::Tab TerminalPage::_GetTabByTabViewItem(const IInspectable& tabViewItem) const noexcept
{
uint32_t tabIndexFromControl{};
const auto items{ _tabView.TabItems() };
@@ -719,10 +719,14 @@ namespace winrt::TerminalApp::implementation
{
if (pane->ContainsReadOnly())
{
const auto weak = get_weak();
auto warningResult = co_await _ShowCloseReadOnlyDialog();
const auto strong = weak.get();
// If the user didn't explicitly click on close tab - leave
if (warningResult != ContentDialogResult::Primary)
if (!strong || warningResult != ContentDialogResult::Primary)
{
co_return false;
}
@@ -780,9 +784,13 @@ namespace winrt::TerminalApp::implementation
if (const auto pane{ activeTab->GetActivePane() })
{
const auto weak = get_weak();
if (co_await _PaneConfirmCloseReadOnly(pane))
{
_HandleClosePaneRequested(pane);
if (const auto strong = weak.get())
{
_HandleClosePaneRequested(pane);
}
}
}
}
@@ -840,9 +848,22 @@ namespace winrt::TerminalApp::implementation
// - tabs - tabs to remove
safe_void_coroutine TerminalPage::_RemoveTabs(const std::vector<winrt::TerminalApp::Tab> tabs)
{
const auto weak = get_weak();
for (auto& tab : tabs)
{
co_await _HandleCloseTabRequested(tab);
winrt::Windows::Foundation::IAsyncAction action{ nullptr };
if (const auto strong = weak.get())
{
action = _HandleCloseTabRequested(tab);
}
if (!action)
{
co_return;
}
co_await action;
}
}
// Method Description:
@@ -877,60 +898,69 @@ namespace winrt::TerminalApp::implementation
_UpdateTabView();
}
// Method Description:
// - Additional responses to clicking on a TabView's item. Currently, just remove tab with middle click
// Arguments:
// - sender: the control that originated this event (TabViewItem)
// - eventArgs: the event's constituent arguments
void TerminalPage::_OnTabPointerPressed(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs)
void TerminalPage::_OnTabPointerPressed(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& e)
{
if (eventArgs.GetCurrentPoint(nullptr).Properties().IsMiddleButtonPressed())
if (!_tabItemMiddleClickHookEnabled || !e.GetCurrentPoint(nullptr).Properties().IsMiddleButtonPressed())
{
if (const auto tabViewItem{ sender.try_as<MUX::Controls::TabViewItem>() })
{
_tabPointerMiddleButtonPressed = tabViewItem.CapturePointer(eventArgs.Pointer());
_tabPointerMiddleButtonExited = false;
}
eventArgs.Handled(true);
return;
}
const auto tabViewItem = sender.try_as<MUX::Controls::TabViewItem>();
if (!tabViewItem || !tabViewItem.CapturePointer(e.Pointer()))
{
return;
}
_tabItemMiddleClickExited = false;
_tabItemMiddleClickPointerEntered = tabViewItem.PointerEntered(winrt::auto_revoke, [this](auto&&, auto&& e) {
_tabItemMiddleClickExited = false;
e.Handled(true);
});
_tabItemMiddleClickPointerExited = tabViewItem.PointerExited(winrt::auto_revoke, [this](auto&&, auto&& e) {
_tabItemMiddleClickExited = true;
e.Handled(true);
});
_tabItemMiddleClickPointerCaptureLost = tabViewItem.PointerCaptureLost(winrt::auto_revoke, [this](auto&& sender, auto&& e) {
// The WinUI TabView calls CapturePointer() internally and it's not reference counted,
// so when it calls ReleasePointerCapture() in its PointerReleased handler,
// we get a PointerCaptureLost before we receive the PointerReleased event.
// This makes typical handling of PointerReleased events on our side difficult.
// Well, whatever, now we just hook PointerCaptureLost because we know WinUI will trigger it.
_tabItemMiddleClickPointerEntered.revoke();
_tabItemMiddleClickPointerExited.revoke();
_tabItemMiddleClickPointerCaptureLost.revoke();
if (!_tabItemMiddleClickExited && !e.GetCurrentPoint(nullptr).Properties().IsMiddleButtonPressed())
{
_OnTabPointerReleasedCloseTab(std::move(sender));
}
e.Handled(true);
});
e.Handled(true);
}
// Method Description:
// - Tracking pointer state for tab remove
// Arguments:
// - sender: the control that originated this event (TabViewItem)
// - eventArgs: the event's constituent arguments
void TerminalPage::_OnTabPointerReleased(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs)
safe_void_coroutine TerminalPage::_OnTabPointerReleasedCloseTab(IInspectable sender)
{
if (_tabPointerMiddleButtonPressed && !eventArgs.GetCurrentPoint(nullptr).Properties().IsMiddleButtonPressed())
// WinUI asynchronously updates its tab view items, so it may happen that we're given a
// `TabViewItem` that still contains a `Tab` which has actually already been removed.
// First we must yield once, to flush out whatever TabView is currently doing.
const auto weak = get_weak();
co_await wil::resume_foreground(Dispatcher());
const auto strong = weak.get();
if (!strong)
{
_tabPointerMiddleButtonPressed = false;
if (auto tabViewItem{ sender.try_as<MUX::Controls::TabViewItem>() })
{
tabViewItem.ReleasePointerCapture(eventArgs.Pointer());
if (!_tabPointerMiddleButtonExited)
{
_OnTabPointerReleasedCloseTab(std::move(tabViewItem));
}
}
eventArgs.Handled(true);
co_return;
}
}
safe_void_coroutine TerminalPage::_OnTabPointerReleasedCloseTab(winrt::Microsoft::UI::Xaml::Controls::TabViewItem sender)
{
const auto tab = _GetTabByTabViewItem(sender);
if (!tab)
{
co_return;
}
// WinUI asynchronously updates its tab view items, so it may happen that we're given a
// `TabViewItem` that still contains a `Tab` which has actually already been removed.
// First we must yield once, to flush out whatever TabView is currently doing.
const auto strong = get_strong();
co_await wil::resume_foreground(Dispatcher());
// `tab.Shutdown()` in `_RemoveTab()` sets the content to null = This checks if the tab is closed.
if (tab.Content())
{
@@ -938,34 +968,6 @@ namespace winrt::TerminalApp::implementation
}
}
// Method Description:
// - Tracking pointer state for tab remove
// Arguments:
// - sender: the control that originated this event (TabViewItem)
// - eventArgs: the event's constituent arguments
void TerminalPage::_OnTabPointerEntered(const IInspectable& /*sender*/, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs)
{
if (eventArgs.GetCurrentPoint(nullptr).Properties().IsMiddleButtonPressed())
{
_tabPointerMiddleButtonExited = false;
eventArgs.Handled(true);
}
}
// Method Description:
// - Tracking pointer state for tab remove
// Arguments:
// - sender: the control that originated this event (TabViewItem)
// - eventArgs: the event's constituent arguments
void TerminalPage::_OnTabPointerExited(const IInspectable& /*sender*/, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs)
{
if (eventArgs.GetCurrentPoint(nullptr).Properties().IsMiddleButtonPressed())
{
_tabPointerMiddleButtonExited = true;
eventArgs.Handled(true);
}
}
void TerminalPage::_UpdatedSelectedTab(const winrt::TerminalApp::Tab& tab)
{
// Unfocus all the tabs.
@@ -1000,10 +1002,7 @@ namespace winrt::TerminalApp::implementation
tab.TabViewItem().StartBringIntoView();
// Raise an event that our title changed
if (_settings.GlobalSettings().ShowTitleInTitlebar())
{
TitleChanged.raise(*this, tab.Title());
}
TitleChanged.raise(*this, nullptr);
_updateThemeColors();
@@ -1013,6 +1012,8 @@ namespace winrt::TerminalApp::implementation
auto profile = tabImpl->GetFocusedProfile();
_UpdateBackground(profile);
}
_adjustProcessPriorityThrottled->Run();
}
CATCH_LOG();
}

View File

@@ -26,6 +26,7 @@
<TerminalCppWinrt>true</TerminalCppWinrt>
<TerminalMUX>true</TerminalMUX>
<TerminalWinGetInterop>true</TerminalWinGetInterop>
<TerminalThemeHelpers>true</TerminalThemeHelpers>
</PropertyGroup>
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
<Import Project="$(OpenConsoleDir)src\common.nugetversions.props" />
@@ -134,7 +135,6 @@
<ClInclude Include="FilteredCommand.h" />
<ClInclude Include="Pane.h" />
<ClInclude Include="fzf/fzf.h" />
<ClInclude Include="ColorHelper.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="ShortcutActionDispatch.h">
<DependentUpon>ShortcutActionDispatch.idl</DependentUpon>
@@ -174,9 +174,7 @@
<DependentUpon>TerminalPaneContent.idl</DependentUpon>
</ClInclude>
<ClInclude Include="Toast.h" />
<ClInclude Include="TerminalSettingsCache.h">
<DependentUpon>TerminalSettingsCache.idl</DependentUpon>
</ClInclude>
<ClInclude Include="TerminalSettingsCache.h" />
<ClInclude Include="SuggestionsControl.h">
<DependentUpon>SuggestionsControl.xaml</DependentUpon>
</ClInclude>
@@ -247,9 +245,6 @@
<ClCompile Include="FilteredCommand.cpp" />
<ClCompile Include="Pane.cpp" />
<ClCompile Include="Pane.LayoutSizeNode.cpp" />
<ClCompile Include="ColorHelper.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="DebugTapConnection.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
@@ -292,9 +287,7 @@
</ClCompile>
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
<ClCompile Include="Toast.cpp" />
<ClCompile Include="TerminalSettingsCache.cpp">
<DependentUpon>TerminalSettingsCache.idl</DependentUpon>
</ClCompile>
<ClCompile Include="TerminalSettingsCache.cpp" />
<ClCompile Include="SuggestionsControl.cpp">
<DependentUpon>SuggestionsControl.xaml</DependentUpon>
</ClCompile>
@@ -369,7 +362,6 @@
<DependentUpon>TaskPaneContent.xaml</DependentUpon>
<SubType>Code</SubType>
</Midl>
<Midl Include="TerminalSettingsCache.idl" />
<Midl Include="MarkdownPaneContent.idl">
<DependentUpon>MarkdownPaneContent.xaml</DependentUpon>
<SubType>Code</SubType>

View File

@@ -20,7 +20,6 @@
</ClCompile>
<ClCompile Include="AppCommandlineArgs.cpp" />
<ClCompile Include="Commandline.cpp" />
<ClCompile Include="ColorHelper.cpp" />
<ClCompile Include="DebugTapConnection.cpp" />
<ClCompile Include="Jumplist.cpp" />
<ClCompile Include="FilteredCommand.cpp">
@@ -48,7 +47,6 @@
<ClInclude Include="AppCommandlineArgs.h" />
<ClInclude Include="Commandline.h" />
<ClInclude Include="DebugTapConnection.h" />
<ClInclude Include="ColorHelper.h" />
<ClInclude Include="Jumplist.h" />
<ClInclude Include="FilteredCommand.h">
<Filter>commandPalette</Filter>
@@ -92,7 +90,6 @@
<Midl Include="TerminalWindow.idl" />
<Midl Include="TaskbarState.idl" />
<Midl Include="IPaneContent.idl" />
<Midl Include="TerminalSettingsCache.idl" />
<Midl Include="Monarch.idl" />
</ItemGroup>
<ItemGroup>

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,8 @@
#pragma once
#include <ThrottledFunc.h>
#include "TerminalPage.g.h"
#include "Tab.h"
#include "AppKeyBindings.h"
@@ -29,6 +31,8 @@ namespace Microsoft::Terminal::Core
namespace winrt::TerminalApp::implementation
{
struct TerminalSettingsCache;
inline constexpr uint32_t DefaultRowsToScroll{ 3 };
inline constexpr std::wstring_view TabletInputServiceKey{ L"TabletInputService" };
@@ -149,7 +153,7 @@ namespace winrt::TerminalApp::implementation
safe_void_coroutine ProcessStartupActions(std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> actions,
const winrt::hstring cwd = winrt::hstring{},
const winrt::hstring env = winrt::hstring{});
void CreateTabFromConnection(winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection connection);
safe_void_coroutine CreateTabFromConnection(winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection connection);
TerminalApp::WindowProperties WindowProperties() const noexcept { return _WindowProperties; };
@@ -169,7 +173,7 @@ namespace winrt::TerminalApp::implementation
til::property_changed_event PropertyChanged;
// -------------------------------- WinRT Events ---------------------------------
til::typed_event<IInspectable, winrt::hstring> TitleChanged;
til::typed_event<IInspectable, IInspectable> TitleChanged;
til::typed_event<IInspectable, IInspectable> CloseWindowRequested;
til::typed_event<IInspectable, winrt::Windows::UI::Xaml::UIElement> SetTitleBarContent;
til::typed_event<IInspectable, IInspectable> FocusModeChanged;
@@ -273,7 +277,7 @@ namespace winrt::TerminalApp::implementation
TerminalApp::ContentManager _manager{ nullptr };
TerminalApp::TerminalSettingsCache _terminalSettingsCache{ nullptr };
std::shared_ptr<TerminalSettingsCache> _terminalSettingsCache{};
struct StashedDragData
{
@@ -359,8 +363,11 @@ namespace winrt::TerminalApp::implementation
bool _MovePane(const Microsoft::Terminal::Settings::Model::MovePaneArgs args);
bool _MoveTab(winrt::com_ptr<Tab> tab, const Microsoft::Terminal::Settings::Model::MoveTabArgs args);
std::shared_ptr<ThrottledFunc<>> _adjustProcessPriorityThrottled;
void _adjustProcessPriority() const;
template<typename F>
bool _ApplyToActiveControls(F f)
bool _ApplyToActiveControls(F f) const
{
if (const auto tab{ _GetFocusedTabImpl() })
{
@@ -379,12 +386,12 @@ namespace winrt::TerminalApp::implementation
return false;
}
winrt::Microsoft::Terminal::Control::TermControl _GetActiveControl();
winrt::Microsoft::Terminal::Control::TermControl _GetActiveControl() const;
std::optional<uint32_t> _GetFocusedTabIndex() const noexcept;
std::optional<uint32_t> _GetTabIndex(const TerminalApp::Tab& tab) const noexcept;
TerminalApp::Tab _GetFocusedTab() const noexcept;
winrt::com_ptr<Tab> _GetFocusedTabImpl() const noexcept;
TerminalApp::Tab _GetTabByTabViewItem(const Microsoft::UI::Xaml::Controls::TabViewItem& tabViewItem) const noexcept;
TerminalApp::Tab _GetTabByTabViewItem(const IInspectable& tabViewItem) const noexcept;
void _HandleClosePaneRequested(std::shared_ptr<Pane> pane);
safe_void_coroutine _SetFocusedTab(const winrt::TerminalApp::Tab tab);
@@ -413,10 +420,11 @@ namespace winrt::TerminalApp::implementation
bool _IsUriSupported(const winrt::Windows::Foundation::Uri& parsedUri);
void _ShowCouldNotOpenDialog(winrt::hstring reason, winrt::hstring uri);
bool _CopyText(const bool dismissSelection, const bool singleLine, const bool withControlSequences, const Windows::Foundation::IReference<Microsoft::Terminal::Control::CopyFormat>& formats);
bool _CopyText(bool dismissSelection, bool singleLine, bool withControlSequences, Microsoft::Terminal::Control::CopyFormat formats);
safe_void_coroutine _SetTaskbarProgressHandler(const IInspectable sender, const IInspectable eventArgs);
void _copyToClipboard(IInspectable, Microsoft::Terminal::Control::WriteToClipboardEventArgs args) const;
void _PasteText();
safe_void_coroutine _ControlNoticeRaisedHandler(const IInspectable sender, const Microsoft::Terminal::Control::NoticeEventArgs eventArgs);
@@ -427,13 +435,18 @@ namespace winrt::TerminalApp::implementation
void _TabDragStarted(const IInspectable& sender, const IInspectable& eventArgs);
void _TabDragCompleted(const IInspectable& sender, const IInspectable& eventArgs);
bool _tabPointerMiddleButtonPressed{ false };
bool _tabPointerMiddleButtonExited{ false };
// BODGY: WinUI's TabView has a broken close event handler:
// If the close button is disabled, middle-clicking the tab raises no close
// event. Because that's dumb, we implement our own middle-click handling.
// `_tabItemMiddleClickHookEnabled` is true whenever the close button is hidden,
// and that enables all of the rest of this machinery (and this workaround).
bool _tabItemMiddleClickHookEnabled = false;
bool _tabItemMiddleClickExited = false;
PointerEntered_revoker _tabItemMiddleClickPointerEntered;
PointerExited_revoker _tabItemMiddleClickPointerExited;
PointerCaptureLost_revoker _tabItemMiddleClickPointerCaptureLost;
void _OnTabPointerPressed(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
void _OnTabPointerReleased(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
safe_void_coroutine _OnTabPointerReleasedCloseTab(winrt::Microsoft::UI::Xaml::Controls::TabViewItem sender);
void _OnTabPointerEntered(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
void _OnTabPointerExited(const IInspectable& sender, const Windows::UI::Xaml::Input::PointerRoutedEventArgs& eventArgs);
safe_void_coroutine _OnTabPointerReleasedCloseTab(IInspectable sender);
void _OnTabSelectionChanged(const IInspectable& sender, const Windows::UI::Xaml::Controls::SelectionChangedEventArgs& eventArgs);
void _OnTabItemsChanged(const IInspectable& sender, const Windows::Foundation::Collections::IVectorChangedEventArgs& eventArgs);
@@ -463,7 +476,7 @@ namespace winrt::TerminalApp::implementation
void _RefreshUIForSettingsReload();
void _SetNewTabButtonColor(const Windows::UI::Color& color, const Windows::UI::Color& accentColor);
void _SetNewTabButtonColor(til::color color, til::color accentColor);
void _ClearNewTabButtonColor();
safe_void_coroutine _CompleteInitialization();
@@ -507,7 +520,7 @@ namespace winrt::TerminalApp::implementation
const winrt::Microsoft::Terminal::Settings::Model::Profile& profile);
void _OpenElevatedWT(winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs newTerminalArgs);
safe_void_coroutine _ConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
safe_void_coroutine _ConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
void _CloseOnExitInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
void _KeyboardServiceWarningInfoDismissHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args) const;
static bool _IsMessageDismissed(const winrt::Microsoft::Terminal::Settings::Model::InfoBarMessage& message);
@@ -523,7 +536,7 @@ namespace winrt::TerminalApp::implementation
void _ShowWindowChangedHandler(const IInspectable sender, const winrt::Microsoft::Terminal::Control::ShowWindowArgs args);
Windows::Foundation::IAsyncAction _SearchMissingCommandHandler(const IInspectable sender, const winrt::Microsoft::Terminal::Control::SearchMissingCommandEventArgs args);
Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Management::Deployment::MatchResult>> _FindPackageAsync(hstring query);
static Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IVectorView<winrt::Microsoft::Management::Deployment::MatchResult>> _FindPackageAsync(hstring query);
void _WindowSizeChanged(const IInspectable sender, const winrt::Microsoft::Terminal::Control::WindowSizeChangedEventArgs args);
void _windowPropertyChanged(const IInspectable& sender, const winrt::Windows::UI::Xaml::Data::PropertyChangedEventArgs& args);

View File

@@ -82,7 +82,7 @@ namespace TerminalApp
void WindowActivated(Boolean activated);
void SendContentToOther(RequestReceiveContentArgs args);
event Windows.Foundation.TypedEventHandler<Object, String> TitleChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> TitleChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> CloseWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.UIElement> SetTitleBarContent;
event Windows.Foundation.TypedEventHandler<Object, Object> FocusModeChanged;

View File

@@ -6,6 +6,7 @@
#include <mmsystem.h>
#include "TerminalSettingsCache.h"
#include "../../types/inc/utils.hpp"
#include "BellEventArgs.g.cpp"
@@ -20,7 +21,7 @@ using namespace winrt::Microsoft::Terminal::TerminalConnection;
namespace winrt::TerminalApp::implementation
{
TerminalPaneContent::TerminalPaneContent(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile,
const TerminalApp::TerminalSettingsCache& cache,
const std::shared_ptr<TerminalSettingsCache>& cache,
const winrt::Microsoft::Terminal::Control::TermControl& control) :
_control{ control },
_cache{ cache },
@@ -82,7 +83,7 @@ namespace winrt::TerminalApp::implementation
winrt::hstring TerminalPaneContent::Icon() const
{
return _profile.EvaluatedIcon();
return _profile.Icon().Resolved();
}
Windows::Foundation::IReference<winrt::Windows::UI::Color> TerminalPaneContent::TabColor() const noexcept
@@ -278,7 +279,7 @@ namespace winrt::TerminalApp::implementation
auto sounds{ _profile.BellSound() };
if (sounds && sounds.Size() > 0)
{
winrt::hstring soundPath{ wil::ExpandEnvironmentStringsW<std::wstring>(sounds.GetAt(rand() % sounds.Size()).c_str()) };
winrt::hstring soundPath{ sounds.GetAt(rand() % sounds.Size()).Resolved() };
winrt::Windows::Foundation::Uri uri{ soundPath };
_playBellSound(uri);
}
@@ -340,9 +341,13 @@ namespace winrt::TerminalApp::implementation
RestartTerminalRequested.raise(*this, nullptr);
}
void TerminalPaneContent::UpdateSettings(const CascadiaSettings& /*settings*/)
void TerminalPaneContent::UpdateSettings(const CascadiaSettings& settings)
{
if (const auto& settings{ _cache.TryLookup(_profile) })
// Reload our profile from the settings model to propagate bell mode, icon, and close on exit mode (anything that uses _profile).
const auto profile{ settings.FindProfile(_profile.Guid()) };
_profile = profile ? profile : settings.ProfileDefaults();
if (const auto& settings{ _cache->TryLookup(_profile) })
{
_control.UpdateControlSettings(settings.DefaultSettings(), settings.UnfocusedSettings());
}

View File

@@ -8,6 +8,8 @@
namespace winrt::TerminalApp::implementation
{
struct TerminalSettingsCache;
struct BellEventArgs : public BellEventArgsT<BellEventArgs>
{
public:
@@ -20,7 +22,7 @@ namespace winrt::TerminalApp::implementation
struct TerminalPaneContent : TerminalPaneContentT<TerminalPaneContent>, BasicPaneEvents
{
TerminalPaneContent(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile,
const TerminalApp::TerminalSettingsCache& cache,
const std::shared_ptr<TerminalSettingsCache>& cache,
const winrt::Microsoft::Terminal::Control::TermControl& control);
winrt::Windows::UI::Xaml::FrameworkElement GetRoot();
@@ -59,7 +61,7 @@ namespace winrt::TerminalApp::implementation
winrt::Microsoft::Terminal::Control::TermControl _control{ nullptr };
winrt::Microsoft::Terminal::TerminalConnection::ConnectionState _connectionState{ winrt::Microsoft::Terminal::TerminalConnection::ConnectionState::NotConnected };
winrt::Microsoft::Terminal::Settings::Model::Profile _profile{ nullptr };
TerminalApp::TerminalSettingsCache _cache{ nullptr };
std::shared_ptr<TerminalSettingsCache> _cache{};
bool _isDefTermSession{ false };
winrt::Windows::Media::Playback::MediaPlayer _bellPlayer{ nullptr };

View File

@@ -2,7 +2,6 @@
// Licensed under the MIT license.
import "IPaneContent.idl";
import "TerminalSettingsCache.idl";
import "FilteredCommand.idl";
namespace TerminalApp

View File

@@ -3,7 +3,6 @@
#include "pch.h"
#include "TerminalSettingsCache.h"
#include "TerminalSettingsCache.g.cpp"
namespace winrt
{

View File

@@ -13,14 +13,13 @@ Abstract:
--*/
#pragma once
#include "TerminalSettingsCache.g.h"
#include <inc/cppwinrt_utils.h>
#include "winrt/Microsoft.Terminal.Settings.Model.h"
#include "winrt/TerminalApp.h"
namespace winrt::TerminalApp::implementation
{
class TerminalSettingsCache : public TerminalSettingsCacheT<TerminalSettingsCache>
struct TerminalSettingsCache
{
public:
TerminalSettingsCache(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings, const TerminalApp::AppKeyBindings& bindings);
Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult TryLookup(const Microsoft::Terminal::Settings::Model::Profile& profile);
void Reset(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings, const TerminalApp::AppKeyBindings& bindings);
@@ -31,8 +30,3 @@ namespace winrt::TerminalApp::implementation
std::unordered_map<winrt::guid, std::pair<Microsoft::Terminal::Settings::Model::Profile, Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult>> profileGuidSettingsMap;
};
}
namespace winrt::TerminalApp::factory_implementation
{
BASIC_FACTORY(TerminalSettingsCache);
}

View File

@@ -1,13 +0,0 @@
import "AppKeyBindings.idl";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
namespace TerminalApp
{
[default_interface] runtimeclass TerminalSettingsCache
{
TerminalSettingsCache(Microsoft.Terminal.Settings.Model.CascadiaSettings settings, AppKeyBindings bindings);
Microsoft.Terminal.Settings.Model.TerminalSettingsCreateResult TryLookup(Microsoft.Terminal.Settings.Model.Profile profile);
void Reset(Microsoft.Terminal.Settings.Model.CascadiaSettings settings, AppKeyBindings bindings);
}
}

View File

@@ -40,8 +40,7 @@ static const std::array settingsLoadWarningsLabels{
USES_RESOURCE(L"MissingDefaultProfileText"),
USES_RESOURCE(L"DuplicateProfileText"),
USES_RESOURCE(L"UnknownColorSchemeText"),
USES_RESOURCE(L"InvalidBackgroundImage"),
USES_RESOURCE(L"InvalidIcon"),
USES_RESOURCE(L"InvalidMediaResource"),
USES_RESOURCE(L"AtLeastOneKeybindingWarning"),
USES_RESOURCE(L"TooManyKeysForChord"),
USES_RESOURCE(L"MissingRequiredParameter"),
@@ -323,6 +322,10 @@ namespace winrt::TerminalApp::implementation
// - an IAsyncOperation with the dialog result
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalWindow::ShowDialog(winrt::WUX::Controls::ContentDialog dialog)
{
const auto weak = get_weak();
const auto dispatcher = _root->Dispatcher();
const auto root = _root->XamlRoot();
// As mentioned on s_activeDialog, dismissing the active dialog is necessary.
// We repeat it a few times in case the resume_foreground failed to work,
// but I found that one iteration will always be enough in practice.
@@ -336,7 +339,7 @@ namespace winrt::TerminalApp::implementation
s_activeDialog.Hide();
// Wait for the current dialog to be hidden.
co_await wil::resume_foreground(_root->Dispatcher(), CoreDispatcherPriority::Low);
co_await wil::resume_foreground(dispatcher, CoreDispatcherPriority::Low);
}
// If two sources call ShowDialog() simultaneously, it may happen that both enter the above loop,
@@ -353,7 +356,7 @@ namespace winrt::TerminalApp::implementation
// IMPORTANT: This is necessary as documented in the ContentDialog MSDN docs.
// Since we're hosting the dialog in a Xaml island, we need to connect it to the
// xaml tree somehow.
dialog.XamlRoot(_root->XamlRoot());
dialog.XamlRoot(root);
// IMPORTANT: Set the requested theme of the dialog, because the
// PopupRoot isn't directly in the Xaml tree of our root. So the dialog
@@ -367,14 +370,17 @@ namespace winrt::TerminalApp::implementation
// theme on each element up to the root. We're relying a bit on Xaml's implementation
// details here, but it does have the desired effect.
// It's not enough to set the theme on the dialog alone.
auto themingLambda{ [this](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
auto theme{ _settings.GlobalSettings().CurrentTheme() };
auto requestedTheme{ theme.RequestedTheme() };
auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
while (element)
auto themingLambda{ [weak](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
if (const auto strong = weak.get())
{
element.RequestedTheme(requestedTheme);
element = element.Parent().try_as<winrt::Windows::UI::Xaml::FrameworkElement>();
auto theme{ strong->_settings.GlobalSettings().CurrentTheme() };
auto requestedTheme{ theme.RequestedTheme() };
auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
while (element)
{
element.RequestedTheme(requestedTheme);
element = element.Parent().try_as<winrt::Windows::UI::Xaml::FrameworkElement>();
}
}
} };
@@ -889,6 +895,11 @@ namespace winrt::TerminalApp::implementation
{
// Manually bubble the OnDirectKeyEvent event up through the focus tree.
auto xamlRoot{ _root->XamlRoot() };
if (!xamlRoot)
{
return false;
}
auto focusedObject{ Windows::UI::Xaml::Input::FocusManager::GetFocusedElement(xamlRoot) };
do
{
@@ -1049,6 +1060,11 @@ namespace winrt::TerminalApp::implementation
// (or called TerminalWindow::Initialize)
if (_appArgs->ExitCode() == 0)
{
// The existing logic (before this commit) strictly relied on
// ValidateStartupCommands() only to be called for new windows.
// It modifies the actions it stores.
parsedArgs.ValidateStartupCommands();
// If the size of the arguments list is 1,
// then it contains only the executable name and no other arguments.
_hasCommandLineArguments = _appArgs->CommandlineRef().size() > 1;

View File

@@ -210,7 +210,7 @@ namespace winrt::TerminalApp::implementation
FORWARDED_TYPED_EVENT(Initialized, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, Initialized);
FORWARDED_TYPED_EVENT(SetTitleBarContent, winrt::Windows::Foundation::IInspectable, winrt::Windows::UI::Xaml::UIElement, _root, SetTitleBarContent);
FORWARDED_TYPED_EVENT(TitleChanged, winrt::Windows::Foundation::IInspectable, winrt::hstring, _root, TitleChanged);
FORWARDED_TYPED_EVENT(TitleChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, TitleChanged);
FORWARDED_TYPED_EVENT(CloseWindowRequested, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, CloseWindowRequested);
FORWARDED_TYPED_EVENT(FocusModeChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, FocusModeChanged);
FORWARDED_TYPED_EVENT(FullscreenChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, FullscreenChanged);

View File

@@ -112,7 +112,7 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, Object> Initialized;
event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.UIElement> SetTitleBarContent;
event Windows.Foundation.TypedEventHandler<Object, String> TitleChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> TitleChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> CloseWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Settings.Model.Theme> RequestedThemeChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> FocusModeChanged;

View File

@@ -7,8 +7,7 @@
#include "pch.h"
#include "TitlebarControl.h"
#include "ColorHelper.h"
#include "../../types/inc/ColorFix.hpp"
#include "TitlebarControl.g.cpp"
@@ -54,6 +53,16 @@ namespace winrt::TerminalApp::implementation
return static_cast<float>(minMaxCloseWidth) / 3.0f;
}
bool TitlebarControl::Focused()
{
return MinMaxCloseControl().Focused();
}
void TitlebarControl::Focused(bool focused)
{
MinMaxCloseControl().Focused(focused);
}
IInspectable TitlebarControl::Content()
{
return ContentRoot().Content();
@@ -189,7 +198,8 @@ namespace winrt::TerminalApp::implementation
return;
}
const auto isBrightColor = ColorHelper::IsBrightColor(c);
constexpr auto lightnessThreshold = 0.6f;
const auto isBrightColor = ColorFix::GetLightness(c) >= lightnessThreshold;
MinMaxCloseControl().RequestedTheme(isBrightColor ? winrt::Windows::UI::Xaml::ElementTheme::Light :
winrt::Windows::UI::Xaml::ElementTheme::Dark);
}

View File

@@ -17,6 +17,9 @@ namespace winrt::TerminalApp::implementation
void ReleaseButtons();
float CaptionButtonWidth();
bool Focused();
void Focused(bool focused);
IInspectable Content();
void Content(IInspectable content);

View File

@@ -29,6 +29,7 @@ namespace TerminalApp
void ClickButton(CaptionButton button);
void ReleaseButtons();
Single CaptionButtonWidth { get; };
Boolean Focused { get; set; };
IInspectable Content;
Windows.UI.Xaml.Controls.Border DragBar { get; };

View File

@@ -16,6 +16,7 @@
<PropertyGroup Label="NuGet Dependencies">
<TerminalCppWinrt>true</TerminalCppWinrt>
<TerminalMUX>true</TerminalMUX>
<TerminalThemeHelpers>true</TerminalThemeHelpers>
</PropertyGroup>
<Import Project="..\..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
<Import Project="$(OpenConsoleDir)src\common.nugetversions.props" />

View File

@@ -1,87 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "ConsoleInputReader.h"
#include "unicode.hpp"
ConsoleInputReader::ConsoleInputReader(HANDLE handle) :
_handle(handle)
{
_buffer.resize(BufferSize);
_convertedString.reserve(BufferSize);
}
void ConsoleInputReader::SetWindowSizeChangedCallback(std::function<void()> callback)
{
_windowSizeChangedCallback = std::move(callback);
}
std::optional<std::wstring_view> ConsoleInputReader::Read()
{
DWORD readCount{ 0 };
_convertedString.clear();
while (_convertedString.empty())
{
_buffer.resize(BufferSize);
auto succeeded =
ReadConsoleInputW(_handle, _buffer.data(), gsl::narrow_cast<DWORD>(_buffer.size()), &readCount);
if (!succeeded)
{
return std::nullopt;
}
_buffer.resize(readCount);
for (auto it = _buffer.begin(); it != _buffer.end(); ++it)
{
if (it->EventType == WINDOW_BUFFER_SIZE_EVENT && _windowSizeChangedCallback)
{
_windowSizeChangedCallback();
}
else if (it->EventType == KEY_EVENT)
{
const auto& keyEvent = it->Event.KeyEvent;
if (keyEvent.bKeyDown || (!keyEvent.bKeyDown && keyEvent.wVirtualKeyCode == VK_MENU))
{
// Got a high surrogate at the end of the buffer
if (IS_HIGH_SURROGATE(keyEvent.uChar.UnicodeChar))
{
_highSurrogate.emplace(keyEvent.uChar.UnicodeChar);
continue; // we've consumed it -- only dispatch it if we get a low
}
if (IS_LOW_SURROGATE(keyEvent.uChar.UnicodeChar))
{
// No matter what we do, we want to destructively consume the high surrogate
if (const auto oldHighSurrogate{ std::exchange(_highSurrogate, std::nullopt) })
{
_convertedString.push_back(*_highSurrogate);
}
else
{
// If we get a low without a high surrogate, we've done everything we can.
// This is an illegal state.
_convertedString.push_back(UNICODE_REPLACEMENT);
continue; // onto the next event
}
}
// (\0 with a scancode is probably a modifier key, not a VT input key)
if (keyEvent.uChar.UnicodeChar != L'\0' || keyEvent.wVirtualScanCode == 0)
{
if (_highSurrogate) // non-destructive: we don't want to set it to nullopt needlessly for every character
{
// If we get a high surrogate *here*, we didn't find a low surrogate.
// This state is also illegal.
_convertedString.push_back(UNICODE_REPLACEMENT);
_highSurrogate.reset();
}
_convertedString.push_back(keyEvent.uChar.UnicodeChar);
}
}
}
}
}
return _convertedString;
}

View File

@@ -1,33 +0,0 @@
/*++
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
Module Name:
ConsoleInputReader.h
Abstract:
This file contains a class whose sole purpose is to
abstract away a bunch of details you usually need to
know to read VT from a console input handle.
--*/
class ConsoleInputReader
{
public:
explicit ConsoleInputReader(HANDLE handle);
void SetWindowSizeChangedCallback(std::function<void()> callback);
std::optional<std::wstring_view> Read();
private:
static constexpr size_t BufferSize{ 128 };
HANDLE _handle;
std::wstring _convertedString;
std::vector<INPUT_RECORD> _buffer;
std::optional<wchar_t> _highSurrogate;
std::function<void()> _windowSizeChangedCallback;
};

View File

@@ -1,93 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{067F0A06-FCB7-472C-96E9-B03B54E8E18D}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>TerminalAzBridge</RootNamespace>
<ProjectName>TerminalAzBridge</ProjectName>
<TargetName>TerminalAzBridge</TargetName>
<ConfigurationType>Application</ConfigurationType>
<OpenConsoleUniversalApp>false</OpenConsoleUniversalApp>
<ApplicationType>Windows Store</ApplicationType>
<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
<VersionInfoFileDescription>Windows Terminal Azure Cloud Shell Connector</VersionInfoFileDescription>
</PropertyGroup>
<PropertyGroup Label="NuGet Dependencies">
<TerminalCppWinrt>true</TerminalCppWinrt>
</PropertyGroup>
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
<Import Project="$(OpenConsoleDir)src\common.nugetversions.props" />
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.pre.props" />
<PropertyGroup>
<GenerateManifest>true</GenerateManifest>
<EmbedManifest>true</EmbedManifest>
</PropertyGroup>
<!-- Source Files -->
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="ConsoleInputReader.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="main.cpp" />
<ClCompile Include="ConsoleInputReader.cpp" />
</ItemGroup>
<!-- Dependencies -->
<ItemGroup>
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalConnection\TerminalConnection.vcxproj">
<Project>{CA5CAD1A-C46D-4588-B1C0-40F31AE9100B}</Project>
</ProjectReference>
<ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj" />
</ItemGroup>
<!--
This ItemGroup and the Globals PropertyGroup below it are required in order
to enable F5 debugging for the unpackaged application
-->
<ItemGroup>
<PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\debugger_general.xml" />
<PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\debugger_local_windows.xml" />
</ItemGroup>
<PropertyGroup Label="Globals">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
<Import Project="$(OpenConsoleDir)src\common.nugetversions.targets" />
<!-- These have to come after post.props because the Cpp common targets will inexplicably overwrite them. -->
<ItemDefinitionGroup>
<ClCompile>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<!--
BODGY
The wapproj `GetResolvedWinMD` target tries to get a winmd from every cppwinrt
executable we put in the package. But we DON'T produce a winmd. This makes the
FastUpToDate check fail every time, and leads to the whole wapproj build
running even if you're just f5'ing the package. EVEN AFTER A SUCCESSFUL BUILD.
Setting GenerateWindowsMetadata=false is enough to tell the build system that
we don't produce one, and get it off our backs.
-->
<ItemDefinitionGroup>
<Link>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
</Link>
</ItemDefinitionGroup>
<Import Project="$(OpenConsoleDir)\build\rules\GenerateSxsManifestsFromWinmds.targets" />
</Project>

View File

@@ -1,108 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "winrt/Microsoft.Terminal.TerminalConnection.h"
#include "ConsoleInputReader.h"
using namespace winrt;
using namespace winrt::Windows::Foundation;
using namespace winrt::Microsoft::Terminal::TerminalConnection;
static til::size GetConsoleScreenSize(HANDLE outputHandle)
{
CONSOLE_SCREEN_BUFFER_INFOEX csbiex{};
csbiex.cbSize = sizeof(csbiex);
GetConsoleScreenBufferInfoEx(outputHandle, &csbiex);
return {
(csbiex.srWindow.Right - csbiex.srWindow.Left) + 1,
(csbiex.srWindow.Bottom - csbiex.srWindow.Top) + 1
};
}
static ConnectionState RunConnectionToCompletion(const ITerminalConnection& connection, HANDLE outputHandle, HANDLE inputHandle)
{
connection.TerminalOutput([outputHandle](const winrt::hstring& output) {
WriteConsoleW(outputHandle, output.data(), output.size(), nullptr, nullptr);
});
// Detach a thread to spin the console read indefinitely.
// This application exits when the connection is closed, so
// the connection's lifetime will outlast this thread.
std::thread([connection, outputHandle, inputHandle] {
ConsoleInputReader reader{ inputHandle };
reader.SetWindowSizeChangedCallback([&]() {
const auto size = GetConsoleScreenSize(outputHandle);
connection.Resize(size.height, size.width);
});
while (true)
{
auto input = reader.Read();
if (input)
{
connection.WriteInput(winrt_wstring_to_array_view(*input));
}
}
}).detach();
std::condition_variable stateChangeVar;
std::optional<ConnectionState> state;
std::mutex stateMutex;
connection.StateChanged([&](auto&& /*s*/, auto&& /*e*/) {
std::unique_lock<std::mutex> lg{ stateMutex };
state = connection.State();
stateChangeVar.notify_all();
});
connection.Start();
std::unique_lock<std::mutex> lg{ stateMutex };
stateChangeVar.wait(lg, [&]() {
if (!state.has_value())
{
return false;
}
return state.value() == ConnectionState::Closed || state.value() == ConnectionState::Failed;
});
return state.value();
}
int wmain(int /*argc*/, wchar_t** /*argv*/)
{
winrt::init_apartment(winrt::apartment_type::single_threaded);
DWORD inputMode{}, outputMode{};
auto conIn{ GetStdHandle(STD_INPUT_HANDLE) }, conOut{ GetStdHandle(STD_OUTPUT_HANDLE) };
auto codepage{ GetConsoleCP() }, outputCodepage{ GetConsoleOutputCP() };
RETURN_IF_WIN32_BOOL_FALSE(GetConsoleMode(conIn, &inputMode));
RETURN_IF_WIN32_BOOL_FALSE(GetConsoleMode(conOut, &outputMode));
RETURN_IF_WIN32_BOOL_FALSE(SetConsoleMode(conIn, ENABLE_WINDOW_INPUT | ENABLE_VIRTUAL_TERMINAL_INPUT));
RETURN_IF_WIN32_BOOL_FALSE(SetConsoleMode(conOut, ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_WRAP_AT_EOL_OUTPUT | DISABLE_NEWLINE_AUTO_RETURN));
RETURN_IF_WIN32_BOOL_FALSE(SetConsoleCP(CP_UTF8));
RETURN_IF_WIN32_BOOL_FALSE(SetConsoleOutputCP(CP_UTF8));
auto restoreConsoleModes = wil::scope_exit([&]() {
SetConsoleMode(conIn, inputMode);
SetConsoleMode(conOut, outputMode);
SetConsoleCP(codepage);
SetConsoleOutputCP(outputCodepage);
});
const auto size = GetConsoleScreenSize(conOut);
AzureConnection azureConn{};
winrt::Windows::Foundation::Collections::ValueSet vs{};
vs.Insert(L"initialRows", winrt::Windows::Foundation::PropertyValue::CreateUInt32(gsl::narrow_cast<uint32_t>(size.height)));
vs.Insert(L"initialCols", winrt::Windows::Foundation::PropertyValue::CreateUInt32(gsl::narrow_cast<uint32_t>(size.width)));
azureConn.Initialize(vs);
const auto state = RunConnectionToCompletion(azureConn, conOut, conIn);
return state == ConnectionState::Closed ? 0 : 1;
}

View File

@@ -1,4 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"

Some files were not shown because too many files have changed in this diff Show More