Compare commits

..

53 Commits

Author SHA1 Message Date
Lucas Trzesniewski
8214f66a61 Add safeUriSchemes setting (#20207)
This adds a `safeUriSchemes` global setting which lets you define
hyperlink URI schemes which the user considers safe. No confirmation
dialog will be shown when trying to open hyperlinks which use these
schemes.

- This solves the root issue, but doesn't introduce any UI or
  documentation changes. I wanted to validate the approach and
  implementation with you first.
- I closely followed the code handling the `disabledProfileSources`
  setting, which is of the same type.
- This feature does not change the behavior of `http`, `https` and
  `file` schemes.

Validation

I ran the dev terminal, and tested the behavior by clicking on `vscode`
hyperlinks generated by ripgrep with various `safeUriSchemes` settings:

- Setting not defined - asks for confirmation
- `["vscode"]` - does not ask for confirmation
- `["foo", "vscode"]` - does not ask for confirmation
- `["foo"]` - asks for confirmation
- `null` - asks for confirmation
- `[]` - asks for confirmation
- `[""]` - asks for confirmation
- `[{"foo": "bar"}]` - fails to deserialize (as expected)

A few uinit tests failed, but they seem unrelated to these changes:
- `KeyBindingTests` in `UnitTests_SettingsModel`, probably because I use
  an AZERTY keyboard.
- A few `Conhost` tests, but I didn't touch this part

Refs #20065
Closes #20191

(cherry picked from commit fb71a0462e)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgshlaI
Service-Version: 1.25
2026-05-12 16:40:01 -05:00
Dustin L. Howett
b0e4be7abd sixel: prevent allocating an absurd amount of memory or writing OOB (#20213)
This commit implements two fixes for the integer overflow/out-of-bounds
write reported in #20149.

First, it catches any exception generated in sixel char processing
(which will prevent `out_of_memory` or `bad_alloc` from being ignored
sight-unseen, and will prevent the consumption of further DCS content).

Second, it prevents us from allocating memory for an image which will
never be displayed (because it exceeds the height of the display.)

This supersedes prior work in #20153 for the same issues.

Closes #20149
Closes #20153

Co-authored-by: James Holderness <j4_james@hotmail.com>
(cherry picked from commit c829d4ca54)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgrY_zQ
Service-Version: 1.25
2026-05-12 11:22:29 -05:00
Dustin L. Howett
da1c5597cd Only set startingTitle once, clear up title fallback handling (#20214)
This commit ensures that we only set the starting title once when we
open a new terminal pane.

It also consolidates all title selection into Terminal::GetConsoleTitle,
which is now used in the TitleChanged event.

TitleChanged no longer stores a separate copy of the starting title if
an application attempts to _clear_ the title; that seems like a poorer
implementation of what we already had.

This supersedes work in #20204.

Closes #19340
Closes #20204

Co-authored-by: imsh <im.shaedar@gmail.com>
(cherry picked from commit b991eb048e)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgmWldU
Service-Version: 1.25
2026-05-12 11:22:28 -05:00
Dustin L. Howett
f49bcdd43a Reject DTTERM Window Manipulation resizes with the current size (#20183)
This may help #20182 and #20112
Closes #19310

(cherry picked from commit 3e3b3ad883)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgr3jGM
Service-Version: 1.25
2026-05-12 11:22:26 -05:00
nmurrell07
f4e232190d fix(resizePane): Mark as handled only when resize succeeds (#20001)
This fix addresses issue #19983 where resizePane actions unconditionally
consume keystrokes even when no resize can occur.

The fix follows the same pattern used for moveFocus and swapPane fixes:
- Changed Tab::ResizePane to return bool indicating success
- Changed TerminalPage::_ResizePane to return bool from ResizePane
- Updated _HandleResizePane to set args.Handled() based on whether
resize succeeded

This allows the keychord to propagate to the terminal when no resize can
occur, matching the behavior of moveFocus and swapPane (#6129).

Closes #19983

---------

Co-authored-by: nmurrell07 <nmurrell07@users.noreply.github.com>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
(cherry picked from commit dadde2fb11)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgr4epg
Service-Version: 1.25
2026-05-12 11:22:24 -05:00
Dustin L. Howett
dc2e98f576 Don't allow overflowing lengths in WM_COPYDATA (#20185)
It is possible to craft a packet whose `len` is `0x80000001`.

We should not produce values that do not fit in size_t (on e.g. x86).

Reject them summarily.

(cherry picked from commit 8edac5fb12)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgr4enI
Service-Version: 1.25
2026-05-12 11:22:22 -05:00
Dustin L. Howett
168dc99a6a appx: add appLicensing to Preview and Stable manifests (#20163)
This should prevent an outage like the one from #19764

(cherry picked from commit 84e807cbeb)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgrZtmo
Service-Version: 1.25
2026-04-29 19:47:37 -05:00
Carlos Zamora
e9f8ec877b Fix rounding error for word selection (#20084)
## Summary of the Pull Request
Dustin reported this bug to me. Thankfully it was an easy fix.

## References and Relevant Issues
Bug from implementing #5099

## Validation Steps Performed
Double-click ____ of right-most cell of a word selects the current word
 right-half
 left-half

(cherry picked from commit 115ec2cbb9)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgrZ8w4
Service-Version: 1.25
2026-04-29 19:47:35 -05:00
Windows Console Service Bot
021a571dfb Localization Updates - minor wording changes after spell check - 04/24/2026 03:05:26 (#20140)
Co-authored-by: Console Service Bot <consvc@microsoft.com>
(cherry picked from commit eeb9f7a805)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgrMdN4
Service-Version: 1.25
2026-04-29 19:47:34 -05:00
Leonard Hecker
ed6cb17ecb Improve TSF failure handling (#19965)
An internal AI correctly flagged that we aren't calling
`UnadviseSink()` in case a later `Initialize()` call fails.
We can easily fix this by calling `Uninitialize()`.

(cherry picked from commit 36fb444d3e)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgnOwCs
Service-Version: 1.25
2026-04-29 19:47:32 -05:00
jason
b2d88cbe42 Fix Korean IME overlay hiding characters to the right of cursor (#20041)
This commit fixes a regression in v1.24, where composing Korean text
in-between existing characters causes text to the right to be hidden.
This is problematic for the Korean IME, because it commonly inserts
the composed syllable between existing characters.

The fix compresses (removes/absorbs) available whitespace to the right
of the composition to make space for any existing text. This means
that a composition now virtually acts in insert mode.

Closes #20040
Refs #19738
Refs #20039

## Validation Steps Performed

1. Korean IME: compose `ㄷ` between `가` and `나` → display shows `가ㄷ나`,
`나` visible.
2. TUI box (vim prompt with padding): compose inside padded text box →
border preserved in place.
3. Composition at end of line (no chars to right): unaffected.
4. English and other IME input: not affected (no active composition
row).

Co-authored-by: jason <drvoss@users.noreply.github.com>
Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
(cherry picked from commit 7a83c0f167)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgo0JpY
Service-Version: 1.25
2026-04-17 14:34:50 -05:00
Windows Console Service Bot
fcc614e9f5 Localization Updates - URL dialog and PathTranslation - 04/11/2026 (#20096)
Co-authored-by: Console Service Bot <consvc@microsoft.com>
(cherry picked from commit 33a80191c1)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgqL9D0
Service-Version: 1.25
2026-04-17 14:34:48 -05:00
Dustin L. Howett
5af583ef5a Track the cursor dirty flag in the correct buffer (#20095)
Failure to do so will result in every console API requiring a cursor
update stalling for 500ms because we sent the update to the wrong
buffer.

Closes #20092

(cherry picked from commit 031998bfc3)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpcJzw
Service-Version: 1.25
2026-04-16 14:34:52 -05:00
Dustin L. Howett
82dfa63202 Path translation setting: use 🡒 instead of -> (#20088)
It looks better, as decided by committee.

(cherry picked from commit 41e08a68bd)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpVp68
Service-Version: 1.25
2026-04-16 14:34:50 -05:00
Dustin L. Howett
418401e1c2 Display a warning dialog for unsafe URLs (#20065)
We are getting a sufficient number of LLM-generated security reports
telling us that Ctrl+click and a tooltip are insufficient protection
from users clicking on links to dangerous things.

This commit displays a warning that prevents users from blindly clicking
on dangerous things.

Dangerous things include:
- any non-http and non-https and non-file URLs
- any file URLs that point to something understandable as a "program"
(so, something which resides in `PATHEXT`.)

In doing this, I learned that `til::ends_with_insensitive_ascii` was
broken.

I also learned that ContentDialogs summoned by any event handler out of
TermControl::Pointer* would lose focus immediately. It turns out that in
the absolute earliest days of Terminal, when we first created the
UserControl that became TermControl, we added our Tapped event handler.

It unconditionally focused the control.

Since `Tapped` is a higher-level event handler than `PointerPressed`, it
was firing after the gesture that opened the content dialog and stealing
focus back.

I'm fairly certain we don't need it.

Refs #7562

(cherry picked from commit 81170aff78)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpOYmc
Service-Version: 1.25
2026-04-16 14:34:48 -05:00
Dustin L. Howett
88a236c913 Revert "Implement OSC 7 for setting the CWD (#20019)" (#20116)
This reverts commit 7f5185eb06.

I have some new concerns about the fix in #20094, so I'm considering
reverting OSC 7 from 1.25.

Refs #20108
2026-04-15 16:10:40 -05:00
Ethan Balakumar
0252c78997 Terminal receives focus on drag n drop (#20003)
### Summary
Updates terminal to gain foreground focus when a user drags and drops a
file into the terminal.

### Changes
Updates the `DragDropHandler` to call `SetForegroundWindow`.

### Validation
* Built and deployed locally
* Manually verified terminal gains focus when dragging and dropping

Closes #19934

(cherry picked from commit a1a43a4ff5)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpBND8
Service-Version: 1.25
2026-04-02 19:21:54 -05:00
Theodore Tsirpanis
82d5e0cad3 Use vs-pwsh icons if applicable. (#19990)
## Summary of the Pull Request
This PR updates `VsDevShellGenerator` to use the `vs-pwsh` icon in
generated profiles, if modern PowerShell has been detected.

## References and Relevant Issues
The icons were added in #17706, but are not used anywhere.

## Detailed Description of the Pull Request / Additional comments
* Updated `VsDevShellGenerator::GetProfileCommandLine` to accept a
`bool& isPwsh` parameter, which is set to whether the generated profile
command line is using modern PowerShell. This value gets passed to
`VsDevShellGenerator::GetProfileIconPath`'s new parameter, which
determines whether to return the icon for `powershell` or `pwsh`.

(cherry picked from commit e0400150d0)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpBNIk
Service-Version: 1.25
2026-04-02 19:21:52 -05:00
Leonard Hecker
d960f4a05a Make disabling the Kitty Keyboard Protocol possible (#19995)
Avoid translating W32IM sequences to KKP.

Closes #19977

## Validation Steps Performed
* Use French Bepo keyboard layout
* Disable KKP
* Use fish shell
* `AltGr+Y` produces `{` 

(cherry picked from commit 0f5d883c59)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpBMwc
Service-Version: 1.25
2026-04-02 19:21:51 -05:00
Dustin L. Howett
2c9277cbb4 Only honor Ctrl+Z during ReadFile if the console is in PROCESSED mode (#19940)
This restores the behavior of ReadFile to that of Windows 7.

Closes #4958

(cherry picked from commit 80e4b3c947)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpBM28
Service-Version: 1.25
2026-04-02 19:21:49 -05:00
Carlos Zamora
e382d328b2 Improve UX for selection during VTMM (#19973)
Selection in VT mouse mode has been feeling a little weird. I've made a
few changes in this space to improve the overall experience when in vt
mouse mode:
- don't round selection positions: this means that you now highlight the
cell you're on if you're going right, and the adjacent cell if you're
going left
- fix drag-left excluding the current cell
- #9608: shift+click now clears any existing selection instead of
extending it. This feels more intuitive since Shift already works as the
override modifier

Somewhat related to #18106

## Validation
 alt selections feel consistent
 selecting in VTMM feels accurate (selects the cell we started on)
 creating new selections (aka clearing old selection) in VTMM feels
intuitive (forwards and backwards)

Closes #9608

(cherry picked from commit 2e33056fd8)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgna3V8
Service-Version: 1.25
2026-04-02 19:14:34 -05:00
Carlos Zamora
2bd369939c 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_lADOAF3p4s4BQX0-zgpBL5s
Service-Version: 1.25
2026-04-02 19:14:13 -05:00
Leonard Hecker
7f5185eb06 Implement OSC 7 for setting the CWD (#20019)
This adds support for OSC 7 which is the same as OSC 9;9 but using
file URIs. As per the previous discussion in #8214, the problem is
that WSL shells emit URIs that can't work because the hostname in
the URI translates to an UNC path with an non-existing hostname.
In my opinion this doesn't deter the fact though that OSC 7 works
just fine for a native Windows application.

In the future we should consider trying to detect WSL file URIs
and translating it to the `--cd` argument for `wsl.exe`.

All of the heavy lifting for parsing the URI is done by
`PathCreateFromUrlW`. It just had to be plugged into the OSC 9;9 code.

Closes #3158

## Validation Steps Performed
* Launch fish-shell in WSL
* Duplicate tab works 
* (And because it doesn't work without using
  `IsValidDirectory` I know that OSC 7 works )

(cherry picked from commit 4ce79d7289)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpBLe8
Service-Version: 1.25
2026-04-02 19:14:12 -05:00
Leonard Hecker
0291d97503 Send a CPR request on every unknown sequence (#20009)
This PR is 90% wiring up OOP interfaces.

Closes #19926

## Validation Steps Performed
* Run `github.com/xtermjs/vtc`
* Observed `UnknownSequence` calls under a debugger

(cherry picked from commit da0446a7d1)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgpBLzY
Service-Version: 1.25
2026-04-02 19:14:10 -05:00
Carlos Zamora
f7a5515cf7 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_lADOAF3p4s4BQX0-zgo0IB8
Service-Version: 1.25
2026-03-31 18:19:19 -05:00
Carlos Zamora
2219739391 Fix search dropdown theming (#19987)
## Summary of the Pull Request
Popups are in their own separate tree, so we had to find it and set the
theme ourselves.

## Validation Steps Performed
Prereq: Windows theme = light + terminal theme = dark
 settings search dropdown is dark theme

Closes #19927

(cherry picked from commit c562dad15d)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgnsPtk
Service-Version: 1.25
2026-03-31 18:19:17 -05:00
jason
7cff119b34 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_lADOAF3p4s4BQX0-zgo0JpM
Service-Version: 1.25
2026-03-31 17:44:28 -05:00
Dustin L. Howett
58414c542f conpty: remove accidental bool; use BOOL instead (#20035)
Closes #19102

(cherry picked from commit 01f8a4031d)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgoyJIE
Service-Version: 1.25
2026-03-31 17:44:26 -05:00
Dustin L. Howett
bf77086b60 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_lADOAF3p4s4BQX0-zgotgA4
Service-Version: 1.25
2026-03-31 17:44:25 -05:00
gcrtnst
2644ca0a8a 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_lADOAF3p4s4BQX0-zgotQIk
Service-Version: 1.25
2026-03-30 17:46:06 -05:00
Sagar
1ad9a2e932 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_lADOAF3p4s4BQX0-zgn30Ls
Service-Version: 1.25
2026-03-30 17:46:05 -05:00
Leonard Hecker
74f3bb42e1 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_lADOAF3p4s4BQX0-zgn2sRU
Service-Version: 1.25
2026-03-30 17:46:03 -05:00
Carlos Zamora
c0ca78c3ee 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_lADOAF3p4s4BQX0-zgna-WM
Service-Version: 1.25
2026-03-30 17:46:02 -05:00
Dustin L. Howett
37dc437e65 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_lADOAF3p4s4BQX0-zgnTk_s
Service-Version: 1.25
2026-03-12 17:14:58 -05:00
Artem Lytkin
4a782b062c 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_lADOAF3p4s4BQX0-zgnOgZ8
Service-Version: 1.25
2026-03-12 17:14:56 -05:00
Carlos Zamora
4701843082 Fix memory leaks with UIA (#19950)
## Summary of the Pull Request
This includes the memory leak fixes that @lhecker and I investigated as
a part of #19710.

The `ITextRangeProvider`s (namely `UiaTextRange`s) weren't being
destroyed after they were done being used by the screen reader.

## Validation Steps Performed
In my own testing, I set a breakpoint on the destructor for
`UiaTextRangeBase`. Prior to this change, that destructor would mainly
be called when the terminal control was closed, which would result in us
leaking these objects. With this change, I've confirmed that these text
ranges are being destroyed immediately after they are done being used
(without needing to close the terminal control).

## PR Checklist
Closes #19710

(cherry picked from commit e2110e716c)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgnOhC8
Service-Version: 1.25
2026-03-12 17:14:55 -05:00
Leonard Hecker
efe9f27c00 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_lADOAF3p4s4BQX0-zgnOg_4
Service-Version: 1.25
2026-03-12 17:14:53 -05:00
sagarbhure-dev
008e293205 Fix GenerateSettingsIndex using element name instead of x:Name (#19945)
Use GetAttribute('x:Name') instead of .Name in GenerateSettingsIndex.ps1
to avoid PowerShell's XML integration returning the element tag name
(e.g. 'local:SettingContainer') when x:Name is absent.

Also add missing x:Name attributes to:
- Compatibility.xaml: AmbiguousWidth SettingContainer
- NewTabMenu.xaml: AddRemainingProfiles and CurrentFolderIcon containers

## Summary of the Pull Request
Fix GenerateSettingsIndex.ps1 emitting "local:SettingContainer" as the
element name in the generated index when a SettingContainer has no
x:Name attribute.

## References and Relevant Issues
Per DHowett's comment - the root cause is PowerShell's XML integration:
$element.Name returns the XML element tag name (e.g.
local:SettingContainer) when no x:Name attribute exists.

## Detailed Description of the Pull Request / Additional comments
Two changes:

- GenerateSettingsIndex.ps1: Replace $settingContainer.Name with
$settingContainer.GetAttribute("x:Name"), which correctly returns an
empty string when the attribute is absent instead of the element tag
name.

- Add missing x:Name attributes to three SettingContainer elements:
    - Compatibility.xaml: AmbiguousWidth (Globals_AmbiguousWidth)
- NewTabMenu.xaml: AddRemainingProfiles
(NewTabMenu_AddRemainingProfiles)
    - NewTabMenu.xaml: CurrentFolderIcon (NewTabMenu_CurrentFolderIcon)
- This fixes four incorrect IndexEntry lines in the generated output
that previously contained L"local:SettingContainer" as the element name.

## Validation Steps Performed
Ran GenerateSettingsIndex.ps1 before and after - confirmed the four
incorrect entries with L"local:SettingContainer" are now generated with
the correct x:Name values (or empty string where appropriate).

## PR Checklist
Closes #19929

Co-authored-by: Sagar Bhure <sagarbhure@microsoft.com>
(cherry picked from commit 8cad67020f)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgnOg9Q
Service-Version: 1.25
2026-03-12 17:14:51 -05:00
Dustin L. Howett
7adb2157a5 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_lADOAF3p4s4BQX0-zgms2-E
Service-Version: 1.25
2026-03-12 17:14:50 -05:00
Dustin L. Howett
9ae724aa5b build: make sure the AnyCPU build sets BuildPlatform properly (#19925)
This caused the WPF-only build (packaging phase, really) to fail.

Fixes d6714f3ca9 (#19328)

(cherry picked from commit 0f6ee4ad2e)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgmftD0
Service-Version: 1.25
2026-03-02 14:45:41 -06:00
Windows Console Service Bot
d6da2555f5 Localization Updates - main - 03/02/2026 (#19914)
Co-authored-by: Console Service Bot <consvc@microsoft.com>
(cherry picked from commit 59c7e3b73c)
Service-Card-Id: PVTI_lADOAF3p4s4BQX0-zgmfcKA
Service-Version: 1.25
2026-03-02 14:45:40 -06:00
Dustin L. Howett
f740350283 build: reset version year so 1.25 preview starts over from 2026 2026-02-27 17:48:25 -06:00
Dustin L. Howett
62512eb116 pgo: train 1.25 separately 2026-02-27 17:48:09 -06:00
PankajBhojwani
b6f041c4a4 Update command list when a command is added or a name is changed (#19771)
When a new command is added or an existing command's name is changed,
make sure we update the top-level command list so that it appears there
when the user navigates back to the actions page

## Detailed Description of the Pull Request / Additional comments
Added a new `_CommandListDirty` flag to the `ActionsViewModel`. When a
new command is added or a command's name is changed the flag is set.
When navigating to the top-level actions page, we regenerate the
`_CommandList` if the flag is set.

## Validation Steps Performed
Adding a new command or updating a command's name is now reflected
correctly when navigating back to the actions page.
2026-02-27 22:59:30 +00:00
Divyaranjan Sahoo
1414abc843 Gate OSC clipboard writes on focus to prevent clipboard hijacking (#19357)
This only gates VT-driven clipboard writes (OSC 52), not
user-initiated copy.

Closes #19051

Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
2026-02-27 22:19:51 +00:00
YAMAGUCHI, Rei
3b8c5606ee Add configurable ambiguous-width policy (narrow/wide) (#19864)
This PR introduces `compatibility.ambiguousWidth` as a **global**
compatibility setting (`narrow` default, `wide` optional).

The default remains `narrow`.

Why global-only in this PR:
- Width detection is currently process-wide (`CodepointWidthDetector`
  singleton).
- True profile-level ambiguous-width behavior would require broader
  architectural changes and is intentionally deferred to a follow-up
  design/PR.

What this PR guarantees:
- Terminal-side handling is consistent end-to-end for the selected
  ambiguous-width policy (rendering path + ConPTY/host propagation).

Known limitation:
- Some client applications (for example PSReadLine/readline-based apps)
  may still compute character widths independently.
- In such cases, cursor movement or Backspace behavior can differ from
  visual cell width even when terminal-side policy is consistent.

This is a compatibility/readability trade-off feature:
- `narrow`: prioritize cross-application compatibility.
- `wide`: prioritize readability with many CJK fonts.

Closes #153
Closes #370
Refs #2928
Refs #2049, #2066, #2375, #900, #5910, #5914

Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
2026-02-27 19:54:56 +00:00
Carlos Zamora
3918332853 Fix detecting partially visible URLs (#19878)
## Summary of the Pull Request
Fixes a bug where a partially visible URL would not be detected. This is
fixed by expanding the search space by 1 viewport height in both
directions.

The `_patternIntervalTree` now operates in the absolute-buffer space as
opposed to the viewport-relative space. It's a bit of an annoying
change, but the alternative would be to keep track of the offset used by
the method above, which I find more annoying, personally. As a part of
this change, I made it a bit more clear when something is
viewport-relative vs buffer-absolute.

Regarding mark mode hyperlink navigation, now that everything is in the
absolute-buffer space, I'm able to fix some of the issues in #13854. I
removed `_selectionIsTargetingUrl` and fixed/validated navigating to
hyperlinks that are partially visible.

## Validation Steps Performed
Detects URL that is...
 fully visible
 partially cropped off the top
 partially cropped off the bottom

 Above scenarios work with mark mode hyperlink navigation

Tests added

Closes #18177
Closes #13854
2026-02-27 11:13:07 -08:00
Abhishek Giri
28c98c5dc1 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>
2026-02-27 10:57:13 -08:00
Dustin L. Howett
854079e284 atlas: display underlines in the right color when they're highlighted (#19872)
This pull request resolves a longstanding issue (which probably nobody
but me cared about :P) where gridlines and underlines did not change
color to match the selection or search highlight foreground.

During brush preparation, we stash the underline color; during line
rendering we store it in a third bitmap and during rendering in each
backend we read the colors out of the appropriate bitmap.

The gridlines come from the foreground bitmap and the underlines from
the new underline bitmap.

I've updated each instance of append*Line to break the line-to-render up
by color span.

We are, therefore, no longer passing the stroke color in each gridline
payload.

The original console renderer supports painting the gridlines in
different colors for each half of a 2-cell glyph. That functionality no
longer works in Atlas. To fix it, we would need to move underline _span_
preparation into PaintBufferLine (so that we could apply the right
colors to the bitmap mid-cell.)

Known Issues
------------

- D2D only; dotted lines which are broken by a highlight have doubled
  dots (because we draw them as individual line segments and without a
  global geometry like curly lines.)
- Atlas (all); grid line colors can no longer change in the middle of
  a 2-cell glyph.

Tested By
---------

RenderingTests
2026-02-27 10:35:17 -06:00
Carlos Zamora
e05a5fb6d8 Fix spellcheck for GenerateSettingsIndex.ps1 (#19911)
"to for" is a forbidden pattern. Add in a comma to appease the spell
checker.
2026-02-26 19:35:04 -06:00
Carlos Zamora
fbd48e7463 Polish GenerateSettingsIndex.ps1 and propagate changes (#19907)
## Summary of the Pull Request
Cleans up GenerateSettingsIndex.ps1 by addressing the feedback Dustin
left in #19519

## Validation Steps Performed
 SUI search works
2026-02-26 22:54:07 +00:00
PankajBhojwani
ab4000ca9a Remove the suggestion chosen handler from EditAction's ShortcutActionBox (#19906)
## Summary of the Pull Request
There is an issue where clicking an item (with the mouse) from the auto
suggest box's dropdown would fail on the first try, but the dropdown
gets reopened automatically and clicking an item after that works. This
is because `AutoSuggestBox` has `UpdateTextOnSelect` defaulted to
`True`, but we also have a `SuggestionChosen` handler that effectively
does the same thing, and the two were conflicting. This commit fixes
that by removing our `SuggestionChosen` handler.

## Verification steps performed
Selecting an item from the dropdown with mouse works on first try.
Keyboard flow continues to work as expected.
2026-02-25 15:11:25 -08:00
Carlos Zamora
b4259e61a5 Refactor SUI navigation (#19889)
## Summary of the Pull Request
Consolidates the navigation functions in `MainPage` for the settings UI.
This involved:
- combining all separate `_Navigate()` functions into one big one
- deduplicating `SettingsNav().SelectedItem()` calls
- removing the unnecessary variable for a crumb (just inline creation
and registration)
- removing the `elementToFocus` staging behavior for color schemes and
profile sub pages

## References and Relevant Issues
Builds off the work done in #19519 and #19831

## Validation Steps Performed
Navigate to...
 simple top-level pages: Startup, Interaction, Appearance, Rendering,
Compatibility, Add profile
 Color schemes and subpages
 Actions, subpages
 New Tab Menu and folder subpages
 Extensions, subpages, and profile/scheme navigation
 defaults profile and subpages
 specific profile and subpages

Also tested discarding changes on these pages.

 search still works and navigates to the correct element

## PR Checklist
Closes #19866
2026-02-25 13:33:34 -08:00
212 changed files with 2975 additions and 3961 deletions

View File

@@ -67,6 +67,7 @@ servicebus
slnt
stakeholders
subpage
subpages
sustainability
sxn
Tencent

View File

@@ -572,6 +572,7 @@ FGHIJ
fgidx
FGs
FILEDESCRIPTION
filehops
FILESUBTYPE
FILESYSPATH
FILEW
@@ -1772,6 +1773,7 @@ uldash
uldb
ULONGLONG
ulwave
Unaccess
Unadvise
unattend
UNCPRIORITY

View File

@@ -56,11 +56,12 @@
<ReleaseNotes>
Vėѓѕіöй __VERSION_NUMBER__ !!! !!! !
- Ą ωћόĺé ņέш ∑×τзńşĩōиŝ ρâģε τђат šнòωş ωħąт нǻś ъеēñ įηšтǻľĺéδ ĭʼnтο ўбμŗ Ţзřmĭňāŀ !!! !!! !!! !!! !!! !!! !!! !!!
- €όммаήδ Рдĺēтţĕ пŏẅ şĥŏшś üρ ϊñ ỳоũѓ йαťïνє ļäŋģµаġέ άś ŵєŀľ åś Σиĝℓĭŝђ !!! !!! !!! !!! !!! !!! !!!
- ∏еẅ VΤ ƒэåŧύґέŝ şűçн ăŝ ѕỳňсĥŗǿйìźėð гēŋďзříⁿğ, ηĕш ćôĺõг şĉћěмєѕ, çóńƒіĝџŗáτїöπ ƒοг qũī¢ķ möűšë ąćŧϊόņŝ ľîķє žøōmίйğ, ǻⁿđ мόřε !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
- ₣ïňάĺĺў, ŧне âъΐŀίťŷ ţø şēаґсђ ƒбг ăиÿ şēťτіήġ! !!! !!! !!! !!! !!!
- Á ŋеώ ñăŧїνе ěðíτōг ƒοѓ ќэÿ вїñďĭňğş, дčтιθήѕ дñð çθmmãήδ ρàľěţťę ёñтгĩέś. !!! !!! !!! !!! !!! !!! !!! !
- Пėώ čоmmμñìтў ŀό¢àłįżåţίòйš ŧō Šэґъιäñ åηδ Ůκŗăįлīăπ !!! !!! !!! !!! !!! !
- Ѕυррòŗт ƒòŗ ťĥё "Kitty" ĸ℮ŷъøàŗď ρřŏťô¢õℓ ƒŏґ нįģћ-ƒíđёℓïтÿ îńрüť êńсøďíлğ !!! !!! !!! !!! !!! !!! !!! !
Ρĺęąŝэ ѕєě õμя ĞĭтΗύв řєĺэдšέŝ рάġě ƒοґ àďđϊтїõлаℓ ðêţǻїłş. !!! !!! !!! !!! !!! !!!
Ρŀ℮âѕē şєё όûя ĜîтΗūь ŕεĺĕǻŝёš раġĕ ƒŏґ ãδđϊŧïбπåľ δеτáΐłś. !!! !!! !!! !!! !!! !!!
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -56,11 +56,12 @@
<ReleaseNotes>
Vėѓѕіöй __VERSION_NUMBER__ !!! !!! !
- Ą ωћόĺé ņέш ∑×τзńşĩōиŝ ρâģε τђат šнòωş ωħąт нǻś ъеēñ įηšтǻľĺéδ ĭʼnтο ўбμŗ Ţзřmĭňāŀ !!! !!! !!! !!! !!! !!! !!! !!!
- €όммаήδ Рдĺēтţĕ пŏẅ şĥŏшś üρ ϊñ ỳоũѓ йαťïνє ļäŋģµаġέ άś ŵєŀľ åś Σиĝℓĭŝђ !!! !!! !!! !!! !!! !!! !!!
- ∏еẅ VΤ ƒэåŧύґέŝ şűçн ăŝ ѕỳňсĥŗǿйìźėð гēŋďзříⁿğ, ηĕш ćôĺõг şĉћěмєѕ, çóńƒіĝџŗáτїöπ ƒοг qũī¢ķ möűšë ąćŧϊόņŝ ľîķє žøōmίйğ, ǻⁿđ мόřε !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
- ₣ïňάĺĺў, ŧне âъΐŀίťŷ ţø şēаґсђ ƒбг ăиÿ şēťτіήġ! !!! !!! !!! !!! !!!
- Á ŋеώ ñăŧїνе ěðíτōг ƒοѓ ќэÿ вїñďĭňğş, дčтιθήѕ дñð çθmmãήδ ρàľěţťę ёñтгĩέś. !!! !!! !!! !!! !!! !!! !!! !
- Пėώ čоmmμñìтў ŀό¢àłįżåţίòйš ŧō Šэґъιäñ åηδ Ůκŗăįлīăπ !!! !!! !!! !!! !!! !
- Ѕυррòŗт ƒòŗ ťĥё "Kitty" ĸ℮ŷъøàŗď ρřŏťô¢õℓ ƒŏґ нįģћ-ƒíđёℓïтÿ îńрüť êńсøďíлğ !!! !!! !!! !!! !!! !!! !!! !
Ρĺęąŝэ ѕєě õμя ĞĭтΗύв řєĺэдšέŝ рάġě ƒοґ àďđϊтїõлаℓ ðêţǻїłş. !!! !!! !!! !!! !!! !!!
Ρŀ℮âѕē şєё όûя ĜîтΗūь ŕεĺĕǻŝёš раġĕ ƒŏґ ãδđϊŧïбπåľ δеτáΐłś. !!! !!! !!! !!! !!! !!!
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -56,11 +56,12 @@
<ReleaseNotes>
Vėѓѕіöй __VERSION_NUMBER__ !!! !!! !
- Ą ωћόĺé ņέш ∑×τзńşĩōиŝ ρâģε τђат šнòωş ωħąт нǻś ъеēñ įηšтǻľĺéδ ĭʼnтο ўбμŗ Ţзřmĭňāŀ !!! !!! !!! !!! !!! !!! !!! !!!
- €όммаήδ Рдĺēтţĕ пŏẅ şĥŏшś üρ ϊñ ỳоũѓ йαťïνє ļäŋģµаġέ άś ŵєŀľ åś Σиĝℓĭŝђ !!! !!! !!! !!! !!! !!! !!!
- ∏еẅ VΤ ƒэåŧύґέŝ şűçн ăŝ ѕỳňсĥŗǿйìźėð гēŋďзříⁿğ, ηĕш ćôĺõг şĉћěмєѕ, çóńƒіĝџŗáτїöπ ƒοг qũī¢ķ möűšë ąćŧϊόņŝ ľîķє žøōmίйğ, ǻⁿđ мόřε !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
- ₣ïňάĺĺў, ŧне âъΐŀίťŷ ţø şēаґсђ ƒбг ăиÿ şēťτіήġ! !!! !!! !!! !!! !!!
- Á ŋеώ ñăŧїνе ěðíτōг ƒοѓ ќэÿ вїñďĭňğş, дčтιθήѕ дñð çθmmãήδ ρàľěţťę ёñтгĩέś. !!! !!! !!! !!! !!! !!! !!! !
- Пėώ čоmmμñìтў ŀό¢àłįżåţίòйš ŧō Šэґъιäñ åηδ Ůκŗăįлīăπ !!! !!! !!! !!! !!! !
- Ѕυррòŗт ƒòŗ ťĥё "Kitty" ĸ℮ŷъøàŗď ρřŏťô¢õℓ ƒŏґ нįģћ-ƒíđёℓïтÿ îńрüť êńсøďíлğ !!! !!! !!! !!! !!! !!! !!! !
Ρĺęąŝэ ѕєě õμя ĞĭтΗύв řєĺэдšέŝ рάġě ƒοґ àďđϊтїõлаℓ ðêţǻїłş. !!! !!! !!! !!! !!! !!!
Ρŀ℮âѕē şєё όûя ĜîтΗūь ŕεĺĕǻŝёš раġĕ ƒŏґ ãδđϊŧïбπåľ δеτáΐłś. !!! !!! !!! !!! !!! !!!
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -56,11 +56,11 @@
<ReleaseNotes>
Vėѓѕіöй __VERSION_NUMBER__ !!! !!! !
- Ẁē'νё àðđέď đöžзńş öƒ śėŧťїńģš тб тнè ÛĮ ťħąт ŏņ¢з όⁿℓγ έжіѕŧéð іή тђε ЈŠΩŃ ƒїℓė, ĭňĉŀџđіņģ å ňэẅ φâģé ƒøя ςŭśŧŏmïżϊñģ тħέ ĺαŷöυτ öƒ убµř Йέẁ Ţàъ мęήµ! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
- Ẁè ĥаνė řэąřčħΐŧέсτέð щįлďοш мǻňαĝēмêиť ťô ϊmрябνé ŗĕŀĩāвîĺïтγ; ρŀěăѕе ƒíŀё αⁿу вûġš ÿøú εʼnćōùлťēѓ ẃïτħ ŧћё wt.exe ǻļĭâś !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
- Рґøƒíŀêŝ ňöẁ šћθẁ ãй ĭčöñ ίƒ ŧħэŷ'νę ъеєл ђіðδэñ őř řєƒěґ ŧσ φяοġгаmŝ ẅђíçĥ ẁ℮гέ џňϊйşťàľĺèð. !!! !!! !!! !!! !!! !!! !!! !!! !!! !
- Ą ωћόĺé ņέш ∑×τзńşĩōиŝ ρâģε τђат šнòωş ωħąт нǻś ъеēñ įηšтǻľĺéδ ĭʼnтο ўбμŗ Ţзřmĭňāŀ !!! !!! !!! !!! !!! !!! !!! !!!
- €όммаήδ Рдĺēтţĕ пŏẅ şĥŏшś üρ ϊñ ỳоũѓ йαťïνє ļäŋģµаġέ άś ŵєŀľ åś Σиĝℓĭŝђ !!! !!! !!! !!! !!! !!! !!!
- ∏еẅ VΤ ƒэåŧύґέŝ şűçн ăŝ ѕỳňсĥŗǿйìźėð гēŋďзříⁿğ, ηĕш ćôĺõг şĉћěмєѕ, çóńƒіĝџŗáτїöπ ƒοг qũī¢ķ möűšë ąćŧϊόņŝ ľîķє žøōmίйğ, ǻⁿđ мόřε !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
Рļèāŝє ŝèĕ θџŗ ĢίťĤцъ řέĺэªşэš ρąĝę ƒόř áďđїτϊōπαľ đэŧдįļŝ. !!! !!! !!! !!! !!! !!!
Ρĺęąŝэ ѕєě õμя ĞĭтΗύв řєĺэдšέŝ рάġě ƒοґ àďđϊтїõлаℓ ðêţǻїłş. !!! !!! !!! !!! !!! !!!
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -56,11 +56,11 @@
<ReleaseNotes>
Vėѓѕіöй __VERSION_NUMBER__ !!! !!! !
- Ẁē'νё àðđέď đöžзńş öƒ śėŧťїńģš тб тнè ÛĮ ťħąт ŏņ¢з όⁿℓγ έжіѕŧéð іή тђε ЈŠΩŃ ƒїℓė, ĭňĉŀџđіņģ å ňэẅ φâģé ƒøя ςŭśŧŏmïżϊñģ тħέ ĺαŷöυτ öƒ убµř Йέẁ Ţàъ мęήµ! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
- Ẁè ĥаνė řэąřčħΐŧέсτέð щįлďοш мǻňαĝēмêиť ťô ϊmрябνé ŗĕŀĩāвîĺïтγ; ρŀěăѕе ƒíŀё αⁿу вûġš ÿøú εʼnćōùлťēѓ ẃïτħ ŧћё wt.exe ǻļĭâś !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
- Рґøƒíŀêŝ ňöẁ šћθẁ ãй ĭčöñ ίƒ ŧħэŷ'νę ъеєл ђіðδэñ őř řєƒěґ ŧσ φяοġгаmŝ ẅђíçĥ ẁ℮гέ џňϊйşťàľĺèð. !!! !!! !!! !!! !!! !!! !!! !!! !!! !
- Ą ωћόĺé ņέш ∑×τзńşĩōиŝ ρâģε τђат šнòωş ωħąт нǻś ъеēñ įηšтǻľĺéδ ĭʼnтο ўбμŗ Ţзřmĭňāŀ !!! !!! !!! !!! !!! !!! !!! !!!
- €όммаήδ Рдĺēтţĕ пŏẅ şĥŏшś üρ ϊñ ỳоũѓ йαťïνє ļäŋģµаġέ άś ŵєŀľ åś Σиĝℓĭŝђ !!! !!! !!! !!! !!! !!! !!!
- ∏еẅ VΤ ƒэåŧύґέŝ şűçн ăŝ ѕỳňсĥŗǿйìźėð гēŋďзříⁿğ, ηĕш ćôĺõг şĉћěмєѕ, çóńƒіĝџŗáτїöπ ƒοг qũī¢ķ möűšë ąćŧϊόņŝ ľîķє žøōmίйğ, ǻⁿđ мόřε !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
Рļèāŝє ŝèĕ θџŗ ĢίťĤцъ řέĺэªşэš ρąĝę ƒόř áďđїτϊōπαľ đэŧдįļŝ. !!! !!! !!! !!! !!! !!!
Ρĺęąŝэ ѕєě õμя ĞĭтΗύв řєĺэдšέŝ рάġě ƒοґ àďđϊтїõлаℓ ðêţǻїłş. !!! !!! !!! !!! !!! !!!
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -56,11 +56,11 @@
<ReleaseNotes>
Vėѓѕіöй __VERSION_NUMBER__ !!! !!! !
- Ẁē'νё àðđέď đöžзńş öƒ śėŧťїńģš тб тнè ÛĮ ťħąт ŏņ¢з όⁿℓγ έжіѕŧéð іή тђε ЈŠΩŃ ƒїℓė, ĭňĉŀџđіņģ å ňэẅ φâģé ƒøя ςŭśŧŏmïżϊñģ тħέ ĺαŷöυτ öƒ убµř Йέẁ Ţàъ мęήµ! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
- Ẁè ĥаνė řэąřčħΐŧέсτέð щįлďοш мǻňαĝēмêиť ťô ϊmрябνé ŗĕŀĩāвîĺïтγ; ρŀěăѕе ƒíŀё αⁿу вûġš ÿøú εʼnćōùлťēѓ ẃïτħ ŧћё wt.exe ǻļĭâś !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
- Рґøƒíŀêŝ ňöẁ šћθẁ ãй ĭčöñ ίƒ ŧħэŷ'νę ъеєл ђіðδэñ őř řєƒěґ ŧσ φяοġгаmŝ ẅђíçĥ ẁ℮гέ џňϊйşťàľĺèð. !!! !!! !!! !!! !!! !!! !!! !!! !!! !
- Ą ωћόĺé ņέш ∑×τзńşĩōиŝ ρâģε τђат šнòωş ωħąт нǻś ъеēñ įηšтǻľĺéδ ĭʼnтο ўбμŗ Ţзřmĭňāŀ !!! !!! !!! !!! !!! !!! !!! !!!
- €όммаήδ Рдĺēтţĕ пŏẅ şĥŏшś üρ ϊñ ỳоũѓ йαťïνє ļäŋģµаġέ άś ŵєŀľ åś Σиĝℓĭŝђ !!! !!! !!! !!! !!! !!! !!!
- ∏еẅ VΤ ƒэåŧύґέŝ şűçн ăŝ ѕỳňсĥŗǿйìźėð гēŋďзříⁿğ, ηĕш ćôĺõг şĉћěмєѕ, çóńƒіĝџŗáτїöπ ƒοг qũī¢ķ möűšë ąćŧϊόņŝ ľîķє žøōmίйğ, ǻⁿđ мόřε !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!
Рļèāŝє ŝèĕ θџŗ ĢίťĤцъ řέĺэªşэš ρąĝę ƒόř áďđїτϊōπαľ đэŧдįļŝ. !!! !!! !!! !!! !!! !!!
Ρĺęąŝэ ѕєě õμя ĞĭтΗύв řєĺэдšέŝ рάġě ƒοґ àďđϊтїõлаℓ ðêţǻїłş. !!! !!! !!! !!! !!! !!!
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

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.25</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

@@ -46,6 +46,7 @@ jobs:
BuildConfiguration: ${{ config }}
dependsOn: ${{ parameters.dependsOn }}
variables:
BuildPlatform: Any CPU
OutputBuildPlatform: AnyCPU
Terminal.BinDir: $(Build.SourcesDirectory)/bin/$(OutputBuildPlatform)/$(BuildConfiguration)
JobOutputDirectory: $(Build.ArtifactStagingDirectory)\nupkg

View File

@@ -211,7 +211,7 @@ extends:
ob_createvpack_verbose: true
ob_createvpack_vpackdirectory: '$(JobOutputDirectory)\vpack'
ob_createvpack_versionAs: string
ob_createvpack_version: '$(XES_APPXMANIFESTVERSION)'
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'

View File

@@ -3,7 +3,7 @@
<!-- This file is read by XES, which we use in our Release builds. -->
<PropertyGroup Label="Version">
<XesUseOneStoreVersioning>true</XesUseOneStoreVersioning>
<XesBaseYearForStoreVersion>2025</XesBaseYearForStoreVersion>
<XesBaseYearForStoreVersion>2026</XesBaseYearForStoreVersion>
<VersionMajor>1</VersionMajor>
<VersionMinor>25</VersionMinor>
<VersionInfoProductName>Windows Terminal</VersionInfoProductName>

View File

@@ -2407,6 +2407,14 @@
"console"
]
},
"compatibility.ambiguousWidth": {
"default": "narrow",
"description": "Controls the cell width of East Asian Ambiguous characters.",
"enum": [
"narrow",
"wide"
]
},
"copyFormatting": {
"default": true,
"description": "When set to `true`, the color and font formatting of selected text is also copied to your clipboard. When set to `false`, only plain text is copied to your clipboard. An array of specific formats can also be used. Supported array values include `html` and `rtf`. Plain text is always copied.",
@@ -2462,6 +2470,13 @@
},
"type": "array"
},
"safeUriSchemes": {
"description": "Specifies a list of URI schemes that are considered safe. No confirmation will be required to open URIs with these schemes.",
"items": {
"type": "string"
},
"type": "array"
},
"rendering.graphicsAPI": {
"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",

View File

@@ -1143,6 +1143,13 @@ til::CoordType ROW::GetTrailingColumnAtCharOffset(const ptrdiff_t offset) const
return _createCharToColumnMapper(offset).GetTrailingColumnAt(offset);
}
uint16_t ROW::GetCharOffset(til::CoordType col) const noexcept
{
const auto columns = GetReadableColumnCount();
const auto colBeg = clamp(col, 0, columns);
return _uncheckedCharOffset(gsl::narrow_cast<size_t>(colBeg));
}
DelimiterClass ROW::DelimiterClassAt(til::CoordType column, const std::wstring_view& wordDelimiters) const noexcept
{
const auto col = _clampedColumn(column);

View File

@@ -172,6 +172,7 @@ public:
std::wstring_view GetText(til::CoordType columnBegin, til::CoordType columnEnd) const noexcept;
til::CoordType GetLeadingColumnAtCharOffset(ptrdiff_t offset) const noexcept;
til::CoordType GetTrailingColumnAtCharOffset(ptrdiff_t offset) const noexcept;
uint16_t GetCharOffset(til::CoordType col) const noexcept;
DelimiterClass DelimiterClassAt(til::CoordType column, const std::wstring_view& wordDelimiters) const noexcept;
auto AttrBegin() const noexcept { return _attr.begin(); }

View File

@@ -390,6 +390,9 @@ Microsoft::Console::ICU::unique_utext Microsoft::Console::ICU::UTextFromTextBuff
utext_setup(&ut, 0, &status);
FAIL_FAST_IF(status > U_ZERO_ERROR);
rowBeg = std::max<til::CoordType>(0, rowBeg);
rowEnd = std::min(textBuffer.GetSize().BottomExclusive(), rowEnd);
ut.providerProperties = (1 << UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE) | (1 << UTEXT_PROVIDER_STABLE_CHUNKS);
ut.pFuncs = &utextFuncs;
ut.context = &textBuffer;

View File

@@ -237,6 +237,7 @@
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
<rescap:Capability Name="unvirtualizedResources" />
<rescap:Capability Name="appLicensing" />
</Capabilities>
<Extensions>

View File

@@ -237,6 +237,7 @@
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
<rescap:Capability Name="unvirtualizedResources" />
<rescap:Capability Name="appLicensing" />
</Capabilities>
<Extensions>

View File

@@ -1421,7 +1421,7 @@ namespace TerminalAppLocalTests
VERIFY_ARE_EQUAL(L"profile0", terminalArgs.Profile());
VERIFY_IS_NULL(terminalArgs.Elevate());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, settings.WindowSettingsDefaults());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs);
const auto termSettings = termSettingsResult.DefaultSettings();
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
@@ -1444,7 +1444,7 @@ namespace TerminalAppLocalTests
VERIFY_ARE_EQUAL(L"profile1", terminalArgs.Profile());
VERIFY_IS_NULL(terminalArgs.Elevate());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, settings.WindowSettingsDefaults());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs);
const auto termSettings = termSettingsResult.DefaultSettings();
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(true, termSettings->Elevate());
@@ -1467,7 +1467,7 @@ namespace TerminalAppLocalTests
VERIFY_ARE_EQUAL(L"profile2", terminalArgs.Profile());
VERIFY_IS_NULL(terminalArgs.Elevate());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, settings.WindowSettingsDefaults());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs);
const auto termSettings = termSettingsResult.DefaultSettings();
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
@@ -1492,7 +1492,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_FALSE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, settings.WindowSettingsDefaults());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs);
const auto termSettings = termSettingsResult.DefaultSettings();
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
@@ -1516,7 +1516,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_FALSE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, settings.WindowSettingsDefaults());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs);
const auto termSettings = termSettingsResult.DefaultSettings();
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
@@ -1540,7 +1540,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_FALSE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, settings.WindowSettingsDefaults());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs);
const auto termSettings = termSettingsResult.DefaultSettings();
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
@@ -1565,7 +1565,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_TRUE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, settings.WindowSettingsDefaults());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs);
const auto termSettings = termSettingsResult.DefaultSettings();
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(true, termSettings->Elevate());
@@ -1588,7 +1588,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_TRUE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, settings.WindowSettingsDefaults());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs);
const auto termSettings = termSettingsResult.DefaultSettings();
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(true, termSettings->Elevate());
@@ -1612,7 +1612,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_TRUE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, settings.WindowSettingsDefaults());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs);
const auto termSettings = termSettingsResult.DefaultSettings();
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(true, termSettings->Elevate());

View File

@@ -1099,7 +1099,7 @@ namespace TerminalAppLocalTests
Log::Comment(L"Change the tab switch order to MRU switching");
TestOnUIThread([&page]() {
page->_currentWindowSettings().TabSwitcherMode(TabSwitcherMode::MostRecentlyUsed);
page->_settings.GlobalSettings().TabSwitcherMode(TabSwitcherMode::MostRecentlyUsed);
});
Log::Comment(L"Switch to the next MRU tab, which is the fourth tab");
@@ -1145,7 +1145,7 @@ namespace TerminalAppLocalTests
});
Log::Comment(L"Change the tab switch order to in-order switching");
page->_currentWindowSettings().TabSwitcherMode(TabSwitcherMode::InOrder);
page->_settings.GlobalSettings().TabSwitcherMode(TabSwitcherMode::InOrder);
Log::Comment(L"Switch to the next in-order tab, which is the third tab");
TestOnUIThread([&page]() {
@@ -1157,7 +1157,7 @@ namespace TerminalAppLocalTests
});
Log::Comment(L"Change the tab switch order to not use the tab switcher (which is in-order always)");
page->_currentWindowSettings().TabSwitcherMode(TabSwitcherMode::Disabled);
page->_settings.GlobalSettings().TabSwitcherMode(TabSwitcherMode::Disabled);
Log::Comment(L"Switch to the next in-order tab, which is the fourth tab");
TestOnUIThread([&page]() {
@@ -1219,7 +1219,7 @@ namespace TerminalAppLocalTests
Log::Comment(L"Change the tab switch order to MRU switching");
TestOnUIThread([&page]() {
page->_currentWindowSettings().TabSwitcherMode(TabSwitcherMode::MostRecentlyUsed);
page->_settings.GlobalSettings().TabSwitcherMode(TabSwitcherMode::MostRecentlyUsed);
});
Log::Comment(L"Select the tabs from 0 to 3");

View File

@@ -499,8 +499,8 @@ namespace winrt::TerminalApp::implementation
}
else
{
_ResizePane(realArgs.ResizeDirection());
args.Handled(true);
const auto resizeSucceeded = _ResizePane(realArgs.ResizeDirection());
args.Handled(resizeSucceeded);
}
}
}
@@ -550,7 +550,7 @@ namespace winrt::TerminalApp::implementation
if (const auto& realArgs = args.ActionArgs().try_as<CopyTextArgs>())
{
const auto copyFormatting = realArgs.CopyFormatting();
const auto format = copyFormatting ? copyFormatting.Value() : _currentWindowSettings().CopyFormatting();
const auto format = copyFormatting ? copyFormatting.Value() : _settings.GlobalSettings().CopyFormatting();
const auto handled = _CopyText(realArgs.DismissSelection(), realArgs.SingleLine(), realArgs.WithControlSequences(), format);
args.Handled(handled);
}
@@ -938,27 +938,6 @@ namespace winrt::TerminalApp::implementation
co_return;
}
// Launch `wt -w <name>` so the monarch can either summon an existing
// window with that name or restore a persisted workspace.
safe_void_coroutine TerminalPage::_OpenWorkspaceWindow(const winrt::hstring name)
{
co_await winrt::resume_background();
const auto exePath{ GetWtExePath() };
const auto cmdline = fmt::format(FMT_COMPILE(L"-w {}"), std::wstring_view{ name });
SHELLEXECUTEINFOW seInfo{ 0 };
seInfo.cbSize = sizeof(seInfo);
seInfo.fMask = SEE_MASK_NOASYNC;
seInfo.lpVerb = L"open";
seInfo.lpFile = exePath.c_str();
seInfo.lpParameters = cmdline.c_str();
seInfo.nShow = SW_SHOWNORMAL;
LOG_IF_WIN32_BOOL_FALSE(ShellExecuteExW(&seInfo));
co_return;
}
void TerminalPage::_HandleNewWindow(const IInspectable& /*sender*/,
const ActionEventArgs& actionArgs)
{
@@ -982,7 +961,7 @@ namespace winrt::TerminalApp::implementation
if (const auto& terminalArgs{ newContentArgs.try_as<NewTerminalArgs>() })
{
const auto profile{ _settings.GetProfileForArgs(terminalArgs, _currentWindowSettings()) };
const auto profile{ _settings.GetProfileForArgs(terminalArgs) };
terminalArgs.Profile(::Microsoft::Console::Utils::GuidToString(profile.Guid()));
}
@@ -1139,7 +1118,7 @@ namespace winrt::TerminalApp::implementation
// use global default if query URL is unspecified
if (queryUrl.empty())
{
queryUrl = std::wstring_view{ _currentWindowSettings().SearchWebDefaultQueryUrl() };
queryUrl = std::wstring_view{ _settings.GlobalSettings().SearchWebDefaultQueryUrl() };
}
constexpr std::wstring_view queryToken{ L"%s" };
@@ -1654,68 +1633,4 @@ namespace winrt::TerminalApp::implementation
args.Handled(handled);
}
}
void TerminalPage::_HandleOpenWorkspace(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
// Open (or summon) a named window. We launch a new `wt -w <name>`
// process which the monarch will route to the correct live window or
// restore from a persisted workspace.
if (args)
{
if (const auto& realArgs = args.ActionArgs().try_as<OpenWorkspaceArgs>())
{
const auto name = realArgs.Name();
if (!name.empty())
{
_OpenWorkspaceWindow(name);
}
args.Handled(true);
}
}
}
void TerminalPage::_HandleSaveWorkspace(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
if (args)
{
if (const auto& realArgs = args.ActionArgs().try_as<SaveWorkspaceArgs>())
{
// If a name is supplied, use it; otherwise fall back to the
// current window name.
auto name = realArgs.Name();
if (name.empty())
{
name = _WindowProperties.WindowName();
}
if (!name.empty())
{
if (const auto layout = GetWindowLayout())
{
ApplicationState::SharedInstance().SaveWorkspace(name, layout);
}
}
args.Handled(true);
}
}
}
void TerminalPage::_HandleDeleteWorkspace(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
if (args)
{
if (const auto& realArgs = args.ActionArgs().try_as<DeleteWorkspaceArgs>())
{
const auto name = realArgs.Name();
if (!name.empty())
{
ApplicationState::SharedInstance().RemoveWorkspace(name);
}
args.Handled(true);
}
}
}
}

View File

@@ -194,7 +194,7 @@ namespace winrt::TerminalApp::implementation
g_hTerminalAppProvider,
"AppCreated",
TraceLoggingDescription("Event emitted when the application is started"),
TraceLoggingBool(_settings.WindowSettingsDefaults().ShowTabsInTitlebar(), "TabsInTitlebar"),
TraceLoggingBool(_settings.GlobalSettings().ShowTabsInTitlebar(), "TabsInTitlebar"),
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
}
@@ -229,12 +229,12 @@ namespace winrt::TerminalApp::implementation
}
_hasSettingsStartupActions = false;
const auto startupActions = newSettings.WindowSettingsDefaults().StartupActions();
const auto startupActions = newSettings.GlobalSettings().StartupActions();
if (!startupActions.empty())
{
_settingsAppArgs.FullResetState();
ExecuteCommandlineArgs args{ newSettings.WindowSettingsDefaults().StartupActions() };
ExecuteCommandlineArgs args{ newSettings.GlobalSettings().StartupActions() };
auto result = _settingsAppArgs.ParseArgs(args);
if (result == 0)
{

View File

@@ -85,7 +85,6 @@ namespace winrt::TerminalApp::implementation
WINRT_PROPERTY(TerminalApp::CommandlineArgs, Command, nullptr);
WINRT_PROPERTY(winrt::hstring, Content);
WINRT_PROPERTY(Windows::Foundation::IReference<Windows::Foundation::Rect>, InitialBounds);
WINRT_PROPERTY(winrt::Microsoft::Terminal::Settings::Model::WindowLayout, PersistedLayout, nullptr);
};
}

View File

@@ -51,6 +51,5 @@ namespace TerminalApp
CommandlineArgs Command { get; };
String Content { get; };
Windows.Foundation.IReference<Windows.Foundation.Rect> InitialBounds { get; };
Microsoft.Terminal.Settings.Model.WindowLayout PersistedLayout;
};
}

View File

@@ -672,9 +672,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>Dieser Linktyp wird derzeit nicht unterstützt:</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>Dieser Link kann zu einem unsicheren Speicherort führen. Links können ihren Computer und Ihre Daten beschädigen. Klicken Sie zum Schutz Des Computers nur auf Links aus vertrauenswürdigen Quellen.</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Trotzdem öffnen</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Einstellungen</value>
</data>
@@ -848,11 +854,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<value>Der aktive Bereich wurde auf die Registerkarte „{0}“ verschoben</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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>Registerkarte „{0}“ wurde in das Fenster „{1}“ verschoben</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Registerkarte „{0}“ in neues Fenster verschoben</value>
@@ -864,7 +870,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<value>Der aktive Bereich wurde in das Fenster "{0}" verschoben</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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Aktiver Bereich in neues Fenster verschoben</value>

View File

@@ -669,9 +669,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>This link type is currently not supported:</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>This link may lead to an unsafe location. Hyperlinks can be harmful to your computer and data. To protect your computer, only click links from trusted sources.</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Open anyway</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Settings</value>
</data>

View File

@@ -669,9 +669,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>Este tipo de vínculo no se admite actualmente:</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Cancelar</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>Este vínculo puede dar lugar a una ubicación no segura. Los hipervínculos pueden ser perjudiciales para el equipo y los datos. Para proteger el equipo, haga clic solo en vínculos de orígenes de confianza.</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Abrir de todas formas</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Configuración</value>
</data>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<value>Panel activo movido a la pestaña "{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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>La pestaña "{0}" se ha movido a la ventana "{1}"</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>La pestaña "{0}" se ha movido a la nueva ventana</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<value>Panel activo movido a la ventana "{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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Panel activo movido a nueva ventana</value>

View File

@@ -669,9 +669,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>Ce type de lien nest actuellement pas pris en charge :</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Annuler</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>Ce lien peut entraîner un emplacement non sécurisé. Les liens hypertexte peuvent endommager votre ordinateur et vos données. Pour protéger votre ordinateur, cliquez uniquement sur des liens provenant de sources fiables.</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Ouvrir quand même</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Paramètres</value>
</data>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<value>Volet actif déplacé vers longlet « {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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>Onglet « {0} » déplacé vers la fenêtre « {1} »</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Onglet « {0} » déplacé vers une nouvelle fenêtre</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<value>Volet actif déplacé vers longlet « {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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Volet actif déplacé vers une nouvelle fenêtre</value>

View File

@@ -669,9 +669,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>Questo tipo di collegamento non è al momento supportato:</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Annulla</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>Questo collegamento potrebbe causare un percorso non sicuro. I collegamenti ipertestuali possono essere dannosi per il computer e i dati. Per proteggere il computer, fare clic solo su collegamenti da origini attendibili.</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Apri comunque</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Impostazioni</value>
</data>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<value>Riquadro attivo spostato nella scheda "{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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>Scheda "{0}" spostata nella finestra "{1}"</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Scheda "{0}" spostata in una nuova finestra</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<value>Riquadro attivo spostato nella finestra "{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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Riquadro attivo spostato in una nuova finestra</value>

View File

@@ -670,9 +670,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>このリンクの種類は現在サポートされていません:</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>キャンセル</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>このリンクは安全でない可能性があります。ハイパーリンクは、コンピューターやデータに問題を起こす可能性があります。コンピューターを保護するには、信頼できるソースからのリンクのみをクリックしてください。</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>開く</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>設定</value>
</data>
@@ -846,11 +852,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>[{0}] タブを "{1}" ウィンドウに移動しました</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>[{0}] タブを新しいウィンドウに移動しました</value>
@@ -862,7 +868,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>アクティブなペインを新しいウィンドウに移動しました</value>

View File

@@ -669,9 +669,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>이 링크 형식은 현재 지원되지 않습니다.</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>취소</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>이 링크로 인해 안전하지 않은 위치가 발생할 수 있습니다. 하이퍼링크는 컴퓨터와 데이터를 손상시킬 수 있습니다. 컴퓨터를 보호하려면 신뢰할 수 있는 원본의 링크만 클릭하세요.</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>열기</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>설정</value>
</data>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>"{0}" 탭이 "{1}" 창으로 이동됨</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>"{0}" 탭이 새 창으로 이동됨</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>활성 창이 새 창으로 이동됨</value>

View File

@@ -669,9 +669,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>Não há suporte para este tipo de link no momento:</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Cancelar</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>Este link pode levar a um local não seguro. Hiperlinks podem ser prejudiciais ao computador e aos dados. Para proteger o computador, clique somente em links de fontes confiáveis.</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Abrir mesmo assim</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Configurações</value>
</data>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<value>Painel ativo movido para a guia "{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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>Guia "{0}" movida para janela "{1}"</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Guia "{0}" movida para nova janela</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<value>Painel ativo movido para a janela "{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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Painel ativo movido para nova janela</value>

View File

@@ -669,8 +669,14 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>Ťђïś łϊηќ ŧурē ιş çũґѓзⁿτľÿ ñστ şΰρρоŕŧĕđ: !!! !!! !!! !!! </value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<value>Сąñс℮ł !</value>
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Çдπсёľ !</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>Ŧђīś ℓîŋќ мαў ľêãδ τб áń úʼnšàƒé ℓоćάŧίоñ. Ĥўрзŗℓĭŋķѕ çâⁿ ъέ ђąřмƒúļ τό ўôця ċómφύŧèґ аňδ ðáťǻ. Ţб ρгøťėçŧ ўòύг ςömφùţĕŕ, ŏŋľỳ čℓΐςķ łίŋκѕ ƒřöм ťŗμѕŧєđ śόυяčêś. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Őρέй ǻпŷŵãγ !!!</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Śëţťĩпğś !!</value>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>"{0}" ťāъ мōνęđ τŏ "{1}" шΐπδŏẅ !!! !!! !!!</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>"{0}" тąь mǿνєđ ŧσ ήèώ ẅĩŋďøẃ !!! !!! !!!</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<value>Λςťìνє рáиė mόνéð ťб "{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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Αĉťįνέ ρªņз mσνёđ τǿ ήёẃ ẃîпďǿω !!! !!! !!!</value>

View File

@@ -669,8 +669,14 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>Ťђïś łϊηќ ŧурē ιş çũґѓзⁿτľÿ ñστ şΰρρоŕŧĕđ: !!! !!! !!! !!! </value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<value>Сąñс℮ł !</value>
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Çдπсёľ !</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>Ŧђīś ℓîŋќ мαў ľêãδ τб áń úʼnšàƒé ℓоćάŧίоñ. Ĥўрзŗℓĭŋķѕ çâⁿ ъέ ђąřмƒúļ τό ўôця ċómφύŧèґ аňδ ðáťǻ. Ţб ρгøťėçŧ ўòύг ςömφùţĕŕ, ŏŋľỳ čℓΐςķ łίŋκѕ ƒřöм ťŗμѕŧєđ śόυяčêś. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Őρέй ǻпŷŵãγ !!!</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Śëţťĩпğś !!</value>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>"{0}" ťāъ мōνęđ τŏ "{1}" шΐπδŏẅ !!! !!! !!!</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>"{0}" тąь mǿνєđ ŧσ ήèώ ẅĩŋďøẃ !!! !!! !!!</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<value>Λςťìνє рáиė mόνéð ťб "{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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Αĉťįνέ ρªņз mσνёđ τǿ ήёẃ ẃîпďǿω !!! !!! !!!</value>

View File

@@ -669,8 +669,14 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>Ťђïś łϊηќ ŧурē ιş çũґѓзⁿτľÿ ñστ şΰρρоŕŧĕđ: !!! !!! !!! !!! </value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<value>Сąñс℮ł !</value>
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Çдπсёľ !</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>Ŧђīś ℓîŋќ мαў ľêãδ τб áń úʼnšàƒé ℓоćάŧίоñ. Ĥўрзŗℓĭŋķѕ çâⁿ ъέ ђąřмƒúļ τό ўôця ċómφύŧèґ аňδ ðáťǻ. Ţб ρгøťėçŧ ўòύг ςömφùţĕŕ, ŏŋľỳ čℓΐςķ łίŋκѕ ƒřöм ťŗμѕŧєđ śόυяčêś. !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Őρέй ǻпŷŵãγ !!!</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Śëţťĩпğś !!</value>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>"{0}" ťāъ мōνęđ τŏ "{1}" шΐπδŏẅ !!! !!! !!!</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>"{0}" тąь mǿνєđ ŧσ ήèώ ẅĩŋďøẃ !!! !!! !!!</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<value>Λςťìνє рáиė mόνéð ťб "{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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Αĉťįνέ ρªņз mσνёđ τǿ ήёẃ ẃîпďǿω !!! !!! !!!</value>

View File

@@ -669,9 +669,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>Этот тип связи в настоящее время не поддерживается:</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>Отмена</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>Эта ссылка может привести к небезопасному расположению. Гиперссылки могут нанести вред компьютеру и данным. Чтобы защитить компьютер, щелкните ссылки только из надежных источников.</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>Все равно открыть</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>Параметры</value>
</data>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>Вкладка "{0}" перемещена в окно "{1}"</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Вкладка "{0}" перемещена в новое окно</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>Активная область перемещена в новое окно</value>

View File

@@ -669,9 +669,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>当前不支持此链接类型:</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>取消</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>此链接可能会导致不安全的位置。超链接可能对你的计算机和数据有害。若要保护你的计算机,请仅单击来自受信任源的链接。</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>仍然打开</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>设置</value>
</data>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>“{0}”选项卡已移动到“{1}”窗口</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>“{0}”选项卡已移动到新窗口</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>活动窗格已移动到新窗口</value>

View File

@@ -669,9 +669,15 @@
<data name="UnsupportedSchemeText" xml:space="preserve">
<value>目前不支援此連結類型:</value>
</data>
<data name="CouldNotOpenUriDialog.PrimaryButtonText" xml:space="preserve">
<data name="UriErrorDialog.CloseButtonText" xml:space="preserve">
<value>取消</value>
</data>
<data name="UnsafeUrlConfirmText" xml:space="preserve">
<value>此連結可能通往不安全地點。超連結可能對你的電腦和資料造成傷害。為了保護你的電腦,只點擊來自可信來源的連結。</value>
</data>
<data name="UnsafeUrlConfirmAllowAction" xml:space="preserve">
<value>一律開啟</value>
</data>
<data name="SettingsTab" xml:space="preserve">
<value>設定</value>
</data>
@@ -845,11 +851,11 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingTab" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the tab to which the pane was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_Default" xml:space="preserve">
<value>「{0}」索引標籤已移至「{1}」視窗</value>
<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 name of the window the tab was moved to.</comment>
<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 name of the window to which the tab was moved.</comment>
</data>
<data name="TerminalPage_TabMovedAnnouncement_NewWindow" xml:space="preserve">
<value>「{0}」索引標籤已移至新視窗</value>
@@ -861,7 +867,7 @@
</data>
<data name="TerminalPage_PaneMovedAnnouncement_ExistingWindow2" xml:space="preserve">
<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>
<comment>{Locked="{0}"}This text is read out by screen readers upon a successful pane movement. {0} is the name of the window to which the pane was moved.</comment>
</data>
<data name="TerminalPage_PaneMovedAnnouncement_NewWindow" xml:space="preserve">
<value>活動窗格已移至新視窗</value>

View File

@@ -19,7 +19,7 @@ namespace winrt::TerminalApp::implementation
// Stash away the current requested theme of the app. We'll need that in
// _BackgroundBrush() to do a theme-aware resource lookup
_requestedTheme = settings.GlobalSettings().CurrentTheme(settings.WindowSettingsDefaults()).RequestedTheme();
_requestedTheme = settings.GlobalSettings().CurrentTheme().RequestedTheme();
}
void SettingsPaneContent::UpdateSettings(const CascadiaSettings& settings)
@@ -27,7 +27,7 @@ namespace winrt::TerminalApp::implementation
ASSERT_UI_THREAD();
_sui.UpdateSettings(settings);
_requestedTheme = settings.GlobalSettings().CurrentTheme(settings.WindowSettingsDefaults()).RequestedTheme();
_requestedTheme = settings.GlobalSettings().CurrentTheme().RequestedTheme();
}
winrt::Windows::UI::Xaml::FrameworkElement SettingsPaneContent::GetRoot()

View File

@@ -121,7 +121,7 @@ namespace winrt::TerminalApp::implementation
{
static const auto key = winrt::box_value(L"SettingsUiTabBrush");
return ThemeLookup(WUX::Application::Current().Resources(),
_settings.GlobalSettings().CurrentTheme(_settings.WindowSettingsDefaults()).RequestedTheme(),
_settings.GlobalSettings().CurrentTheme().RequestedTheme(),
key)
.try_as<winrt::WUX::Media::Brush>();
}

View File

@@ -173,7 +173,7 @@ namespace winrt::TerminalApp::implementation
// Make sure to try/catch this, because the LocalTests won't be
// able to use this helper.
const auto settings{ winrt::TerminalApp::implementation::AppLogic::CurrentAppSettings() };
if (settings.WindowSettingsDefaults().TabWidthMode() == winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::SizeToContent)
if (settings.GlobalSettings().TabWidthMode() == winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::SizeToContent)
{
_headerControl.RenamerMaxWidth(HeaderRenameBoxWidthTitleLength);
}
@@ -844,14 +844,14 @@ namespace winrt::TerminalApp::implementation
// Arguments:
// - direction: The direction to move the separator in.
// Return Value:
// - <none>
void Tab::ResizePane(const ResizeDirection& direction)
// - whether a pane was resized
bool Tab::ResizePane(const ResizeDirection& direction)
{
ASSERT_UI_THREAD();
// NOTE: This _must_ be called on the root pane, so that it can propagate
// throughout the entire tree.
_rootPane->ResizePane(direction);
return _rootPane->ResizePane(direction);
}
// Method Description:

View File

@@ -53,7 +53,7 @@ namespace winrt::TerminalApp::implementation
const float splitSize,
winrt::Windows::Foundation::Size availableSpace) const;
void ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
bool ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
bool NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction);
bool SwapPane(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction);
bool FocusPane(const uint32_t id);

View File

@@ -66,14 +66,14 @@ namespace winrt::TerminalApp::implementation
{
if (const auto& newTerminalArgs{ newContentArgs.try_as<NewTerminalArgs>() })
{
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings()) };
const auto profile{ _settings.GetProfileForArgs(newTerminalArgs) };
// GH#11114: GetProfileForArgs can return null if the index is higher
// than the number of available profiles.
if (!profile)
{
return S_FALSE;
}
const auto settings{ Settings::TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, _currentWindowSettings()) };
const auto settings{ Settings::TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs) };
// Try to handle auto-elevation
if (_maybeElevate(newTerminalArgs, settings, profile))
@@ -105,7 +105,7 @@ namespace winrt::TerminalApp::implementation
if (insertPosition == -1)
{
insertPosition = _tabs.Size();
if (_currentWindowSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
if (_settings.GlobalSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
{
auto currentTabIndex = _GetFocusedTabIndex();
if (currentTabIndex.has_value())
@@ -220,7 +220,7 @@ namespace winrt::TerminalApp::implementation
if (const auto content{ tab.GetActiveContent() })
{
const auto& icon{ content.Icon() };
const auto theme = _settings.GlobalSettings().CurrentTheme(_currentWindowSettings());
const auto theme = _settings.GlobalSettings().CurrentTheme();
const auto iconStyle = (theme && theme.Tab()) ? theme.Tab().IconStyle() : IconStyle::Default;
tab.UpdateIcon(icon, iconStyle);
@@ -231,7 +231,7 @@ namespace winrt::TerminalApp::implementation
// - Handle changes to the tab width set by the user
void TerminalPage::_UpdateTabWidthMode()
{
_tabView.TabWidthMode(_currentWindowSettings().TabWidthMode());
_tabView.TabWidthMode(_settings.GlobalSettings().TabWidthMode());
}
// Method Description:
@@ -244,9 +244,9 @@ namespace winrt::TerminalApp::implementation
// - there is more than one tab, or the user has chosen to always show tabs
const auto isVisible = !_isInFocusMode &&
(!_isFullscreen || _showTabsFullscreen) &&
(_currentWindowSettings().ShowTabsInTitlebar() ||
(_settings.GlobalSettings().ShowTabsInTitlebar() ||
(_tabs.Size() > 1) ||
_currentWindowSettings().AlwaysShowTabs());
_settings.GlobalSettings().AlwaysShowTabs());
if (_tabView)
{
@@ -286,7 +286,7 @@ namespace winrt::TerminalApp::implementation
// current control's live settings (which will include changes
// made through VT).
uint32_t insertPosition = _tabs.Size();
if (_currentWindowSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
if (_settings.GlobalSettings().NewTabPosition() == NewTabPosition::AfterCurrentTab)
{
insertPosition = tab.TabViewIndex() + 1;
}
@@ -438,21 +438,6 @@ namespace winrt::TerminalApp::implementation
const auto focusedTabIndex{ _GetFocusedTabIndex() };
// If this is the last tab in a named window, persist the workspace
// layout now—before the tab is shut down—so GetWindowLayout() can
// still see its tab data.
if (_tabs.Size() == 1)
{
const auto& windowName = _WindowProperties.WindowName();
if (!windowName.empty())
{
if (const auto layout = GetWindowLayout())
{
ApplicationState::SharedInstance().SaveWorkspace(windowName, layout);
}
}
}
// Removing the tab from the collection should destroy its control and disconnect its connection,
// but it doesn't always do so. The UI tree may still be holding the control and preventing its destruction.
tab.Shutdown();
@@ -492,7 +477,7 @@ namespace winrt::TerminalApp::implementation
// 1. We want to customize this behavior (e.g., use MRU logic)
// 2. In fullscreen (GH#5799) and focus (GH#7916) modes the _OnTabItemsChanged is not fired
// 3. When rearranging tabs (GH#7916) _OnTabItemsChanged is suppressed
const auto tabSwitchMode = _currentWindowSettings().TabSwitcherMode();
const auto tabSwitchMode = _settings.GlobalSettings().TabSwitcherMode();
if (tabSwitchMode == TabSwitcherMode::MostRecentlyUsed)
{
@@ -543,7 +528,7 @@ namespace winrt::TerminalApp::implementation
void TerminalPage::_SelectNextTab(const bool bMoveRight, const Windows::Foundation::IReference<Microsoft::Terminal::Settings::Model::TabSwitcherMode>& customTabSwitcherMode)
{
const auto index{ _GetFocusedTabIndex().value_or(0) };
const auto tabSwitchMode = customTabSwitcherMode ? customTabSwitcherMode.Value() : _currentWindowSettings().TabSwitcherMode();
const auto tabSwitchMode = customTabSwitcherMode ? customTabSwitcherMode.Value() : _settings.GlobalSettings().TabSwitcherMode();
if (tabSwitchMode == TabSwitcherMode::Disabled)
{
auto tabCount = _tabs.Size();
@@ -1032,7 +1017,7 @@ namespace winrt::TerminalApp::implementation
void TerminalPage::_UpdateBackground(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile)
{
if (profile && _currentWindowSettings().UseBackgroundImageForWindow())
if (profile && _settings.GlobalSettings().UseBackgroundImageForWindow())
{
_SetBackgroundImage(profile.DefaultAppearance());
}

View File

@@ -25,21 +25,6 @@ namespace winrt::TerminalApp::implementation
InitializeComponent();
}
void TabRowControl::WorkspaceName(const winrt::hstring& value)
{
if (_WorkspaceName != value)
{
_WorkspaceName = value;
PropertyChanged.raise(*this, WUX::Data::PropertyChangedEventArgs{ L"WorkspaceName" });
// Collapse the name text when empty so the button shows only the icon.
if (const auto textBlock = WorkspaceNameText())
{
textBlock.Visibility(value.empty() ? WUX::Visibility::Collapsed : WUX::Visibility::Visible);
}
}
}
// Method Description:
// - Bound in the Xaml editor to the [+] button.
// Arguments:

View File

@@ -19,14 +19,6 @@ namespace winrt::TerminalApp::implementation
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(bool, ShowElevationShield, PropertyChanged.raise, false);
WINRT_OBSERVABLE_PROPERTY(bool, ShowWindowsButton, PropertyChanged.raise, true);
public:
winrt::hstring WorkspaceName() const noexcept { return _WorkspaceName; }
void WorkspaceName(const winrt::hstring& value);
private:
winrt::hstring _WorkspaceName{};
};
}

View File

@@ -9,7 +9,5 @@ namespace TerminalApp
TabRowControl();
Microsoft.UI.Xaml.Controls.TabView TabView { get; };
Boolean ShowElevationShield;
Boolean ShowWindowsButton;
String WorkspaceName;
}
}

View File

@@ -35,43 +35,14 @@
TabWidthMode="Equal">
<mux:TabView.TabStripHeader>
<StackPanel Orientation="Horizontal">
<!-- EA18 is the "Shield" glyph -->
<FontIcon x:Uid="ElevationShield"
Margin="9,4,0,4"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="16"
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
Glyph="&#xEA18;"
Visibility="{x:Bind ShowElevationShield, Mode=OneWay}" />
<!-- Workspace/windows button -->
<Button x:Name="WorkspaceDropdown"
Margin="4,4,0,4"
Padding="8,2,4,2"
VerticalAlignment="Center"
BorderThickness="0"
Background="Transparent"
Visibility="{x:Bind ShowWindowsButton, Mode=OneWay}">
<Button.Content>
<StackPanel Orientation="Horizontal"
Spacing="4">
<!-- EE40 is the "TaskViewSettings" glyph -->
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="12"
Glyph="&#xEE40;" />
<TextBlock x:Name="WorkspaceNameText"
VerticalAlignment="Center"
FontSize="12"
Visibility="Collapsed"
Text="{x:Bind WorkspaceName, Mode=OneWay}" />
</StackPanel>
</Button.Content>
<Button.Flyout>
<MenuFlyout x:Name="WorkspaceFlyout" />
</Button.Flyout>
</Button>
</StackPanel>
<!-- EA18 is the "Shield" glyph -->
<FontIcon x:Uid="ElevationShield"
Margin="9,4,0,4"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="16"
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
Glyph="&#xEA18;"
Visibility="{x:Bind ShowElevationShield, Mode=OneWay}" />
</mux:TabView.TabStripHeader>
<mux:TabView.TabStripFooter>

View File

@@ -25,7 +25,6 @@
#include "TerminalSettingsCache.h"
#include "LaunchPositionRequest.g.cpp"
#include "WindowListRequest.g.cpp"
#include "RenameWindowRequestedArgs.g.cpp"
#include "RequestMoveContentArgs.g.cpp"
#include "TerminalPage.g.cpp"
@@ -227,11 +226,6 @@ namespace winrt::TerminalApp::implementation
_WindowProperties.PropertyChanged({ get_weak(), &TerminalPage::_windowPropertyChanged });
}
winrt::Microsoft::Terminal::Settings::Model::WindowSettings TerminalPage::_currentWindowSettings() const
{
return _settings.WindowSettings(_WindowProperties.WindowName());
}
// Method Description:
// - implements the IInitializeWithWindow interface from shobjidl_core.
// - We're going to use this HWND as the owner for the ConPTY windows, via
@@ -274,19 +268,12 @@ namespace winrt::TerminalApp::implementation
void TerminalPage::SetSettings(CascadiaSettings settings, bool needRefreshUI)
{
assert(Dispatcher().HasThreadAccess());
// IMPORTANT: we must assign _settings FIRST, because many downstream
// helpers (e.g. _currentWindowSettings()) dereference it. On the very
// first call _settings is nullptr, so any access before this line would
// crash.
const auto firstLoad = _settings == nullptr;
_settings = settings;
if (firstLoad)
if (_settings == nullptr)
{
// Create this only on the first time we load the settings.
_terminalSettingsCache = std::make_shared<TerminalSettingsCache>(settings, _currentWindowSettings());
_terminalSettingsCache = std::make_shared<TerminalSettingsCache>(settings);
}
_settings = settings;
// Make sure to call SetCommands before _RefreshUIForSettingsReload.
// SetCommands will make sure the KeyChordText of Commands is updated, which needs
@@ -347,22 +334,8 @@ namespace winrt::TerminalApp::implementation
auto tabRowImpl = winrt::get_self<implementation::TabRowControl>(_tabRow);
_newTabButton = tabRowImpl->NewTabButton();
_workspaceFlyout = tabRowImpl->WorkspaceFlyout();
// Set the initial workspace name from the window name.
// Use raw WindowName() so unnamed windows show no text.
_tabRow.WorkspaceName(_WindowProperties.WindowName());
// Rebuild the workspace flyout each time it opens so it always
// reflects the latest set of persisted workspaces.
_workspaceFlyout.Opening([weakThis{ get_weak() }](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
page->_PopulateWorkspaceFlyout();
}
});
if (_currentWindowSettings().ShowTabsInTitlebar())
if (_settings.GlobalSettings().ShowTabsInTitlebar())
{
// Remove the TabView from the page. We'll hang on to it, we need to
// put it in the titlebar.
@@ -397,7 +370,7 @@ namespace winrt::TerminalApp::implementation
// Initialize the state of the CloseButtonOverlayMode property of
// our TabView, to match the tab.showCloseButton property in the theme.
if (const auto theme = _settings.GlobalSettings().CurrentTheme(_currentWindowSettings()))
if (const auto theme = _settings.GlobalSettings().CurrentTheme())
{
const auto visibility = theme.Tab() ? theme.Tab().ShowCloseButton() : Settings::Model::TabCloseButtonVisibility::Always;
@@ -452,7 +425,7 @@ namespace winrt::TerminalApp::implementation
// Settings AllowDependentAnimations will affect whether animations are
// enabled application-wide, so we don't need to check it each time we
// want to create an animation.
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_currentWindowSettings().DisableAnimations());
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_settings.GlobalSettings().DisableAnimations());
// Once the page is actually laid out on the screen, trigger all our
// startup actions. Things like Panes need to know at least how big the
@@ -461,20 +434,14 @@ namespace winrt::TerminalApp::implementation
// _OnFirstLayout will remove this handler so it doesn't get called more than once.
_layoutUpdatedRevoker = _tabContent.LayoutUpdated(winrt::auto_revoke, { this, &TerminalPage::_OnFirstLayout });
_isAlwaysOnTop = _currentWindowSettings().AlwaysOnTop();
_showTabsFullscreen = _currentWindowSettings().ShowTabsFullscreen();
_isAlwaysOnTop = _settings.GlobalSettings().AlwaysOnTop();
_showTabsFullscreen = _settings.GlobalSettings().ShowTabsFullscreen();
// DON'T set up Toasts/TeachingTips here. They should be loaded and
// initialized the first time they're opened, in whatever method opens
// them.
_tabRow.ShowElevationShield(IsRunningElevated() && _currentWindowSettings().ShowAdminShield());
// Apply the ShowWindowsButton theme setting.
if (const auto theme = _settings.GlobalSettings().CurrentTheme(_currentWindowSettings()))
{
_tabRow.ShowWindowsButton(theme.Window() ? theme.Window().ShowWindowsButton() : true);
}
_tabRow.ShowElevationShield(IsRunningElevated() && _settings.GlobalSettings().ShowAdminShield());
_adjustProcessPriorityThrottled = std::make_shared<ThrottledFunc<>>(
DispatcherQueue::GetForCurrentThread(),
@@ -553,7 +520,7 @@ namespace winrt::TerminalApp::implementation
// It's possible that newTerminalArgs is null here.
// GetProfileForArgs should be resilient to that.
const auto profile{ settings.GetProfileForArgs(newTerminalArgs, settings.WindowSettingsDefaults()) };
const auto profile{ settings.GetProfileForArgs(newTerminalArgs) };
if (profile.Elevate())
{
continue;
@@ -984,7 +951,7 @@ namespace winrt::TerminalApp::implementation
// Create profile entries from the NewTabMenu configuration using a
// recursive helper function. This returns a std::vector of FlyoutItemBases,
// that we then add to our Flyout.
auto entries = _currentWindowSettings().NewTabMenu();
auto entries = _settings.GlobalSettings().NewTabMenu();
auto items = _CreateNewTabFlyoutItems(entries);
for (const auto& item : items)
{
@@ -1266,7 +1233,7 @@ namespace winrt::TerminalApp::implementation
profileMenuItem.Icon(icon);
}
if (profile.Guid() == _currentWindowSettings().DefaultProfile())
if (profile.Guid() == _settings.GlobalSettings().DefaultProfile())
{
// Contrast the default profile with others in font weight.
profileMenuItem.FontWeight(FontWeights::Bold());
@@ -1432,7 +1399,7 @@ namespace winrt::TerminalApp::implementation
if (newTerminalArgs.ProfileIndex() != nullptr)
{
// We want to promote the index to a GUID because there is no "launch to profile index" command.
const auto profile = _settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings());
const auto profile = _settings.GetProfileForArgs(newTerminalArgs);
if (profile)
{
newTerminalArgs.Profile(::Microsoft::Console::Utils::GuidToString(profile.Guid()));
@@ -1503,7 +1470,7 @@ namespace winrt::TerminalApp::implementation
const bool inheritCursor)
{
static const auto textMeasurement = [&]() -> std::wstring_view {
switch (_currentWindowSettings().TextMeasurement())
switch (_settings.GlobalSettings().TextMeasurement())
{
case TextMeasurement::Graphemes:
return L"graphemes";
@@ -1515,6 +1482,9 @@ namespace winrt::TerminalApp::implementation
return {};
}
}();
static const auto ambiguousIsWide = [&]() -> bool {
return _settings.GlobalSettings().AmbiguousWidth() == AmbiguousWidth::Wide;
}();
TerminalConnection::ITerminalConnection connection{ nullptr };
@@ -1580,6 +1550,10 @@ namespace winrt::TerminalApp::implementation
{
valueSet.Insert(L"textMeasurement", Windows::Foundation::PropertyValue::CreateString(textMeasurement));
}
if (ambiguousIsWide)
{
valueSet.Insert(L"ambiguousIsWide", Windows::Foundation::PropertyValue::CreateBoolean(true));
}
if (const auto id = settings.SessionId(); id != winrt::guid{})
{
@@ -1622,7 +1596,7 @@ namespace winrt::TerminalApp::implementation
{
// TODO GH#5047 If we cache the NewTerminalArgs, we no longer need to do this.
profile = GetClosestProfileForDuplicationOfProfile(profile);
controlSettings = Settings::TerminalSettings::CreateWithProfile(_settings, profile, _currentWindowSettings());
controlSettings = Settings::TerminalSettings::CreateWithProfile(_settings, profile);
// Replace the Starting directory with the CWD, if given
const auto workingDirectory = control.WorkingDirectory();
@@ -2259,14 +2233,14 @@ namespace winrt::TerminalApp::implementation
}
}
WindowLayout TerminalPage::GetWindowLayout()
void TerminalPage::PersistState()
{
// This method may be called for a window even if it hasn't had a tab yet or lost all of them.
// We shouldn't persist such windows.
const auto tabCount = _tabs.Size();
if (_startupState != StartupState::Initialized || tabCount == 0)
{
return nullptr;
return;
}
std::vector<ActionAndArgs> actions;
@@ -2281,7 +2255,7 @@ namespace winrt::TerminalApp::implementation
// Avoid persisting a window with zero tabs, because `BuildStartupActions` happened to return an empty vector.
if (actions.empty())
{
return nullptr;
return;
}
// if the focused tab was not the last tab, restore that
@@ -2330,41 +2304,7 @@ namespace winrt::TerminalApp::implementation
RequestLaunchPosition.raise(*this, launchPosRequest);
layout.InitialPosition(launchPosRequest.Position());
return layout;
}
void TerminalPage::PersistState()
{
if (const auto layout = GetWindowLayout())
{
// For named windows, save the full state into the workspace collection
// and emit a lightweight openWorkspace action in the generic layout.
// This way, restoring generic layouts re-opens workspaces by name
// rather than duplicating their full tab state.
const auto& windowName = _WindowProperties.WindowName();
if (!windowName.empty())
{
// Persist the full layout into the workspace collection.
ApplicationState::SharedInstance().SaveWorkspace(windowName, layout);
// Build a minimal layout with just an openWorkspace action
// so the generic restore path re-opens this workspace by name.
std::vector<ActionAndArgs> actions;
ActionAndArgs action;
action.Action(ShortcutAction::OpenWorkspace);
OpenWorkspaceArgs args{ windowName };
action.Args(args);
actions.emplace_back(std::move(action));
WindowLayout stub;
stub.TabLayout(winrt::single_threaded_vector<ActionAndArgs>(std::move(actions)));
ApplicationState::SharedInstance().AppendPersistedWindowLayout(stub);
}
else
{
ApplicationState::SharedInstance().AppendPersistedWindowLayout(layout);
}
}
ApplicationState::SharedInstance().AppendPersistedWindowLayout(layout);
}
// Method Description:
@@ -2373,7 +2313,7 @@ namespace winrt::TerminalApp::implementation
safe_void_coroutine TerminalPage::CloseWindow()
{
if (_HasMultipleTabs() &&
_currentWindowSettings().ConfirmCloseAllTabs() &&
_settings.GlobalSettings().ConfirmCloseAllTabs() &&
!_displayingCloseDialog)
{
if (_newTabButton && _newTabButton.Flyout())
@@ -2851,14 +2791,15 @@ namespace winrt::TerminalApp::implementation
// Arguments:
// - direction: The direction to move the separator in.
// Return Value:
// - <none>
void TerminalPage::_ResizePane(const ResizeDirection& direction)
// - whether a pane was resized
bool TerminalPage::_ResizePane(const ResizeDirection& direction)
{
if (const auto tabImpl{ _GetFocusedTabImpl() })
{
_UnZoomIfNeeded();
tabImpl->ResizePane(direction);
return tabImpl->ResizePane(direction);
}
return false;
}
// Method Description:
@@ -2898,7 +2839,7 @@ namespace winrt::TerminalApp::implementation
// - the title of the focused control if there is one, else "Terminal"
hstring TerminalPage::Title()
{
if (_currentWindowSettings().ShowTitleInTitlebar())
if (_settings.GlobalSettings().ShowTitleInTitlebar())
{
if (const auto tab{ _GetFocusedTab() })
{
@@ -2987,7 +2928,7 @@ namespace winrt::TerminalApp::implementation
// - See Pane::CalcSnappedDimension
float TerminalPage::CalcSnappedDimension(const bool widthOrHeight, const float dimension) const
{
if (_settings && _currentWindowSettings().SnapToGridOnResize())
if (_settings && _settings.GlobalSettings().SnapToGridOnResize())
{
if (const auto tabImpl{ _GetFocusedTabImpl() })
{
@@ -3015,7 +2956,7 @@ namespace winrt::TerminalApp::implementation
// the WinRT one on average, depending on CPU load. Don't use the WinRT clipboard API if you can.
const auto weakThis = get_weak();
const auto dispatcher = Dispatcher();
const auto windowSettings = _currentWindowSettings();
const auto globalSettings = _settings.GlobalSettings();
const auto bracketedPaste = eventArgs.BracketedPasteEnabled();
const auto sourceId = sender.try_as<ControlInteractivity>().Id();
@@ -3028,18 +2969,22 @@ namespace winrt::TerminalApp::implementation
text = clipboard::read();
}
if (!bracketedPaste && windowSettings.TrimPaste())
if (!bracketedPaste && globalSettings.TrimPaste())
{
text = winrt::hstring{ Utils::TrimPaste(text) };
}
if (text.empty())
// LOAD BEARING: Send an empty bracketed paste even if the clipboard was empty.
// Bracketed Paste provides an application a way to know whether the
// user pasted, even if there was no applicable content on it. This
// behavior is observed in GNOME Terminal, among others.
if (!bracketedPaste && text.empty())
{
co_return;
}
bool warnMultiLine = false;
switch (windowSettings.WarnAboutMultiLinePaste())
switch (globalSettings.WarnAboutMultiLinePaste())
{
case WarnAboutMultiLinePaste::Automatic:
// NOTE that this is unsafe, because a shell that doesn't support bracketed paste
@@ -3062,7 +3007,7 @@ namespace winrt::TerminalApp::implementation
}
constexpr std::size_t minimumSizeForWarning = 1024 * 5; // 5 KiB
const auto warnLargeText = text.size() > minimumSizeForWarning && windowSettings.WarnAboutLargePaste();
const auto warnLargeText = text.size() > minimumSizeForWarning && globalSettings.WarnAboutLargePaste();
if (warnMultiLine || warnLargeText)
{
@@ -3142,18 +3087,42 @@ namespace winrt::TerminalApp::implementation
}
CATCH_LOG();
void TerminalPage::_OpenHyperlinkHandler(const IInspectable /*sender*/, const Microsoft::Terminal::Control::OpenHyperlinkEventArgs eventArgs)
safe_void_coroutine TerminalPage::_OpenHyperlinkHandler(const IInspectable /*sender*/, const Microsoft::Terminal::Control::OpenHyperlinkEventArgs eventArgs)
{
try
{
auto parsed = winrt::Windows::Foundation::Uri(eventArgs.Uri());
auto uriString{ eventArgs.Uri() };
auto parsed = winrt::Windows::Foundation::Uri(uriString);
if (_IsUriSupported(parsed))
{
ShellExecute(nullptr, L"open", eventArgs.Uri().c_str(), nullptr, nullptr, SW_SHOWNORMAL);
bool shouldLaunch{ _IsUriConsideredSomewhatSafe(parsed) };
if (!shouldLaunch)
{
if (auto presenter{ _dialogPresenter.get() })
{
// FindName needs to be called first to actually load the xaml object
auto unopenedUriDialog = FindName(L"UriErrorDialog").try_as<WUX::Controls::ContentDialog>();
// Insert the reason and the URI
unopenedUriDialog.SecondaryButtonText(RS_(L"UnsafeUrlConfirmAllowAction"));
CouldNotOpenUriReason().Text(RS_(L"UnsafeUrlConfirmText"));
UnopenedUri().Text(uriString);
// Show the dialog
auto result = co_await presenter.ShowDialog(unopenedUriDialog);
shouldLaunch = result == ContentDialogResult::Secondary;
}
}
if (shouldLaunch)
{
ShellExecuteW(nullptr, L"open", uriString.c_str(), nullptr, nullptr, SW_SHOWNORMAL);
}
}
else
{
_ShowCouldNotOpenDialog(RS_(L"UnsupportedSchemeText"), eventArgs.Uri());
_ShowCouldNotOpenDialog(RS_(L"UnsupportedSchemeText"), uriString);
}
}
catch (...)
@@ -3173,9 +3142,10 @@ namespace winrt::TerminalApp::implementation
if (auto presenter{ _dialogPresenter.get() })
{
// FindName needs to be called first to actually load the xaml object
auto unopenedUriDialog = FindName(L"CouldNotOpenUriDialog").try_as<WUX::Controls::ContentDialog>();
auto unopenedUriDialog = FindName(L"UriErrorDialog").try_as<WUX::Controls::ContentDialog>();
// Insert the reason and the URI
unopenedUriDialog.SecondaryButtonText({});
CouldNotOpenUriReason().Text(reason);
UnopenedUri().Text(uri);
@@ -3228,6 +3198,42 @@ namespace winrt::TerminalApp::implementation
return true;
}
bool TerminalPage::_IsUriConsideredSomewhatSafe(const winrt::Windows::Foundation::Uri& parsedUri) const
{
const auto& schemeName = parsedUri.SchemeName();
if (schemeName == L"http" || schemeName == L"https")
{
return true;
}
if (schemeName == L"file")
{
static const auto pathext{ wil::TryGetEnvironmentVariableW<std::wstring>(L"PATHEXT") };
const auto filename = parsedUri.Path();
for (const auto& e : til::split_iterator{ std::wstring_view{ pathext }, L';' })
{
if (til::ends_with_insensitive_ascii(filename, e))
{
return false;
}
}
return true;
}
if (const auto& safeSchemes = _settings.GlobalSettings().SafeUriSchemes())
{
for (const auto& scheme : safeSchemes)
{
if (til::equals_insensitive_ascii(schemeName, scheme))
{
return true;
}
}
}
return false;
}
// Important! Don't take this eventArgs by reference, we need to extend the
// lifetime of it to the other side of the co_await!
safe_void_coroutine TerminalPage::_ControlNoticeRaisedHandler(const IInspectable /*sender*/,
@@ -3407,13 +3413,13 @@ namespace winrt::TerminalApp::implementation
void TerminalPage::_WindowSizeChanged(const IInspectable sender, const Microsoft::Terminal::Control::WindowSizeChangedEventArgs args)
{
// Raise if:
// - Not in docked mode
// - Not in quake mode
// - Not in fullscreen
// - Only one tab exists
// - Only one pane exists
// else:
// - Reset conpty to its original size back
if (!_currentWindowSettings().DockWindow() && !Fullscreen() &&
if (!WindowProperties().IsQuakeWindow() && !Fullscreen() &&
NumberOfTabs() == 1 && _GetFocusedTabImpl()->GetLeafPaneCount() == 1)
{
WindowSizeChanged.raise(*this, args);
@@ -3597,7 +3603,7 @@ namespace winrt::TerminalApp::implementation
{
// Don't need to worry about duplicating or anything - we'll
// serialize the actual profile's GUID along with the content guid.
const auto& profile = _settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings());
const auto& profile = _settings.GetProfileForArgs(newTerminalArgs);
const auto control = _AttachControlToContent(newTerminalArgs.ContentId());
auto paneContent{ winrt::make<TerminalPaneContent>(profile, _terminalSettingsCache, control) };
return std::make_shared<Pane>(paneContent);
@@ -3613,7 +3619,7 @@ namespace winrt::TerminalApp::implementation
{
// TODO GH#5047 If we cache the NewTerminalArgs, we no longer need to do this.
profile = GetClosestProfileForDuplicationOfProfile(profile);
controlSettings = Settings::TerminalSettings::CreateWithProfile(_settings, profile, _currentWindowSettings());
controlSettings = Settings::TerminalSettings::CreateWithProfile(_settings, profile);
const auto workingDirectory = tabImpl->GetActiveTerminalControl().WorkingDirectory();
const auto validWorkingDirectory = !workingDirectory.empty();
if (validWorkingDirectory)
@@ -3624,8 +3630,8 @@ namespace winrt::TerminalApp::implementation
}
if (!profile)
{
profile = _settings.GetProfileForArgs(newTerminalArgs, _currentWindowSettings());
controlSettings = Settings::TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, _currentWindowSettings());
profile = _settings.GetProfileForArgs(newTerminalArgs);
controlSettings = Settings::TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs);
}
// Try to handle auto-elevation
@@ -3802,7 +3808,13 @@ namespace winrt::TerminalApp::implementation
// for nulls
if (const auto& connection{ _duplicateConnectionForRestart(paneContent) })
{
paneContent.GetTermControl().Connection(connection);
// Reset the terminal's VT state before attaching the new connection.
// The previous client may have left dirty modes (e.g., bracketed
// paste, mouse tracking, alternate buffer, kitty keyboard) that
// would corrupt input/output for the new shell process.
const auto& termControl = paneContent.GetTermControl();
termControl.HardResetWithoutErase();
termControl.Connection(connection);
connection.Start();
}
}
@@ -3816,7 +3828,7 @@ namespace winrt::TerminalApp::implementation
// - <none>
void TerminalPage::_SetBackgroundImage(const winrt::Microsoft::Terminal::Settings::Model::IAppearanceConfig& newAppearance)
{
if (!_currentWindowSettings().UseBackgroundImageForWindow())
if (!_settings.GlobalSettings().UseBackgroundImageForWindow())
{
_tabContent.Background(nullptr);
return;
@@ -3887,7 +3899,7 @@ namespace winrt::TerminalApp::implementation
// updating terminal panes, so that we don't have to build a _new_
// TerminalSettings for every profile we update - we can just look them
// up the previous ones we built.
_terminalSettingsCache->Reset(_settings, _currentWindowSettings());
_terminalSettingsCache->Reset(_settings);
for (const auto& tab : _tabs)
{
@@ -3925,23 +3937,17 @@ namespace winrt::TerminalApp::implementation
// Reload the current value of alwaysOnTop from the settings file. This
// will let the user hot-reload this setting, but any runtime changes to
// the alwaysOnTop setting will be lost.
_isAlwaysOnTop = _currentWindowSettings().AlwaysOnTop();
_isAlwaysOnTop = _settings.GlobalSettings().AlwaysOnTop();
AlwaysOnTopChanged.raise(*this, nullptr);
_showTabsFullscreen = _currentWindowSettings().ShowTabsFullscreen();
_showTabsFullscreen = _settings.GlobalSettings().ShowTabsFullscreen();
// Settings AllowDependentAnimations will affect whether animations are
// enabled application-wide, so we don't need to check it each time we
// want to create an animation.
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_currentWindowSettings().DisableAnimations());
WUX::Media::Animation::Timeline::AllowDependentAnimations(!_settings.GlobalSettings().DisableAnimations());
_tabRow.ShowElevationShield(IsRunningElevated() && _currentWindowSettings().ShowAdminShield());
// Apply the ShowWindowsButton theme setting.
if (const auto theme = _settings.GlobalSettings().CurrentTheme(_currentWindowSettings()))
{
_tabRow.ShowWindowsButton(theme.Window() ? theme.Window().ShowWindowsButton() : true);
}
_tabRow.ShowElevationShield(IsRunningElevated() && _settings.GlobalSettings().ShowAdminShield());
Media::SolidColorBrush transparent{ Windows::UI::Colors::Transparent() };
_tabView.Background(transparent);
@@ -3962,7 +3968,7 @@ namespace winrt::TerminalApp::implementation
// our TabView, to match the tab.showCloseButton property in the theme.
//
// Also update every tab's individual IsClosable to match the same property.
const auto theme = _settings.GlobalSettings().CurrentTheme(_currentWindowSettings());
const auto theme = _settings.GlobalSettings().CurrentTheme();
const auto visibility = (theme && theme.Tab()) ?
theme.Tab().ShowCloseButton() :
Settings::Model::TabCloseButtonVisibility::Always;
@@ -4576,7 +4582,7 @@ namespace winrt::TerminalApp::implementation
// - <none>
void TerminalPage::_UpdateTeachingTipTheme(winrt::Windows::UI::Xaml::FrameworkElement element)
{
auto theme{ _settings.GlobalSettings().CurrentTheme(_currentWindowSettings()) };
auto theme{ _settings.GlobalSettings().CurrentTheme() };
auto requestedTheme{ theme.RequestedTheme() };
while (element)
{
@@ -4729,7 +4735,7 @@ namespace winrt::TerminalApp::implementation
{
if (profile == _settings.ProfileDefaults())
{
return _settings.FindProfile(_currentWindowSettings().DefaultProfile());
return _settings.FindProfile(_settings.GlobalSettings().DefaultProfile());
}
return profile;
}
@@ -4950,7 +4956,7 @@ namespace winrt::TerminalApp::implementation
return;
}
const auto theme = _settings.GlobalSettings().CurrentTheme(_currentWindowSettings());
const auto theme = _settings.GlobalSettings().CurrentTheme();
auto requestedTheme{ theme.RequestedTheme() };
{
@@ -4994,7 +5000,7 @@ namespace winrt::TerminalApp::implementation
theme.TabRow().UnfocusedBackground()) :
ThemeColor{ nullptr } };
if (_currentWindowSettings().UseAcrylicInTabRow())
if (_settings.GlobalSettings().UseAcrylicInTabRow() && (_activated || _settings.GlobalSettings().EnableUnfocusedAcrylic()))
{
if (tabRowBg)
{
@@ -5024,7 +5030,7 @@ namespace winrt::TerminalApp::implementation
TitlebarBrush(backgroundSolidBrush);
}
if (!_currentWindowSettings().ShowTabsInTitlebar())
if (!_settings.GlobalSettings().ShowTabsInTitlebar())
{
_tabRow.Background(TitlebarBrush());
}
@@ -5260,7 +5266,7 @@ namespace winrt::TerminalApp::implementation
// Feature_ShellCompletions::IsEnabled back in _RegisterTerminalEvents
// User must explicitly opt-in on Preview builds
if (!_currentWindowSettings().EnableShellCompletionMenu())
if (!_settings.GlobalSettings().EnableShellCompletionMenu())
{
co_return;
}
@@ -5583,199 +5589,6 @@ namespace winrt::TerminalApp::implementation
}
}
// Rebuild the workspace flyout contents. Called every time the flyout opens
// so it reflects the current set of persisted workspaces.
void TerminalPage::_PopulateWorkspaceFlyout()
{
if (!_workspaceFlyout)
{
return;
}
_workspaceFlyout.Items().Clear();
// --- "Name / Rename this window" ---
{
MenuFlyoutItem item{};
item.Text(winrt::hstring{ _WindowProperties.WindowName().empty() ? L"Name this window\u2026" : L"Rename this window\u2026" });
auto iconElement = UI::IconPathConverter::IconWUX(L"\uE8AC"); // Rename glyph
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);
item.Click([weakThis{ get_weak() }](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
// Re-use the existing openWindowRenamer action.
page->_actionDispatch->DoAction(ActionAndArgs{ ShortcutAction::OpenWindowRenamer, nullptr });
}
});
_workspaceFlyout.Items().Append(item);
}
// --- "Save workspace" ---
{
MenuFlyoutItem item{};
item.Text(winrt::hstring{ L"Save workspace" });
auto iconElement = UI::IconPathConverter::IconWUX(L"\uE74E"); // Save glyph
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);
// Only enable if the window has a name.
item.IsEnabled(!_WindowProperties.WindowName().empty());
item.Click([weakThis{ get_weak() }](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
page->_actionDispatch->DoAction(ActionAndArgs{ ShortcutAction::SaveWorkspace, nullptr });
}
});
_workspaceFlyout.Items().Append(item);
}
// --- Gather open window info first so we can filter workspaces ---
// Ask the host (via AppHost → WindowEmperor) for all live windows.
const auto windowListReq{ winrt::make<WindowListRequest>() };
RequestWindowList.raise(*this, windowListReq);
const auto windowEntries = windowListReq.WindowEntries();
// Collect the names of all currently-open windows so we can hide
// workspaces that are already live from the saved-workspaces list.
std::set<winrt::hstring> openWindowNames;
if (windowEntries)
{
for (const auto& entry : windowEntries)
{
const std::wstring_view entryView{ entry };
const auto tabPos = entryView.find(L'\t');
if (tabPos != std::wstring_view::npos)
{
const auto namePart = entryView.substr(tabPos + 1);
if (!namePart.empty())
{
openWindowNames.emplace(namePart);
}
}
}
}
// --- Saved workspaces section (only those not currently open) ---
const auto workspaces = ApplicationState::SharedInstance().AllPersistedWorkspaces();
if (workspaces && workspaces.Size() > 0)
{
bool addedSeparator = false;
for (const auto& pair : workspaces)
{
const auto name = pair.Key();
// Skip workspaces that correspond to a currently-open window.
if (openWindowNames.count(name))
{
continue;
}
if (!addedSeparator)
{
_workspaceFlyout.Items().Append(MenuFlyoutSeparator{});
addedSeparator = true;
}
MenuFlyoutItem item{};
item.Text(name);
auto iconElement = UI::IconPathConverter::IconWUX(L"\uE8F1"); // SwitchApps glyph
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);
item.Click([weakThis{ get_weak() }, name](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
page->_OpenWorkspaceWindow(name);
}
});
_workspaceFlyout.Items().Append(item);
}
}
// --- Open windows section ---
if (windowEntries && windowEntries.Size() > 0)
{
_workspaceFlyout.Items().Append(MenuFlyoutSeparator{});
const auto thisWindowId = _WindowProperties.WindowId();
for (const auto& entry : windowEntries)
{
// Each entry is formatted as "id\tname"
const std::wstring_view entryView{ entry };
const auto tabPos = entryView.find(L'\t');
if (tabPos == std::wstring_view::npos)
{
continue;
}
uint64_t id = 0;
const auto idPart = entryView.substr(0, tabPos);
for (const auto ch : idPart)
{
if (ch >= L'0' && ch <= L'9')
{
id = id * 10 + (ch - L'0');
}
}
const auto namePart = entryView.substr(tabPos + 1);
// Build display text like "#1: MyWindow" or "#2: <unnamed>"
winrt::hstring displayText;
if (namePart.empty())
{
displayText = winrt::hstring{ fmt::format(FMT_COMPILE(L"#{} (unnamed)"), id) };
}
else
{
displayText = winrt::hstring{ fmt::format(FMT_COMPILE(L"#{}: {}"), id, namePart) };
}
MenuFlyoutItem item{};
item.Text(displayText);
// Use a different glyph for the current window
if (id == thisWindowId)
{
auto iconElement = UI::IconPathConverter::IconWUX(L"\uE73E"); // CheckMark glyph
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);
item.IsEnabled(false); // Can't summon yourself
}
else
{
auto iconElement = UI::IconPathConverter::IconWUX(L"\uE737"); // ChromeRestore glyph
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);
// Click handler: summon the target window by ID.
// We raise SummonWindowByIdRequested which is handled by
// AppHost to directly summon the window without creating
// a new tab (unlike _OpenWorkspaceWindow which launches
// `wt -w <name>` and creates a tab).
item.Click([weakThis{ get_weak() }, id](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
page->SummonWindowByIdRequested.raise(*page, winrt::make<SummonWindowByIdRequestedArgs>(id));
}
});
}
_workspaceFlyout.Items().Append(item);
}
}
}
// Handler for our WindowProperties's PropertyChanged event. We'll use this
// to pop the "Identify Window" toast when the user renames our window.
void TerminalPage::_windowPropertyChanged(const IInspectable& /*sender*/, const WUX::Data::PropertyChangedEventArgs& args)
@@ -5785,10 +5598,6 @@ namespace winrt::TerminalApp::implementation
return;
}
// Keep the workspace dropdown label in sync with the window name.
// Use raw WindowName() so clearing the name hides the text.
_tabRow.WorkspaceName(_WindowProperties.WindowName());
// DON'T display the confirmation if this is the name we were
// given on startup!
if (_startupState == StartupState::Initialized)

View File

@@ -10,10 +10,8 @@
#include "AppKeyBindings.h"
#include "AppCommandlineArgs.h"
#include "RenameWindowRequestedArgs.g.h"
#include "SummonWindowByIdRequestedArgs.g.h"
#include "RequestMoveContentArgs.g.h"
#include "LaunchPositionRequest.g.h"
#include "WindowListRequest.g.h"
#include "Toast.h"
#include "WindowsPackageManagerFactory.h"
@@ -65,15 +63,6 @@ namespace winrt::TerminalApp::implementation
_ProposedName{ name } {};
};
struct SummonWindowByIdRequestedArgs : SummonWindowByIdRequestedArgsT<SummonWindowByIdRequestedArgs>
{
WINRT_PROPERTY(uint64_t, WindowId);
public:
SummonWindowByIdRequestedArgs(uint64_t id) :
_WindowId{ id } {};
};
struct RequestMoveContentArgs : RequestMoveContentArgsT<RequestMoveContentArgs>
{
WINRT_PROPERTY(winrt::hstring, Window);
@@ -95,17 +84,6 @@ namespace winrt::TerminalApp::implementation
til::property<winrt::Microsoft::Terminal::Settings::Model::LaunchPosition> Position;
};
struct WindowListRequest : WindowListRequestT<WindowListRequest>
{
WindowListRequest() :
_WindowEntries{ winrt::single_threaded_vector<winrt::hstring>() } {}
winrt::Windows::Foundation::Collections::IVector<winrt::hstring> WindowEntries() const { return _WindowEntries; }
private:
winrt::Windows::Foundation::Collections::IVector<winrt::hstring> _WindowEntries;
};
struct WinGetSearchParams
{
winrt::Microsoft::Management::Deployment::PackageMatchField Field;
@@ -144,7 +122,6 @@ namespace winrt::TerminalApp::implementation
safe_void_coroutine RequestQuit();
safe_void_coroutine CloseWindow();
winrt::Microsoft::Terminal::Settings::Model::WindowLayout GetWindowLayout();
void PersistState();
std::vector<IPaneContent> Panes() const;
@@ -215,7 +192,6 @@ namespace winrt::TerminalApp::implementation
til::typed_event<IInspectable, IInspectable> IdentifyWindowsRequested;
til::typed_event<IInspectable, winrt::TerminalApp::RenameWindowRequestedArgs> RenameWindowRequested;
til::typed_event<IInspectable, IInspectable> SummonWindowRequested;
til::typed_event<IInspectable, winrt::TerminalApp::SummonWindowByIdRequestedArgs> SummonWindowByIdRequested;
til::typed_event<IInspectable, winrt::Microsoft::Terminal::Control::WindowSizeChangedEventArgs> WindowSizeChanged;
til::typed_event<IInspectable, IInspectable> OpenSystemMenu;
@@ -227,7 +203,6 @@ namespace winrt::TerminalApp::implementation
til::typed_event<Windows::Foundation::IInspectable, winrt::TerminalApp::RequestReceiveContentArgs> RequestReceiveContent;
til::typed_event<IInspectable, winrt::TerminalApp::LaunchPositionRequest> RequestLaunchPosition;
til::typed_event<IInspectable, winrt::TerminalApp::WindowListRequest> RequestWindowList;
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, TitlebarBrush, PropertyChanged.raise, nullptr);
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, FrameBrush, PropertyChanged.raise, nullptr);
@@ -250,7 +225,6 @@ namespace winrt::TerminalApp::implementation
TerminalApp::TabRowControl _tabRow{ nullptr };
Windows::UI::Xaml::Controls::Grid _tabContent{ nullptr };
Microsoft::UI::Xaml::Controls::SplitButton _newTabButton{ nullptr };
Windows::UI::Xaml::Controls::MenuFlyout _workspaceFlyout{ nullptr };
winrt::TerminalApp::ColorPickupFlyout _tabColorPicker{ nullptr };
Microsoft::Terminal::Settings::Model::CascadiaSettings _settings{ nullptr };
@@ -309,8 +283,6 @@ namespace winrt::TerminalApp::implementation
TerminalApp::ContentManager _manager{ nullptr };
Microsoft::Terminal::Settings::Model::WindowSettings _currentWindowSettings() const;
std::shared_ptr<TerminalSettingsCache> _terminalSettingsCache{};
struct StashedDragData
@@ -352,7 +324,6 @@ namespace winrt::TerminalApp::implementation
void _restartPaneConnection(const TerminalApp::TerminalPaneContent&, const winrt::Windows::Foundation::IInspectable&);
safe_void_coroutine _OpenNewWindow(const Microsoft::Terminal::Settings::Model::INewContentArgs newContentArgs);
safe_void_coroutine _OpenWorkspaceWindow(const winrt::hstring name);
void _OpenNewTerminalViaDropdown(const Microsoft::Terminal::Settings::Model::NewTerminalArgs newTerminalArgs);
@@ -441,7 +412,7 @@ namespace winrt::TerminalApp::implementation
const Microsoft::Terminal::Settings::Model::SplitDirection splitType,
const float splitSize,
std::shared_ptr<Pane> newPane);
void _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
bool _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
void _ToggleSplitOrientation();
void _ScrollPage(ScrollDirection scrollDirection);
@@ -451,8 +422,9 @@ namespace winrt::TerminalApp::implementation
safe_void_coroutine _PasteFromClipboardHandler(const IInspectable sender,
const Microsoft::Terminal::Control::PasteFromClipboardEventArgs eventArgs);
void _OpenHyperlinkHandler(const IInspectable sender, const Microsoft::Terminal::Control::OpenHyperlinkEventArgs eventArgs);
bool _IsUriSupported(const winrt::Windows::Foundation::Uri& parsedUri);
safe_void_coroutine _OpenHyperlinkHandler(const IInspectable sender, const Microsoft::Terminal::Control::OpenHyperlinkEventArgs eventArgs);
static bool _IsUriSupported(const winrt::Windows::Foundation::Uri& parsedUri);
bool _IsUriConsideredSomewhatSafe(const winrt::Windows::Foundation::Uri& parsedUri) const;
void _ShowCouldNotOpenDialog(winrt::hstring reason, winrt::hstring uri);
bool _CopyText(bool dismissSelection, bool singleLine, bool withControlSequences, Microsoft::Terminal::Control::CopyFormat formats);
@@ -591,7 +563,6 @@ namespace winrt::TerminalApp::implementation
void _PopulateContextMenu(const Microsoft::Terminal::Control::TermControl& control, const Microsoft::UI::Xaml::Controls::CommandBarFlyout& sender, const bool withSelection);
void _PopulateQuickFixMenu(const Microsoft::Terminal::Control::TermControl& control, const Windows::UI::Xaml::Controls::MenuFlyout& sender);
void _PopulateWorkspaceFlyout();
winrt::Windows::UI::Xaml::Controls::MenuFlyout _CreateRunAsAdminFlyout(int profileIndex);
winrt::Microsoft::Terminal::Control::TermControl _senderOrActiveControl(const winrt::Windows::Foundation::IInspectable& sender);

View File

@@ -19,10 +19,6 @@ namespace TerminalApp
{
String ProposedName { get; };
};
[default_interface] runtimeclass SummonWindowByIdRequestedArgs
{
UInt64 WindowId { get; };
};
[default_interface] runtimeclass RequestMoveContentArgs
{
String Window { get; };
@@ -45,6 +41,8 @@ namespace TerminalApp
String VirtualWorkingDirectory { get; set; };
String VirtualEnvVars { get; set; };
Boolean IsQuakeWindow();
};
runtimeclass LaunchPositionRequest
@@ -52,14 +50,6 @@ namespace TerminalApp
Microsoft.Terminal.Settings.Model.LaunchPosition Position;
}
// Raised by TerminalPage when it needs the list of open windows.
// The handler (AppHost) fills WindowNames synchronously.
[default_interface] runtimeclass WindowListRequest
{
// Each entry is "id\tname" (name may be empty for unnamed windows).
Windows.Foundation.Collections.IVector<String> WindowEntries { get; };
}
[default_interface] runtimeclass TerminalPage : Windows.UI.Xaml.Controls.Page, Windows.UI.Xaml.Data.INotifyPropertyChanged, Microsoft.Terminal.UI.IDirectKeyListener
{
TerminalPage(WindowProperties properties, ContentManager manager);
@@ -103,7 +93,6 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, Object> IdentifyWindowsRequested;
event Windows.Foundation.TypedEventHandler<Object, RenameWindowRequestedArgs> RenameWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, SummonWindowByIdRequestedArgs> SummonWindowByIdRequested;
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.WindowSizeChangedEventArgs> WindowSizeChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
@@ -114,6 +103,5 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, RequestReceiveContentArgs> RequestReceiveContent;
event Windows.Foundation.TypedEventHandler<Object, LaunchPositionRequest> RequestLaunchPosition;
event Windows.Foundation.TypedEventHandler<Object, WindowListRequest> RequestWindowList;
}
}

View File

@@ -144,17 +144,17 @@
</TextBlock>
</ContentDialog>
<ContentDialog x:Name="CouldNotOpenUriDialog"
x:Uid="CouldNotOpenUriDialog"
<ContentDialog x:Name="UriErrorDialog"
x:Uid="UriErrorDialog"
Grid.Row="2"
x:Load="False"
DefaultButton="Primary">
DefaultButton="Close">
<TextBlock IsTextSelectionEnabled="True"
TextWrapping="WrapWholeWords">
<TextBlock.ContextFlyout>
<mtu:TextMenuFlyout />
</TextBlock.ContextFlyout>
<Run x:Name="CouldNotOpenUriReason" /> <LineBreak />
<Run x:Name="CouldNotOpenUriReason" /> <LineBreak /> <LineBreak />
<Run x:Name="UnopenedUri"
FontFamily="Cascadia Mono" />
</TextBlock>

View File

@@ -18,9 +18,9 @@ namespace winrt::TerminalApp::implementation
result.UnfocusedSettings().try_as(_unfocusedSettings);
}
TerminalSettingsCache::TerminalSettingsCache(const MTSM::CascadiaSettings& settings, const MTSM::WindowSettings& windowSettings)
TerminalSettingsCache::TerminalSettingsCache(const MTSM::CascadiaSettings& settings)
{
Reset(settings, windowSettings);
Reset(settings);
}
std::optional<TerminalSettingsPair> TerminalSettingsCache::TryLookup(const MTSM::Profile& profile)
@@ -35,7 +35,7 @@ namespace winrt::TerminalApp::implementation
auto& pair{ found->second };
if (!pair.second)
{
pair.second = winrt::Microsoft::Terminal::Settings::TerminalSettings::CreateWithProfile(_settings, pair.first, _windowSettings);
pair.second = winrt::Microsoft::Terminal::Settings::TerminalSettings::CreateWithProfile(_settings, pair.first);
}
return std::optional{ TerminalSettingsPair{ *pair.second } };
}
@@ -43,10 +43,9 @@ namespace winrt::TerminalApp::implementation
return std::nullopt;
}
void TerminalSettingsCache::Reset(const MTSM::CascadiaSettings& settings, const MTSM::WindowSettings& windowSettings)
void TerminalSettingsCache::Reset(const MTSM::CascadiaSettings& settings)
{
_settings = settings;
_windowSettings = windowSettings;
// Mapping by GUID isn't _excellent_ because the defaults profile doesn't have a stable GUID; however,
// when we stabilize its guid this will become fully safe.

View File

@@ -38,13 +38,12 @@ namespace winrt::TerminalApp::implementation
struct TerminalSettingsCache
{
TerminalSettingsCache(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings, const Microsoft::Terminal::Settings::Model::WindowSettings& windowSettings);
TerminalSettingsCache(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings);
std::optional<TerminalSettingsPair> TryLookup(const Microsoft::Terminal::Settings::Model::Profile& profile);
void Reset(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings, const Microsoft::Terminal::Settings::Model::WindowSettings& windowSettings);
void Reset(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings);
private:
Microsoft::Terminal::Settings::Model::CascadiaSettings _settings{ nullptr };
Microsoft::Terminal::Settings::Model::WindowSettings _windowSettings{ nullptr };
std::unordered_map<winrt::guid, std::pair<Microsoft::Terminal::Settings::Model::Profile, std::optional<winrt::Microsoft::Terminal::Settings::TerminalSettingsCreateResult>>> profileGuidSettingsMap;
};
}

View File

@@ -232,7 +232,7 @@ namespace winrt::TerminalApp::implementation
// that the window size is _first_ set up as something sensible, so
// leaving fullscreen returns to a reasonable size.
const auto launchMode = this->GetLaunchMode();
if (WI_IsFlagSet(launchMode, LaunchMode::FocusMode))
if (_WindowProperties->IsQuakeWindow() || WI_IsFlagSet(launchMode, LaunchMode::FocusMode))
{
_root->SetFocusMode(true);
}
@@ -244,7 +244,7 @@ namespace winrt::TerminalApp::implementation
_root->Maximized(true);
}
if (WI_IsFlagSet(launchMode, LaunchMode::FullscreenMode))
if (WI_IsFlagSet(launchMode, LaunchMode::FullscreenMode) && !_WindowProperties->IsQuakeWindow())
{
_root->SetFullscreen(true);
}
@@ -252,15 +252,6 @@ namespace winrt::TerminalApp::implementation
AppLogic::Current()->NotifyRootInitialized();
}
WindowLayout TerminalWindow::GetWindowLayout()
{
if (_root)
{
return _root->GetWindowLayout();
}
return nullptr;
}
void TerminalWindow::PersistState()
{
if (_root)
@@ -276,22 +267,22 @@ namespace winrt::TerminalApp::implementation
bool TerminalWindow::GetShowTabsInTitlebar()
{
return _currentWindowSettings().ShowTabsInTitlebar();
return _settings.GlobalSettings().ShowTabsInTitlebar();
}
bool TerminalWindow::GetInitialAlwaysOnTop()
{
return _currentWindowSettings().AlwaysOnTop();
return _settings.GlobalSettings().AlwaysOnTop();
}
bool TerminalWindow::GetInitialShowTabsFullscreen()
{
return _currentWindowSettings().ShowTabsFullscreen();
return _settings.GlobalSettings().ShowTabsFullscreen();
}
bool TerminalWindow::GetMinimizeToNotificationArea()
{
return _currentWindowSettings().MinimizeToNotificationArea();
return _settings.GlobalSettings().MinimizeToNotificationArea();
}
bool TerminalWindow::GetAlwaysShowNotificationIcon()
@@ -301,12 +292,12 @@ namespace winrt::TerminalApp::implementation
bool TerminalWindow::GetShowTitleInTitlebar()
{
return _currentWindowSettings().ShowTitleInTitlebar();
return _settings.GlobalSettings().ShowTitleInTitlebar();
}
Microsoft::Terminal::Settings::Model::Theme TerminalWindow::Theme()
{
return _settings.GlobalSettings().CurrentTheme(_currentWindowSettings());
return _settings.GlobalSettings().CurrentTheme();
}
// WinUI can't show 2 dialogs simultaneously. Yes, really. If you do, you get an exception.
@@ -383,7 +374,7 @@ namespace winrt::TerminalApp::implementation
auto themingLambda{ [weak](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
if (const auto strong = weak.get())
{
auto theme{ strong->_settings.GlobalSettings().CurrentTheme(strong->_currentWindowSettings()) };
auto theme{ strong->_settings.GlobalSettings().CurrentTheme() };
auto requestedTheme{ theme.RequestedTheme() };
auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
while (element)
@@ -607,7 +598,7 @@ namespace winrt::TerminalApp::implementation
// --focusMode on the commandline here, and the mode in the settings.
// Below, we'll also account for if focus mode was persisted into the
// session for restoration.
bool focusMode = _appArgs && _appArgs->ParsedArgs().GetLaunchMode().value_or(_currentWindowSettings().LaunchMode()) == LaunchMode::FocusMode;
bool focusMode = _appArgs && _appArgs->ParsedArgs().GetLaunchMode().value_or(_settings.GlobalSettings().LaunchMode()) == LaunchMode::FocusMode;
const auto scale = static_cast<float>(dpi) / static_cast<float>(USER_DEFAULT_SCREEN_DPI);
if (const auto layout = LoadPersistedLayout())
@@ -630,7 +621,7 @@ namespace winrt::TerminalApp::implementation
if ((_appArgs && _appArgs->ParsedArgs().GetSize().has_value()) || (proposedSize.Width == 0 && proposedSize.Height == 0))
{
// Use the default profile to determine how big of a window we need.
const auto settings{ Settings::TerminalSettings::CreateWithNewTerminalArgs(_settings, nullptr, _currentWindowSettings()) };
const auto settings{ Settings::TerminalSettings::CreateWithNewTerminalArgs(_settings, nullptr) };
const til::size emptySize{};
const auto commandlineSize = _appArgs ? _appArgs->ParsedArgs().GetSize().value_or(emptySize) : til::size{};
@@ -654,7 +645,7 @@ namespace winrt::TerminalApp::implementation
// GH#2061 - If the global setting "Always show tab bar" is
// set or if "Show tabs in title bar" is set, then we'll need to add
// the height of the tab bar here.
if (_currentWindowSettings().ShowTabsInTitlebar() && !focusMode)
if (_settings.GlobalSettings().ShowTabsInTitlebar() && !focusMode)
{
// In the past, we used to actually instantiate a TitlebarControl
// and use Measure() to determine the DesiredSize of the control, to
@@ -672,7 +663,7 @@ namespace winrt::TerminalApp::implementation
static constexpr auto titlebarHeight = 40;
proposedSize.Height += (titlebarHeight)*scale;
}
else if (_currentWindowSettings().AlwaysShowTabs() && !focusMode)
else if (_settings.GlobalSettings().AlwaysShowTabs() && !focusMode)
{
// Same comment as above, but with a TabRowControl.
//
@@ -705,7 +696,7 @@ namespace winrt::TerminalApp::implementation
// GH#4620/#5801 - If the user passed --maximized or --fullscreen on the
// commandline, then use that to override the value from the settings.
const auto valueFromSettings = _currentWindowSettings().LaunchMode();
const auto valueFromSettings = _settings.GlobalSettings().LaunchMode();
const auto valueFromCommandlineArgs = _appArgs ? _appArgs->ParsedArgs().GetLaunchMode() : std::nullopt;
if (const auto layout = LoadPersistedLayout())
{
@@ -731,7 +722,7 @@ namespace winrt::TerminalApp::implementation
// - a point containing the requested initial position in pixels.
TerminalApp::InitialPosition TerminalWindow::GetInitialPosition(int64_t defaultInitialX, int64_t defaultInitialY)
{
auto initialPosition{ _currentWindowSettings().InitialPosition() };
auto initialPosition{ _settings.GlobalSettings().InitialPosition() };
if (const auto layout = LoadPersistedLayout())
{
@@ -779,15 +770,10 @@ namespace winrt::TerminalApp::implementation
return !_contentBounds &&
!hadPersistedPosition &&
_currentWindowSettings().CenterOnLaunch() &&
_settings.GlobalSettings().CenterOnLaunch() &&
(_appArgs && !_appArgs->ParsedArgs().GetPosition().has_value());
}
Microsoft::Terminal::Settings::Model::Docking TerminalWindow::Docking()
{
return _currentWindowSettings().DockWindow();
}
// Method Description:
// - See Pane::CalcSnappedDimension
float TerminalWindow::CalcSnappedDimension(const bool widthOrHeight, const float dimension) const
@@ -1111,11 +1097,6 @@ namespace winrt::TerminalApp::implementation
_initialContentArgs = wil::to_vector(args);
}
void TerminalWindow::SetPersistedLayout(const winrt::Microsoft::Terminal::Settings::Model::WindowLayout& layout)
{
_cachedLayout = layout;
}
// Method Description:
// - Parse the provided commandline arguments into actions, and try to
// perform them immediately.
@@ -1207,7 +1188,7 @@ namespace winrt::TerminalApp::implementation
bool TerminalWindow::AutoHideWindow()
{
return _currentWindowSettings().AutoHideWindow();
return _settings.GlobalSettings().AutoHideWindow();
}
void TerminalWindow::UpdateSettingsHandler(const winrt::IInspectable& /*sender*/,
@@ -1226,22 +1207,21 @@ namespace winrt::TerminalApp::implementation
void TerminalWindow::WindowName(const winrt::hstring& name)
{
const auto oldName = _WindowProperties->WindowName();
const auto oldIsQuakeMode = _WindowProperties->IsQuakeWindow();
_WindowProperties->WindowName(name);
if (!_root || oldName == name)
if (!_root)
{
return;
}
// The window name determines which WindowSettings we use
// (via _currentWindowSettings()). Since it changed, refresh
// all downstream consumers of per-window settings:
// - TerminalPage (settings cache, tab/pane settings)
// - Theme (may differ per window)
// - Docking & host-level properties (via IsQuakeWindowChanged -> AppHost)
_root->SetSettings(_settings, true);
_RefreshThemeRoutine();
IsQuakeWindowChanged.raise(*this, nullptr);
const auto newIsQuakeMode = _WindowProperties->IsQuakeWindow();
if (newIsQuakeMode != oldIsQuakeMode)
{
// If we're entering Quake Mode from ~Focus Mode, then this will enter Focus Mode
// If we're entering Quake Mode from Focus Mode, then this will do nothing
// If we're leaving Quake Mode (we're already in Focus Mode), then this will do nothing
_root->SetFocusMode(true);
IsQuakeWindowChanged.raise(*this, nullptr);
}
}
void TerminalWindow::WindowId(const uint64_t& id)
{
@@ -1352,13 +1332,13 @@ namespace winrt::TerminalApp::implementation
if (!FocusMode())
{
if (!_currentWindowSettings().AlwaysShowTabs())
if (!_settings.GlobalSettings().AlwaysShowTabs())
{
// Hide the title bar = off, Always show tabs = off.
static constexpr auto titlebarHeight = 10;
pixelSize.Height += (titlebarHeight)*scale;
}
else if (!_currentWindowSettings().ShowTabsInTitlebar())
else if (!_settings.GlobalSettings().ShowTabsInTitlebar())
{
// Hide the title bar = off, Always show tabs = on.
static constexpr auto titlebarAndTabBarHeight = 40;
@@ -1439,9 +1419,9 @@ namespace winrt::TerminalApp::implementation
return _WindowName.empty() ? til::hstring_format(FMT_COMPILE(L"<{}>"), RS_(L"UnnamedWindowName")) : _WindowName;
}
WindowSettings TerminalWindow::_currentWindowSettings() const
bool WindowProperties::IsQuakeWindow() const noexcept
{
return _settings.WindowSettings(_WindowProperties->WindowName());
return _WindowName == L"_quake";
}
};

View File

@@ -44,6 +44,7 @@ namespace winrt::TerminalApp::implementation
void WindowId(const uint64_t& value);
winrt::hstring WindowIdForDisplay() const noexcept;
winrt::hstring WindowNameForDisplay() const noexcept;
bool IsQuakeWindow() const noexcept;
til::property_changed_event PropertyChanged;
@@ -70,7 +71,6 @@ namespace winrt::TerminalApp::implementation
void Create();
winrt::Microsoft::Terminal::Settings::Model::WindowLayout GetWindowLayout();
void PersistState();
void UpdateSettings(winrt::TerminalApp::SettingsLoadEventArgs args);
@@ -79,7 +79,6 @@ namespace winrt::TerminalApp::implementation
int32_t SetStartupCommandline(TerminalApp::CommandlineArgs args);
void SetStartupContent(const winrt::hstring& content, const Windows::Foundation::IReference<Windows::Foundation::Rect>& contentBounds);
void SetPersistedLayout(const winrt::Microsoft::Terminal::Settings::Model::WindowLayout& layout);
int32_t ExecuteCommandline(TerminalApp::CommandlineArgs args);
void SetSettingsStartupArgs(const std::vector<winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs>& actions);
@@ -135,12 +134,12 @@ namespace winrt::TerminalApp::implementation
void DismissDialog();
Microsoft::Terminal::Settings::Model::Theme Theme();
Microsoft::Terminal::Settings::Model::Docking Docking();
void UpdateSettingsHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::TerminalApp::SettingsLoadEventArgs& arg);
void WindowName(const winrt::hstring& value);
void WindowId(const uint64_t& value);
bool IsQuakeWindow() const noexcept { return _WindowProperties->IsQuakeWindow(); }
TerminalApp::WindowProperties WindowProperties() { return *_WindowProperties; }
void AttachContent(winrt::hstring content, uint32_t tabIndex);
@@ -188,8 +187,6 @@ namespace winrt::TerminalApp::implementation
TerminalApp::ContentManager _manager{ nullptr };
std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs> _initialContentArgs;
Microsoft::Terminal::Settings::Model::WindowSettings _currentWindowSettings() const;
void _ShowLoadErrorsDialog(const winrt::hstring& titleKey,
const winrt::hstring& contentKey,
HRESULT settingsLoadedResult,
@@ -224,7 +221,6 @@ namespace winrt::TerminalApp::implementation
FORWARDED_TYPED_EVENT(SetTaskbarProgress, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, SetTaskbarProgress);
FORWARDED_TYPED_EVENT(IdentifyWindowsRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, IdentifyWindowsRequested);
FORWARDED_TYPED_EVENT(SummonWindowRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, SummonWindowRequested);
FORWARDED_TYPED_EVENT(SummonWindowByIdRequested, Windows::Foundation::IInspectable, winrt::TerminalApp::SummonWindowByIdRequestedArgs, _root, SummonWindowByIdRequested);
FORWARDED_TYPED_EVENT(OpenSystemMenu, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, OpenSystemMenu);
FORWARDED_TYPED_EVENT(QuitRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, QuitRequested);
FORWARDED_TYPED_EVENT(ShowWindowChanged, Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Control::ShowWindowArgs, _root, ShowWindowChanged);
@@ -233,7 +229,6 @@ namespace winrt::TerminalApp::implementation
FORWARDED_TYPED_EVENT(RequestReceiveContent, Windows::Foundation::IInspectable, winrt::TerminalApp::RequestReceiveContentArgs, _root, RequestReceiveContent);
FORWARDED_TYPED_EVENT(RequestLaunchPosition, Windows::Foundation::IInspectable, winrt::TerminalApp::LaunchPositionRequest, _root, RequestLaunchPosition);
FORWARDED_TYPED_EVENT(RequestWindowList, Windows::Foundation::IInspectable, winrt::TerminalApp::WindowListRequest, _root, RequestWindowList);
#ifdef UNIT_TESTING
friend class TerminalAppLocalTests::CommandlineTest;

View File

@@ -55,13 +55,11 @@ namespace TerminalApp
Int32 SetStartupCommandline(CommandlineArgs args);
void SetStartupContent(String json, Windows.Foundation.IReference<Windows.Foundation.Rect> bounds);
void SetPersistedLayout(Microsoft.Terminal.Settings.Model.WindowLayout layout);
Int32 ExecuteCommandline(CommandlineArgs args);
Boolean ShouldImmediatelyHandoffToElevated();
void HandoffToElevated();
Microsoft.Terminal.Settings.Model.WindowLayout GetWindowLayout();
void PersistState();
Windows.UI.Xaml.UIElement GetRoot();
@@ -74,8 +72,6 @@ namespace TerminalApp
Boolean AlwaysOnTop { get; };
Boolean AutoHideWindow { get; };
Boolean ShowTabsFullscreen { get; };
Microsoft.Terminal.Settings.Model.Theme Theme { get; };
Microsoft.Terminal.Settings.Model.Docking Docking { get; };
void IdentifyWindow();
void SetPersistedLayoutIdx(UInt32 idx);
@@ -109,6 +105,7 @@ namespace TerminalApp
WindowProperties WindowProperties { get; };
void WindowName(String name);
void WindowId(UInt64 id);
Boolean IsQuakeWindow();
// See IDialogPresenter and TerminalPage's DialogPresenter for more
// information.
@@ -129,7 +126,6 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, Object> IdentifyWindowsRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> IsQuakeWindowChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, SummonWindowByIdRequestedArgs> SummonWindowByIdRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
event Windows.Foundation.TypedEventHandler<Object, Object> QuitRequested;
event Windows.Foundation.TypedEventHandler<Object, TerminalApp.SystemMenuChangeArgs> SystemMenuChangeRequested;
@@ -141,7 +137,6 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, RequestMoveContentArgs> RequestMoveContent;
event Windows.Foundation.TypedEventHandler<Object, RequestReceiveContentArgs> RequestReceiveContent;
event Windows.Foundation.TypedEventHandler<Object, LaunchPositionRequest> RequestLaunchPosition;
event Windows.Foundation.TypedEventHandler<Object, WindowListRequest> RequestWindowList;
void AttachContent(String content, UInt32 tabIndex);
void SendContentToOther(RequestReceiveContentArgs args);

View File

@@ -289,6 +289,11 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
}
}
if (unbox_prop_or<bool>(settings, L"ambiguousIsWide", false))
{
_flags |= PSEUDOCONSOLE_AMBIGUOUS_IS_WIDE;
}
const auto& initialEnvironment{ unbox_prop_or<winrt::hstring>(settings, L"initialEnvironment", L"") };
const bool reloadEnvironmentVariables = unbox_prop_or<bool>(settings, L"reloadEnvironmentVariables", false);

View File

@@ -85,6 +85,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
break;
}
CodepointWidthDetector::Singleton().Reset(mode);
if (settings.AmbiguousWidth() == AmbiguousWidth::Wide)
{
CodepointWidthDetector::Singleton().SetAmbiguousWidth(2);
}
return true;
}();
@@ -349,6 +355,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
}
void ControlCore::HardResetWithoutErase()
{
const auto lock = _terminal->LockForWriting();
_terminal->HardResetWithoutErase();
}
bool ControlCore::Initialize(const float actualWidth,
const float actualHeight,
const float compositionScale)
@@ -2069,7 +2081,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// the selection (we need to reset selection on double-click or
// triple-click, so it captures the word or the line, rather than
// extending the selection)
if (_terminal->IsSelectionActive() && (!shiftEnabled || isOnOriginalPosition))
// - GH#9608: VT mouse mode is enabled. In this mode, Shift is used
// to override mouse input, so Shift+Click should start a fresh
// selection rather than extending the previous one.
if (_terminal->IsSelectionActive() && (!shiftEnabled || isOnOriginalPosition || _terminal->IsTrackingMouseInput()))
{
// Reset the selection
_terminal->ClearSelection();

View File

@@ -257,6 +257,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
TerminalConnection::ITerminalConnection Connection();
void Connection(const TerminalConnection::ITerminalConnection& connection);
void HardResetWithoutErase();
void AnchorContextMenu(til::point viewportRelativeCharacterPosition);

View File

@@ -98,6 +98,7 @@ namespace Microsoft.Terminal.Control
void ApplyAppearance(Boolean focused);
Microsoft.Terminal.TerminalConnection.ITerminalConnection Connection;
void HardResetWithoutErase();
IControlSettings Settings { get; };
IControlAppearance FocusedAppearance { get; };

View File

@@ -54,6 +54,20 @@ namespace winrt::Microsoft::Terminal::Control::implementation
self->Attached.raise(*self, nullptr);
}
});
// GH#14464: Mark mode and quick-edit (shift+arrow) selections update
// the selection through ControlCore, bypassing SetEndSelectionPoint.
// Listen for selection changes so _selectionNeedsToBeCopied is set
// for ALL selection types, not just mouse drag.
_core->UpdateSelectionMarkers([weakThis = get_weak()](auto&&, auto&&) {
if (auto self{ weakThis.get() })
{
if (self->_core->HasSelection())
{
self->_selectionNeedsToBeCopied = true;
}
}
});
}
uint64_t ControlInteractivity::Id()
@@ -285,8 +299,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
const auto isOnOriginalPosition = _lastMouseClickPosNoSelection == pixelPosition;
// Rounded coordinates for text selection
_core->LeftClickOnTerminal(_getTerminalPosition(til::point{ pixelPosition }, true),
// Rounded coordinates for text selection.
// Don't round in VT mouse mode; cell-level precision matters more.
// Only round for single-click: for double/triple-click, rounding
// can push the position to the next cell, selecting the wrong word.
const auto round = multiClickMapper == 1 && !_core->IsVtMouseModeEnabled();
_core->LeftClickOnTerminal(_getTerminalPosition(til::point{ pixelPosition }, round),
multiClickMapper,
altEnabled,
shiftEnabled,
@@ -296,8 +314,15 @@ namespace winrt::Microsoft::Terminal::Control::implementation
if (_core->HasSelection())
{
// GH#9787: if selection is active we don't want to track the touchdown position
// so that dragging the mouse will extend the selection rather than starting the new one
_singleClickTouchdownPos = std::nullopt;
// so that dragging the mouse will extend the selection rather than starting the new one.
// In VT mouse mode, keep tracking the touchdown point so that PointerMoved
// can re-anchor the selection based on drag direction (the dx < 0 adjustment).
// Without this, dragging left wouldn't include the initially clicked cell
// because floored coordinates place the anchor on the cell's left edge.
if (!_core->IsVtMouseModeEnabled())
{
_singleClickTouchdownPos = std::nullopt;
}
}
}
else if (WI_IsFlagSet(buttonState, MouseButtonState::IsRightButtonDown))
@@ -314,13 +339,18 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
else
{
// Try to copy the text and clear the selection
const auto successfulCopy = CopySelectionToClipboard(shiftEnabled, false, _core->Settings().CopyFormatting());
// GH#19942, GH#14464: Don't re-copy a selection that was
// already copied via copyOnSelect on mouse-up. But DO copy
// if the selection was made via mark mode or modified with
// quick-edit keys (shift+arrow), since those paths never
// triggered an automatic copy.
const auto copied = (_selectionNeedsToBeCopied || !_core->CopyOnSelect()) &&
CopySelectionToClipboard(shiftEnabled, false, _core->Settings().CopyFormatting());
_core->ClearSelection();
if (_core->CopyOnSelect() || !successfulCopy)
if (_core->CopyOnSelect() || !copied)
{
// CopyOnSelect: right click always pastes!
// Otherwise: no selection --> paste
// CopyOnSelect: right-click always pastes.
// Otherwise: no selection paste.
RequestPasteTextFromClipboard();
}
}
@@ -682,7 +712,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - cursorPosition: in pixels, relative to the origin of the control
void ControlInteractivity::SetEndSelectionPoint(const Core::Point pixelPosition)
{
_core->SetEndSelectionPoint(_getTerminalPosition(til::point{ pixelPosition }, true));
// Don't round in VT mouse mode; cell-level precision matters more
const auto round = !_core->IsVtMouseModeEnabled();
_core->SetEndSelectionPoint(_getTerminalPosition(til::point{ pixelPosition }, round));
_selectionNeedsToBeCopied = true;
}

View File

@@ -26,6 +26,12 @@ namespace Microsoft.Terminal.Control
Console,
};
enum AmbiguousWidth
{
Narrow,
Wide,
};
enum DefaultInputScope
{
Default,

View File

@@ -68,6 +68,7 @@ namespace Microsoft.Terminal.Control
Boolean DisablePartialInvalidation { get; };
Boolean SoftwareRendering { get; };
Microsoft.Terminal.Control.TextMeasurement TextMeasurement { get; };
Microsoft.Terminal.Control.AmbiguousWidth AmbiguousWidth { get; };
Microsoft.Terminal.Control.DefaultInputScope DefaultInputScope { get; };
Boolean ShowMarks { get; };
Boolean UseBackgroundImageForWindow { get; };

View File

@@ -49,7 +49,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void InteractivityAutomationPeer::ParentProvider(AutomationPeer parentProvider)
{
_parentProvider = parentProvider;
// LOAD-BEARING: use _parentProvider->ProviderFromPeer(_parentProvider) instead of this->ProviderFromPeer(*this).
// Since we split the automation peer into TermControlAutomationPeer and InteractivityAutomationPeer,
// using "this" returns null. This can cause issues with some UIA Client scenarios like any navigation in Narrator.
_parentProvider = parentProvider ? parentProvider.as<IAutomationPeerProtected>().ProviderFromPeer(parentProvider) : nullptr;
}
// Method Description:
@@ -181,15 +184,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
XamlAutomation::ITextRangeProvider InteractivityAutomationPeer::_CreateXamlUiaTextRange(UIA::ITextRangeProvider* returnVal) const
{
// LOAD-BEARING: use _parentProvider->ProviderFromPeer(_parentProvider) instead of this->ProviderFromPeer(*this).
// Since we split the automation peer into TermControlAutomationPeer and InteractivityAutomationPeer,
// using "this" returns null. This can cause issues with some UIA Client scenarios like any navigation in Narrator.
const auto parent{ _parentProvider.get() };
if (!parent)
if (!_parentProvider)
{
return nullptr;
}
const auto xutr = winrt::make_self<XamlUiaTextRange>(returnVal, parent.as<IAutomationPeerProtected>().ProviderFromPeer(parent));
const auto xutr = winrt::make_self<XamlUiaTextRange>(returnVal, _parentProvider);
return xutr.as<XamlAutomation::ITextRangeProvider>();
};
@@ -201,22 +200,24 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - com_array of Xaml Wrapped UiaTextRange (ITextRangeProviders)
com_array<XamlAutomation::ITextRangeProvider> InteractivityAutomationPeer::WrapArrayOfTextRangeProviders(SAFEARRAY* textRanges)
{
if (!_parentProvider)
{
return {};
}
// transfer ownership of UiaTextRanges to this new vector
auto providers = SafeArrayToOwningVector<::Microsoft::Terminal::TermControlUiaTextRange>(textRanges);
auto count = gsl::narrow<int>(providers.size());
const auto len = gsl::narrow<uint32_t>(providers.size());
com_array<XamlAutomation::ITextRangeProvider> result{ len };
std::vector<XamlAutomation::ITextRangeProvider> vec;
vec.reserve(count);
for (auto i = 0; i < count; i++)
for (uint32_t i = 0; i < len; ++i)
{
if (auto xutr = _CreateXamlUiaTextRange(providers[i].detach()))
{
vec.emplace_back(std::move(xutr));
result[i] = std::move(xutr);
}
}
com_array<XamlAutomation::ITextRangeProvider> result{ vec };
return result;
}
}

View File

@@ -80,7 +80,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
::Microsoft::WRL::ComPtr<::Microsoft::Terminal::TermControlUiaProvider> _uiaProvider;
winrt::Microsoft::Terminal::Control::implementation::ControlInteractivity* _interactivity;
weak_ref<Windows::UI::Xaml::Automation::Peers::AutomationPeer> _parentProvider;
winrt::Windows::UI::Xaml::Automation::Provider::IRawElementProviderSimple _parentProvider{ nullptr };
til::rect _controlBounds{};
til::rect _controlPadding{};

View File

@@ -3,7 +3,7 @@
namespace Microsoft.Terminal.Control
{
[default_interface] runtimeclass InteractivityAutomationPeer :
Windows.UI.Xaml.Automation.Peers.AutomationPeer,
Windows.UI.Xaml.Automation.Peers.FrameworkElementAutomationPeer,
Windows.UI.Xaml.Automation.Provider.ITextProvider
{

View File

@@ -532,6 +532,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_core.Connection(newConnection);
}
void TermControl::HardResetWithoutErase()
{
_core.HardResetWithoutErase();
}
void TermControl::_throttledUpdateScrollbar(const ScrollBarUpdate& update)
{
if (!_initializedTerminal)
@@ -1790,6 +1795,16 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return true;
}
// While TSF has an active composition, key events must not be forwarded
// to the PTY directly. The IME re-injects navigation/confirmation keys
// after composition ends, at which point HasActiveComposition() == false
// and they are forwarded normally. This mirrors conhost v1 behavior in
// src/interactivity/win32/windowio.cpp.
if (GetTSFHandle().HasActiveComposition())
{
return true;
}
if (_TrySendKeyEvent(vkey, scanCode, modifiers, keyDown))
{
return true;
@@ -1920,8 +1935,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - args: event data
void TermControl::_TappedHandler(const IInspectable& /*sender*/, const TappedRoutedEventArgs& e)
{
Focus(FocusState::Pointer);
if (e.PointerDeviceType() == Windows::Devices::Input::PointerDeviceType::Touch)
{
// Normally TSF would be responsible for showing the touch keyboard, but it's buggy for us:
@@ -1955,7 +1968,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const auto point = args.GetCurrentPoint(*this);
const auto type = ptr.PointerDeviceType();
if (!_focused)
// GH#19908: _focused can be true even when the search box has
// keyboard focus, because GotFocus bubbles from the search box
// child and _GotFocusHandler sets _focused=true. If the user
// click-drags in the terminal while the search box is focused,
// we need to explicitly call Focus() to move keyboard focus back
// to the terminal so that Ctrl+C copies the selection.
if (!_focused || (_searchBox && _searchBox->ContainsFocus()))
{
Focus(FocusState::Pointer);
}
@@ -2501,9 +2520,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_updateScrollBar->Run(update);
// if a selection marker is already visible,
// update the position of those markers
if (SelectionStartMarker().Visibility() == Visibility::Visible || SelectionEndMarker().Visibility() == Visibility::Visible)
// If we have a selection with markers (exposed via selection mode),
// update the position of the markers
if (_core.HasSelection() && _core.SelectionMode() >= SelectionInteractionMode::Keyboard)
{
_updateSelectionMarkers(nullptr, winrt::make<UpdateSelectionMarkersEventArgs>(false));
}
@@ -3067,6 +3086,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
co_return;
}
if (const auto hwnd = reinterpret_cast<HWND>(OwningHwnd()))
{
SetForegroundWindow(hwnd);
}
const auto weak = get_weak();
if (e.DataView().Contains(StandardDataFormats::ApplicationLink()))

View File

@@ -192,6 +192,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
TerminalConnection::ITerminalConnection Connection();
void Connection(const TerminalConnection::ITerminalConnection& connection);
void HardResetWithoutErase();
Control::CursorDisplayState CursorVisibility() const noexcept;
void CursorVisibility(Control::CursorDisplayState cursorVisibility);

View File

@@ -53,6 +53,7 @@ namespace Microsoft.Terminal.Control
void SetOverrideColorScheme(Microsoft.Terminal.Core.ICoreScheme scheme);
Microsoft.Terminal.TerminalConnection.ITerminalConnection Connection;
void HardResetWithoutErase();
UInt64 ContentId{ get; };

View File

@@ -121,6 +121,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// GH#13978: If the TermControl has already been removed from the UI tree, XAML might run into weird bugs.
// This will prevent the `dispatcher.RunAsync` calls below from raising UIA events on the main thread.
_termControl = {};
// Solve the circular reference between us and the content automation peer.
_contentAutomationPeer.ParentProvider(nullptr);
}
// Method Description:

View File

@@ -55,6 +55,18 @@ void Terminal::Create(til::size viewportSize, til::CoordType scrollbackLines, Re
_stateMachine = std::make_unique<StateMachine>(std::move(engine));
}
// Method Description:
// - Resets all VT state to defaults without clearing the buffer content.
// Called when a connection is restarted so that any dirty modes left
// behind by a crashed application don't affect the new connection.
void Terminal::HardResetWithoutErase()
{
_assertLocked();
_stateMachine->ResetState();
auto& engine = reinterpret_cast<OutputStateMachineEngine&>(_stateMachine->Engine());
engine.Dispatch().HardReset(false);
}
// Method Description:
// - Initializes the Terminal from the given set of settings.
// Arguments:
@@ -86,7 +98,6 @@ void Terminal::UpdateSettings(ICoreSettings settings)
_answerbackMessage = settings.AnswerbackMessage();
_wordDelimiters = settings.WordDelimiters();
_suppressApplicationTitle = settings.SuppressApplicationTitle();
_startingTitle = settings.StartingTitle();
_trimBlockSelection = settings.TrimBlockSelection();
_autoMarkPrompts = settings.AutoMarkPrompts();
_rainbowSuggestions = settings.RainbowSuggestions();
@@ -112,6 +123,11 @@ void Terminal::UpdateSettings(ICoreSettings settings)
// Save the changes made above and in UpdateAppearance as the new default render settings.
GetRenderSettings().SaveDefaultSettings();
if (!_startingTitle)
{
_startingTitle = settings.StartingTitle();
}
if (!_startingTabColor && settings.StartingTabColor())
{
_startingTabColor = settings.StartingTabColor().Value();
@@ -513,52 +529,27 @@ std::wstring Terminal::GetHyperlinkAtViewportPosition(const til::point viewportP
std::wstring Terminal::GetHyperlinkAtBufferPosition(const til::point bufferPos)
{
const auto& buffer = _activeBuffer();
// Case 1: buffer position has a hyperlink stored in the buffer
const auto attr = _activeBuffer().GetCellDataAt(bufferPos)->TextAttr();
const auto attr = buffer.GetCellDataAt(bufferPos)->TextAttr();
if (attr.IsHyperlink())
{
return _activeBuffer().GetHyperlinkUriFromId(attr.GetHyperlinkId());
return buffer.GetHyperlinkUriFromId(attr.GetHyperlinkId());
}
// Case 2: buffer position may point to an auto-detected hyperlink
// Case 2 - Step 1: get the auto-detected hyperlink
std::optional<interval_tree::Interval<til::point, size_t>> result;
const auto visibleViewport = _GetVisibleViewport();
if (visibleViewport.IsInBounds(bufferPos))
// Check cached interval tree (covers visible viewport +/- viewport height)
if (const auto results = _patternIntervalTree.findOverlapping({ bufferPos.x + 1, bufferPos.y }, bufferPos); !results.empty())
{
// Hyperlink is in the current view, so let's just get it
auto viewportPos = bufferPos;
visibleViewport.ConvertToOrigin(&viewportPos);
result = GetHyperlinkIntervalFromViewportPosition(viewportPos);
if (result.has_value())
for (const auto& result : results)
{
result->start = _ConvertToBufferCell(result->start, false);
result->stop = _ConvertToBufferCell(result->stop, true);
if (result.value == _hyperlinkPatternId)
{
return buffer.GetPlainText(result.start, result.stop);
}
}
}
else
{
// Hyperlink is outside of the current view.
// We need to find if there's a pattern at that location.
const auto patterns = _getPatterns(bufferPos.y, bufferPos.y);
// NOTE: patterns is stored with top y-position being 0,
// so we need to cleverly set the y-pos to 0.
const til::point viewportPos{ bufferPos.x, 0 };
const auto results = patterns.findOverlapping(viewportPos, viewportPos);
if (!results.empty())
{
result = results.front();
result->start.y += bufferPos.y;
result->stop.y += bufferPos.y;
}
}
// Case 2 - Step 2: get the auto-detected hyperlink
if (result.has_value() && result->value == _hyperlinkPatternId)
{
return _activeBuffer().GetPlainText(result->start, result->stop);
}
return {};
}
@@ -578,17 +569,25 @@ uint16_t Terminal::GetHyperlinkIdAtViewportPosition(const til::point viewportPos
// Arguments:
// - The position relative to the viewport
// Return value:
// - The interval representing the start and end coordinates
// - The interval representing the start and end coordinates (viewport-relative)
std::optional<PointTree::interval> Terminal::GetHyperlinkIntervalFromViewportPosition(const til::point viewportPos)
{
const auto results = _patternIntervalTree.findOverlapping({ viewportPos.x + 1, viewportPos.y }, viewportPos);
// GH#18177: The tree stores buffer-absolute coordinates
// Convert viewport-relative (y=0 at visible start) to buffer-absolute
const auto visStart = _VisibleStartIndex();
const til::point bufferPos{ viewportPos.x, viewportPos.y + visStart };
const auto results = _patternIntervalTree.findOverlapping({ bufferPos.x + 1, bufferPos.y }, bufferPos);
if (results.size() > 0)
{
for (const auto& result : results)
{
if (result.value == _hyperlinkPatternId)
{
return result;
// Convert back to viewport-relative coordinates
auto interval = result;
interval.start.y -= visStart;
interval.stop.y -= visStart;
return interval;
}
}
}
@@ -807,11 +806,8 @@ TerminalInput::OutputType Terminal::FocusChanged(const bool focused)
// - The interval tree containing regions that need to be invalidated
void Terminal::_InvalidatePatternTree()
{
const auto vis = _VisibleStartIndex();
_patternIntervalTree.visit_all([&](const PointTree::interval& interval) {
const til::point startCoord{ interval.start.x, interval.start.y + vis };
const til::point endCoord{ interval.stop.x, interval.stop.y + vis };
_InvalidateFromCoords(startCoord, endCoord);
_InvalidateFromCoords(interval.start, interval.stop);
});
}
@@ -1209,7 +1205,16 @@ void Terminal::SetPlayMidiNoteCallback(std::function<void(const int, const int,
void Terminal::UpdatePatternsUnderLock()
{
_InvalidatePatternTree();
_patternIntervalTree = _getPatterns(_VisibleStartIndex(), _VisibleEndIndex());
const auto visStart = _VisibleStartIndex();
const auto visEnd = _VisibleEndIndex();
const auto viewportHeight = visEnd - visStart;
// GH#18177: Scan extra rows beyond the viewport so that URLs
// wrapping across the viewport boundary are matched in full
const auto bufferSize = _activeBuffer().GetSize();
const auto beg = std::max<til::CoordType>(0, visStart - viewportHeight);
const auto end = std::min(bufferSize.BottomInclusive(), visEnd + viewportHeight);
_patternIntervalTree = _getPatterns(beg, end);
_InvalidatePatternTree();
}
@@ -1424,10 +1429,8 @@ PointTree Terminal::_getPatterns(til::CoordType beg, til::CoordType end) const
{
do
{
auto range = ICU::BufferRangeFromMatch(&text, re.get());
// PointTree uses half-open ranges and viewport-relative coordinates.
range.start.y -= beg;
range.end.y -= beg;
// PointTree uses half-open ranges and buffer-absolute coordinates.
const auto range = ICU::BufferRangeFromMatch(&text, re.get());
intervals.push_back(PointTree::interval(range.start, range.end, 0));
} while (uregex_findNext(re.get(), &status));
}
@@ -1535,6 +1538,10 @@ void Terminal::SerializeMainBuffer(HANDLE handle) const
_mainBuffer->SerializeTo(handle);
}
void Terminal::UnknownSequence() noexcept
{
}
void Terminal::ColorSelection(const TextAttribute& attr, winrt::Microsoft::Terminal::Core::MatchMode matchMode)
{
const auto colorSelection = [this](const til::point coordStartInclusive, const til::point coordEndExclusive, const TextAttribute& attr) {

View File

@@ -85,6 +85,7 @@ public:
void Create(til::size viewportSize,
til::CoordType scrollbackLines,
Microsoft::Console::Render::Renderer& renderer);
void HardResetWithoutErase();
void CreateFromSettings(winrt::Microsoft::Terminal::Core::ICoreSettings settings,
Microsoft::Console::Render::Renderer& renderer);
@@ -131,7 +132,9 @@ public:
#pragma region ITerminalApi
// These methods are defined in TerminalApi.cpp
void UnknownSequence() noexcept override;
void ReturnResponse(const std::wstring_view response) override;
bool IsConPTY() const noexcept override;
Microsoft::Console::VirtualTerminal::StateMachine& GetStateMachine() noexcept override;
BufferState GetBufferAndViewport() noexcept override;
void SetViewportPosition(const til::point position) noexcept override;
@@ -204,7 +207,7 @@ public:
bool IsGridLineDrawingAllowed() noexcept override;
std::wstring GetHyperlinkUri(uint16_t id) const override;
std::wstring GetHyperlinkCustomId(uint16_t id) const override;
std::vector<size_t> GetPatternId(const til::point location) const override;
std::vector<size_t> GetPatternId(const til::point viewportPos) const override;
std::pair<COLORREF, COLORREF> GetAttributeColors(const TextAttribute& attr) const noexcept override;
std::span<const til::point_span> GetSelectionSpans() const noexcept override;
@@ -346,7 +349,7 @@ private:
::Microsoft::Console::VirtualTerminal::TerminalInput _terminalInput;
std::optional<std::wstring> _title;
std::wstring _startingTitle;
std::optional<std::wstring> _startingTitle;
std::optional<til::color> _startingTabColor;
std::vector<til::point_span> _searchHighlights;
@@ -397,7 +400,6 @@ private:
std::wstring _wordDelimiters;
SelectionExpansion _multiClickSelectionMode = SelectionExpansion::Char;
SelectionInteractionMode _selectionMode = SelectionInteractionMode::None;
bool _selectionIsTargetingUrl = false;
SelectionEndpoint _selectionEndpoint = SelectionEndpoint::None;
bool _anchorInactiveSelectionEndpoint = false;
#pragma endregion

View File

@@ -28,6 +28,11 @@ void Terminal::ReturnResponse(const std::wstring_view response)
}
}
bool Terminal::IsConPTY() const noexcept
{
return false;
}
Microsoft::Console::VirtualTerminal::StateMachine& Terminal::GetStateMachine() noexcept
{
return *_stateMachine;
@@ -86,8 +91,12 @@ void Terminal::SetWindowTitle(const std::wstring_view title)
_assertLocked();
if (!_suppressApplicationTitle)
{
_title.emplace(title.empty() ? _startingTitle : title);
_pfnTitleChanged(_title.value());
_title.reset();
if (!title.empty())
{
_title.emplace(title);
}
_pfnTitleChanged(GetConsoleTitle());
}
}
@@ -107,6 +116,13 @@ bool Terminal::ResizeWindow(const til::CoordType width, const til::CoordType hei
return false;
}
const auto currentDimensions = _GetMutableViewport().Dimensions();
if (width == currentDimensions.width && height == currentDimensions.height)
{
return false;
}
if (_pfnWindowSizeChanged)
{
_pfnWindowSizeChanged(width, height);
@@ -140,7 +156,7 @@ unsigned int Terminal::GetInputCodePage() const noexcept
void Terminal::CopyToClipboard(wil::zwstring_view content)
{
if (_clipboardOperationsAllowed)
if (_clipboardOperationsAllowed && _focused)
{
_pfnCopyToClipboard(content);
}

View File

@@ -254,7 +254,6 @@ void Terminal::_SetSelectionEnd(SelectionInfo* selection, const til::point viewp
std::tie(selection->start, selection->end) = expandedAnchors;
}
_selectionMode = SelectionInteractionMode::Mouse;
_selectionIsTargetingUrl = false;
}
// Method Description:
@@ -399,7 +398,6 @@ void Terminal::ToggleMarkMode()
}
_ScrollToPoint(_selection->start);
_selectionMode = SelectionInteractionMode::Mark;
_selectionIsTargetingUrl = false;
}
}
@@ -460,7 +458,6 @@ void Terminal::SelectHyperlink(const SearchDirection dir)
if (_selectionMode != SelectionInteractionMode::Mark)
{
// This feature only works in mark mode
_selectionIsTargetingUrl = false;
return;
}
@@ -469,19 +466,10 @@ void Terminal::SelectHyperlink(const SearchDirection dir)
const auto bufferSize = buffer.GetSize();
const auto viewportHeight = _GetMutableViewport().Height();
// The patterns are stored relative to the "search area". Initially, this search area will be the viewport,
// but as we progressively search through more of the buffer, this will change.
// Keep track of the search area here, and use the lambda below to convert points to the search area coordinate space.
auto searchArea = _GetVisibleViewport();
auto convertToSearchArea = [&searchArea](const til::point pt) noexcept {
auto copy = pt;
searchArea.ConvertToOrigin(&copy);
return copy;
};
// extracts the next/previous hyperlink from the list of hyperlink ranges provided
auto extractResultFromList = [&](std::vector<interval_tree::Interval<til::point, size_t>>& list) noexcept {
const auto selectionStartInSearchArea = convertToSearchArea(_selection->start);
const auto selectionStart = _selection->start;
const auto selectionEnd = _selection->end;
std::optional<std::pair<til::point, til::point>> resultFromList;
if (!list.empty())
@@ -491,12 +479,11 @@ void Terminal::SelectHyperlink(const SearchDirection dir)
// pattern tree includes the currently selected range when going forward,
// so we need to check if we're pointing to that one before returning it.
auto range = list.front();
if (_selectionIsTargetingUrl && range.start == selectionStartInSearchArea)
if (range.start == selectionStart && range.stop == selectionEnd)
{
if (list.size() > 1)
{
// if we're pointing to the currently selected URL,
// pick the next one.
// Selection matches the current URL, pick the next one
range = til::at(list, 1);
resultFromList = { range.start, range.stop };
}
@@ -521,14 +508,6 @@ void Terminal::SelectHyperlink(const SearchDirection dir)
resultFromList = { range.start, range.stop };
}
}
// pattern tree stores everything as viewport coords,
// so we need to convert them on the way out
if (resultFromList)
{
searchArea.ConvertFromOrigin(&resultFromList->first);
searchArea.ConvertFromOrigin(&resultFromList->second);
}
return resultFromList;
};
@@ -546,8 +525,8 @@ void Terminal::SelectHyperlink(const SearchDirection dir)
searchEnd = _selection->start;
}
// 1.A) Try searching the current viewport (no scrolling required)
auto resultList = _patternIntervalTree.findContained(convertToSearchArea(searchStart), convertToSearchArea(searchEnd));
// 1.A) Try searching the cached pattern tree (no scanning required)
auto resultList = _patternIntervalTree.findContained(searchStart, searchEnd);
std::optional<std::pair<til::point, til::point>> result = extractResultFromList(resultList);
if (!result)
{
@@ -562,14 +541,12 @@ void Terminal::SelectHyperlink(const SearchDirection dir)
searchEnd = { bufferSize.RightInclusive(), searchStart.y - 1 };
searchStart = { bufferSize.Left(), std::max(searchStart.y - viewportHeight, bufferSize.Top()) };
}
searchArea = Viewport::FromDimensions(searchStart, { searchEnd.x + 1, searchEnd.y + 1 });
const til::point bufferStart{ bufferSize.Origin() };
const til::point bufferEnd{ bufferSize.RightInclusive(), ViewEndIndex() };
while (!result && bufferSize.IsInBounds(searchStart) && bufferSize.IsInBounds(searchEnd) && searchStart <= searchEnd && bufferStart <= searchStart && searchEnd <= bufferEnd)
{
auto patterns = _getPatterns(searchStart.y, searchEnd.y);
resultList = patterns.findContained(convertToSearchArea(searchStart), convertToSearchArea(searchEnd));
resultList = patterns.findContained(searchStart, searchEnd);
result = extractResultFromList(resultList);
if (!result)
{
@@ -583,7 +560,6 @@ void Terminal::SelectHyperlink(const SearchDirection dir)
searchEnd.y -= 1;
searchStart.y = std::max(searchEnd.y - viewportHeight, bufferSize.Top());
}
searchArea = Viewport::FromDimensions(searchStart, { searchEnd.x + 1, searchEnd.y + 1 });
}
}
}
@@ -656,11 +632,10 @@ void Terminal::SelectHyperlink(const SearchDirection dir)
selection->start = result->first;
selection->pivot = result->first;
selection->end = result->second;
_selectionIsTargetingUrl = true;
_selectionEndpoint = SelectionEndpoint::End;
// 4. Scroll to the selected area (if necessary)
_ScrollToPoint(selection->end);
_ScrollToPoint(dir == SearchDirection::Forward ? selection->end : selection->start);
}
Terminal::UpdateSelectionParams Terminal::ConvertKeyEventToUpdateSelectionParams(const ControlKeyStates mods, const WORD vkey) const noexcept
@@ -768,7 +743,6 @@ void Terminal::UpdateSelection(SelectionDirection direction, SelectionExpansion
}
// 3. Actually modify the selection state
_selectionIsTargetingUrl = false;
_selectionMode = std::max(_selectionMode, SelectionInteractionMode::Keyboard);
auto selection{ _selection.write() };
@@ -811,7 +785,6 @@ void Terminal::SelectAll()
};
_selectionMode = SelectionInteractionMode::Keyboard;
_selectionIsTargetingUrl = false;
_ScrollToPoint(_selection->start);
}
@@ -943,7 +916,6 @@ void Terminal::ClearSelection()
_assertLocked();
_selection.write()->active = false;
_selectionMode = SelectionInteractionMode::None;
_selectionIsTargetingUrl = false;
_selectionEndpoint = static_cast<SelectionEndpoint>(0);
_anchorInactiveSelectionEndpoint = false;
}
@@ -1045,5 +1017,9 @@ void Terminal::_ScrollToPoint(const til::point pos)
}
_NotifyScrollEvent();
_activeBuffer().TriggerScroll();
// Rebuild the pattern tree for the new viewport position
// so that callers always find a fresh cache after scrolling
_updateUrlDetection();
}
}

View File

@@ -74,15 +74,16 @@ std::wstring Microsoft::Terminal::Core::Terminal::GetHyperlinkCustomId(uint16_t
// Method Description:
// - Gets the regex pattern ids of a location
// Arguments:
// - The location
// - The viewport-relative location
// Return value:
// - The pattern IDs of the location
std::vector<size_t> Terminal::GetPatternId(const til::point location) const
std::vector<size_t> Terminal::GetPatternId(const til::point viewportPos) const
{
_assertLocked();
// Look through our interval tree for this location
const auto intervals = _patternIntervalTree.findOverlapping({ location.x + 1, location.y }, location);
// Convert viewport-relative (y=0 at visible start) to buffer-absolute
const til::point bufferPos{ viewportPos.x, viewportPos.y + _VisibleStartIndex() };
const auto intervals = _patternIntervalTree.findOverlapping({ bufferPos.x + 1, bufferPos.y }, bufferPos);
if (intervals.size() == 0)
{
return {};
@@ -183,11 +184,18 @@ void Terminal::SelectNewRegion(const til::point coordStart, const til::point coo
std::wstring_view Terminal::GetConsoleTitle() const noexcept
{
_assertLocked();
if (_title.has_value())
if (_title)
{
return *_title;
}
return _startingTitle;
if (_startingTitle)
{
return *_startingTitle;
}
return {};
}
// Method Description:

View File

@@ -50,21 +50,21 @@ namespace winrt::Microsoft::Terminal::Settings
return { horizAlign, vertAlign };
}
winrt::com_ptr<TerminalSettings> TerminalSettings::_CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::Profile& profile, const Model::WindowSettings& windowSettings)
winrt::com_ptr<TerminalSettings> TerminalSettings::_CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
{
auto settings{ winrt::make_self<TerminalSettings>() };
const auto globals = appSettings.GlobalSettings();
settings->_ApplyProfileSettings(profile);
settings->_ApplyWindowSettings(windowSettings);
settings->_ApplyAppearanceSettings(profile.DefaultAppearance(), globals.ColorSchemes(), globals.CurrentTheme(windowSettings));
settings->_ApplyGlobalSettings(globals);
settings->_ApplyAppearanceSettings(profile.DefaultAppearance(), globals.ColorSchemes(), globals.CurrentTheme());
return settings;
}
winrt::com_ptr<TerminalSettings> TerminalSettings::CreateForPreview(const Model::CascadiaSettings& appSettings, const Model::Profile& profile, const Model::WindowSettings& windowSettings)
winrt::com_ptr<TerminalSettings> TerminalSettings::CreateForPreview(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
{
const auto settings = _CreateWithProfileCommon(appSettings, profile, windowSettings);
const auto settings = _CreateWithProfileCommon(appSettings, profile);
settings->_UseBackgroundImageForWindow = false;
return settings;
}
@@ -80,9 +80,9 @@ namespace winrt::Microsoft::Terminal::Settings
// Return Value:
// - A TerminalSettingsCreateResult, which contains a pair of TerminalSettings objects,
// one for when the terminal is focused and the other for when the terminal is unfocused
TerminalSettingsCreateResult TerminalSettings::CreateWithProfile(const Model::CascadiaSettings& appSettings, const Model::Profile& profile, const Model::WindowSettings& windowSettings)
TerminalSettingsCreateResult TerminalSettings::CreateWithProfile(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
{
const auto settings = _CreateWithProfileCommon(appSettings, profile, windowSettings);
const auto settings = _CreateWithProfileCommon(appSettings, profile);
winrt::com_ptr<TerminalSettings> child{ nullptr };
if (const auto& unfocusedAppearance{ profile.UnfocusedAppearance() })
@@ -90,7 +90,7 @@ namespace winrt::Microsoft::Terminal::Settings
const auto globals = appSettings.GlobalSettings();
child = winrt::make_self<TerminalSettings>();
child->_parent = settings->get_strong();
child->_ApplyAppearanceSettings(unfocusedAppearance, globals.ColorSchemes(), globals.CurrentTheme(windowSettings));
child->_ApplyAppearanceSettings(unfocusedAppearance, globals.ColorSchemes(), globals.CurrentTheme());
}
return TerminalSettingsCreateResult{ settings.get(), child.get() };
@@ -114,11 +114,10 @@ namespace winrt::Microsoft::Terminal::Settings
// - A TerminalSettingsCreateResult object, which contains a pair of TerminalSettings
// objects. One for when the terminal is focused and one for when the terminal is unfocused.
TerminalSettingsCreateResult TerminalSettings::CreateWithNewTerminalArgs(const Model::CascadiaSettings& appSettings,
const Model::NewTerminalArgs& newTerminalArgs,
const Model::WindowSettings& windowSettings)
const Model::NewTerminalArgs& newTerminalArgs)
{
const auto profile = appSettings.GetProfileForArgs(newTerminalArgs, windowSettings);
auto settingsPair{ CreateWithProfile(appSettings, profile, windowSettings) };
const auto profile = appSettings.GetProfileForArgs(newTerminalArgs);
auto settingsPair{ CreateWithProfile(appSettings, profile) };
auto defaultSettings = settingsPair.DefaultSettings();
if (newTerminalArgs)
@@ -357,31 +356,32 @@ namespace winrt::Microsoft::Terminal::Settings
}
// Method Description:
// - Applies appropriate settings from the window settings into the TerminalSettings object.
// - Applies appropriate settings from the globals into the TerminalSettings object.
// Arguments:
// - windowSettings: the per-window property values we're applying.
// - globalSettings: the global property values we're applying.
// Return Value:
// - <none>
void TerminalSettings::_ApplyWindowSettings(const Model::WindowSettings& windowSettings) noexcept
void TerminalSettings::_ApplyGlobalSettings(const Model::GlobalAppSettings& globalSettings) noexcept
{
_InitialRows = windowSettings.InitialRows();
_InitialCols = windowSettings.InitialCols();
_InitialRows = globalSettings.InitialRows();
_InitialCols = globalSettings.InitialCols();
_WordDelimiters = windowSettings.WordDelimiters();
_CopyOnSelect = windowSettings.CopyOnSelect();
_CopyFormatting = windowSettings.CopyFormatting();
_FocusFollowMouse = windowSettings.FocusFollowMouse();
_ScrollToZoom = windowSettings.ScrollToZoom();
_ScrollToChangeOpacity = windowSettings.ScrollToChangeOpacity();
_GraphicsAPI = windowSettings.GraphicsAPI();
_DisablePartialInvalidation = windowSettings.DisablePartialInvalidation();
_SoftwareRendering = windowSettings.SoftwareRendering();
_TextMeasurement = windowSettings.TextMeasurement();
_DefaultInputScope = windowSettings.DefaultInputScope();
_UseBackgroundImageForWindow = windowSettings.UseBackgroundImageForWindow();
_TrimBlockSelection = windowSettings.TrimBlockSelection();
_DetectURLs = windowSettings.DetectURLs();
_EnableUnfocusedAcrylic = windowSettings.EnableUnfocusedAcrylic();
_WordDelimiters = globalSettings.WordDelimiters();
_CopyOnSelect = globalSettings.CopyOnSelect();
_CopyFormatting = globalSettings.CopyFormatting();
_FocusFollowMouse = globalSettings.FocusFollowMouse();
_ScrollToZoom = globalSettings.ScrollToZoom();
_ScrollToChangeOpacity = globalSettings.ScrollToChangeOpacity();
_GraphicsAPI = globalSettings.GraphicsAPI();
_DisablePartialInvalidation = globalSettings.DisablePartialInvalidation();
_SoftwareRendering = globalSettings.SoftwareRendering();
_TextMeasurement = globalSettings.TextMeasurement();
_AmbiguousWidth = globalSettings.AmbiguousWidth();
_DefaultInputScope = globalSettings.DefaultInputScope();
_UseBackgroundImageForWindow = globalSettings.UseBackgroundImageForWindow();
_TrimBlockSelection = globalSettings.TrimBlockSelection();
_DetectURLs = globalSettings.DetectURLs();
_EnableUnfocusedAcrylic = globalSettings.EnableUnfocusedAcrylic();
}
// Method Description:

View File

@@ -57,15 +57,13 @@ namespace winrt::Microsoft::Terminal::Settings
{
TerminalSettings() = default;
static winrt::com_ptr<TerminalSettings> CreateForPreview(const Model::CascadiaSettings& appSettings, const Model::Profile& profile, const Model::WindowSettings& windowSettings);
static winrt::com_ptr<TerminalSettings> CreateForPreview(const Model::CascadiaSettings& appSettings, const Model::Profile& profile);
static TerminalSettingsCreateResult CreateWithProfile(const Model::CascadiaSettings& appSettings,
const Model::Profile& profile,
const Model::WindowSettings& windowSettings);
const Model::Profile& profile);
static TerminalSettingsCreateResult CreateWithNewTerminalArgs(const Model::CascadiaSettings& appSettings,
const Model::NewTerminalArgs& newTerminalArgs,
const Model::WindowSettings& windowSettings);
const Model::NewTerminalArgs& newTerminalArgs);
void ApplyColorScheme(const Model::ColorScheme& scheme);
@@ -104,10 +102,10 @@ namespace winrt::Microsoft::Terminal::Settings
std::optional<std::array<Microsoft::Terminal::Core::Color, COLOR_TABLE_SIZE>> _ColorTable;
std::span<Microsoft::Terminal::Core::Color> _getColorTableImpl();
static winrt::com_ptr<TerminalSettings> _CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::Profile& profile, const Model::WindowSettings& windowSettings);
static winrt::com_ptr<TerminalSettings> _CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::Profile& profile);
void _ApplyProfileSettings(const Model::Profile& profile);
void _ApplyWindowSettings(const Model::WindowSettings& windowSettings) noexcept;
void _ApplyGlobalSettings(const Model::GlobalAppSettings& globalSettings) noexcept;
void _ApplyAppearanceSettings(const Microsoft::Terminal::Settings::Model::IAppearanceConfig& appearance,
const Windows::Foundation::Collections::IMapView<hstring, Microsoft::Terminal::Settings::Model::ColorScheme>& schemes,
const winrt::Microsoft::Terminal::Settings::Model::Theme currentTheme);

View File

@@ -23,6 +23,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::ActionsViewModel>();
_ViewModel.ReSortCommandList();
auto vmImpl = get_self<ActionsViewModel>(_ViewModel);
vmImpl->MarkAsVisited();
_layoutUpdatedRevoker = LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) {

View File

@@ -126,13 +126,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void CommandViewModel::Name(const winrt::hstring& newName)
{
_command.Name(newName);
if (newName.empty())
if (_command.Name() != newName)
{
// if the name was cleared, refresh the DisplayName
_command.Name(newName);
_NotifyChanges(L"DisplayName", L"DisplayNameAndKeyChordAutomationPropName");
_cachedDisplayName.clear();
}
_cachedDisplayName.clear();
}
winrt::hstring CommandViewModel::DisplayNameAndKeyChordAutomationPropName()
@@ -322,7 +321,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
weak->_ReplaceCommandWithUserCopy(false);
}
weak->_NotifyChanges(L"DisplayName");
if (!weak->_command.HasName())
{
weak->_NotifyChanges(L"DisplayName");
}
}
});
}
@@ -359,7 +361,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_RegisterActionArgsVMEvents(*actionArgsVM);
actionArgsVM->Initialize();
ActionArgsVM(*actionArgsVM);
_NotifyChanges(L"DisplayName");
if (!_command.HasName())
{
_NotifyChanges(L"DisplayName");
}
}
ArgWrapper::ArgWrapper(const Model::ArgDescriptor& descriptor, const Windows::Foundation::IInspectable& value) :
@@ -1241,6 +1246,25 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
CurrentPage(ActionsSubPage::Edit);
}
void ActionsViewModel::ReSortCommandList()
{
if (_CommandListDirty)
{
std::vector<Editor::CommandViewModel> commandList;
commandList.reserve(_CommandList.Size());
for (const auto& cmd : _CommandList)
{
commandList.push_back(cmd);
}
std::sort(commandList.begin(), commandList.end(), [](const Editor::CommandViewModel& lhs, const Editor::CommandViewModel& rhs) {
return lhs.DisplayName() < rhs.DisplayName();
});
_CommandList = single_threaded_observable_vector(std::move(commandList));
_NotifyChanges(L"CommandList");
_CommandListDirty = false;
}
}
void ActionsViewModel::CurrentCommand(const Editor::CommandViewModel& newCommand)
{
_CurrentCommand = newCommand;
@@ -1411,5 +1435,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
cmdVM->DeleteRequested({ this, &ActionsViewModel::_CmdVMDeleteRequestedHandler });
cmdVM->PropagateColorSchemeRequested({ this, &ActionsViewModel::_CmdVMPropagateColorSchemeRequestedHandler });
cmdVM->PropagateColorSchemeNamesRequested({ this, &ActionsViewModel::_CmdVMPropagateColorSchemeNamesRequestedHandler });
cmdVM->PropertyChanged([weakThis{ get_weak() }](const IInspectable& sender, const Windows::UI::Xaml::Data::PropertyChangedEventArgs& args) {
if (const auto self{ weakThis.get() })
{
const auto senderVM{ sender.as<Editor::CommandViewModel>() };
const auto propertyName{ args.PropertyName() };
if (propertyName == L"DisplayName")
{
// when a command's name changes, note that we need to re-sort the command list when we navigate back to the actions page
self->_CommandListDirty = true;
}
}
});
}
}

View File

@@ -258,6 +258,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
bool DisplayBadge() const noexcept;
void AddNewCommand();
void ReSortCommandList();
void CurrentCommand(const Editor::CommandViewModel& newCommand);
Editor::CommandViewModel CurrentCommand();
@@ -279,6 +280,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Model::CascadiaSettings _Settings;
Windows::Foundation::Collections::IMap<Model::ShortcutAction, winrt::hstring> _AvailableActionsAndNamesMap;
Windows::Foundation::Collections::IMap<winrt::hstring, Model::ShortcutAction> _NameToActionMap;
bool _CommandListDirty{ false };
void _MakeCommandVMsHelper();
void _RegisterCmdVMEvents(com_ptr<implementation::CommandViewModel>& cmdVM);

View File

@@ -166,6 +166,7 @@ namespace Microsoft.Terminal.Settings.Editor
void UpdateSettings(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
void AddNewCommand();
void ReSortCommandList();
ActionsSubPage CurrentPage;
Boolean DisplayBadge { get; };

View File

@@ -55,13 +55,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
}
hstring ColorSchemesPageViewModel::TakeElementToFocus()
{
const auto elementToFocus = _elementToFocus;
_elementToFocus.clear();
return elementToFocus;
}
void ColorSchemesPageViewModel::CurrentScheme(const Editor::ColorSchemeViewModel& newSelectedScheme)
{
if (_CurrentScheme != newSelectedScheme)

View File

@@ -17,9 +17,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
ColorSchemesPageViewModel(const Model::CascadiaSettings& settings);
void UpdateSettings(const Model::CascadiaSettings& settings);
hstring TakeElementToFocus();
void PutElementToFocus(const hstring& elementName) { _elementToFocus = elementName; }
void CurrentScheme(const Editor::ColorSchemeViewModel& newSelectedScheme);
Editor::ColorSchemeViewModel CurrentScheme();
bool HasCurrentScheme() const noexcept;
@@ -44,7 +41,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
private:
Editor::ColorSchemeViewModel _CurrentScheme{ nullptr };
Model::CascadiaSettings _settings;
hstring _elementToFocus;
Windows::Foundation::Collections::IMap<Editor::ColorSchemeViewModel, Model::ColorScheme> _viewModelToSchemeMap;
void _MakeColorSchemeVMsHelper();

View File

@@ -16,6 +16,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_settings{ settings }
{
INITIALIZE_BINDABLE_ENUM_SETTING(TextMeasurement, TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, L"Globals_TextMeasurement_", L"Text");
INITIALIZE_BINDABLE_ENUM_SETTING(AmbiguousWidth, AmbiguousWidth, winrt::Microsoft::Terminal::Control::AmbiguousWidth, L"Globals_AmbiguousWidth_", L"Text");
}
bool CompatibilityViewModel::DebugFeaturesAvailable() const noexcept

View File

@@ -25,7 +25,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), AllowHeadless);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), DebugFeaturesEnabled);
GETSET_BINDABLE_ENUM_SETTING(TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, _settings.WindowSettingsDefaults().TextMeasurement);
GETSET_BINDABLE_ENUM_SETTING(TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, _settings.GlobalSettings().TextMeasurement);
GETSET_BINDABLE_ENUM_SETTING(AmbiguousWidth, winrt::Microsoft::Terminal::Control::AmbiguousWidth, _settings.GlobalSettings().AmbiguousWidth);
private:
Model::CascadiaSettings _settings;

View File

@@ -20,6 +20,9 @@ namespace Microsoft.Terminal.Settings.Editor
IInspectable CurrentTextMeasurement;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> TextMeasurementList { get; };
IInspectable CurrentAmbiguousWidth;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> AmbiguousWidthList { get; };
}
[default_interface] runtimeclass Compatibility : Windows.UI.Xaml.Controls.Page

View File

@@ -42,6 +42,16 @@
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Ambiguous Width -->
<local:SettingContainer x:Name="AmbiguousWidth"
x:Uid="Globals_AmbiguousWidth">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.AmbiguousWidthList}"
SelectedItem="{x:Bind ViewModel.CurrentAmbiguousWidth, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Debug Features -->
<local:SettingContainer x:Name="DebugFeaturesEnabled"
x:Uid="Globals_DebugFeaturesEnabled"

View File

@@ -105,14 +105,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
}
void EditAction::ShortcutActionBox_SuggestionChosen(const AutoSuggestBox& sender, const AutoSuggestBoxSuggestionChosenEventArgs& args)
{
if (const auto selectedAction = args.SelectedItem().try_as<winrt::hstring>())
{
sender.Text(*selectedAction);
}
}
void EditAction::ShortcutActionBox_QuerySubmitted(const AutoSuggestBox& sender, const AutoSuggestBoxQuerySubmittedEventArgs& args)
{
const auto submittedText = args.QueryText();

View File

@@ -22,7 +22,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void ShortcutActionBox_GotFocus(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& args);
void ShortcutActionBox_TextChanged(const winrt::Windows::UI::Xaml::Controls::AutoSuggestBox& sender, const winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs& args);
void ShortcutActionBox_SuggestionChosen(const winrt::Windows::UI::Xaml::Controls::AutoSuggestBox& sender, const winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxSuggestionChosenEventArgs& args);
void ShortcutActionBox_QuerySubmitted(const winrt::Windows::UI::Xaml::Controls::AutoSuggestBox& sender, const winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxQuerySubmittedEventArgs& args);
void ShortcutActionBox_LostFocus(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& args);

View File

@@ -707,7 +707,6 @@
GotFocus="ShortcutActionBox_GotFocus"
LostFocus="ShortcutActionBox_LostFocus"
QuerySubmitted="ShortcutActionBox_QuerySubmitted"
SuggestionChosen="ShortcutActionBox_SuggestionChosen"
TextChanged="ShortcutActionBox_TextChanged" />
<TextBlock x:Uid="Actions_Keybindings"
Grid.Row="3"

View File

@@ -22,8 +22,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
constexpr std::wstring_view legacyDarkThemeName{ L"legacyDark" };
constexpr std::wstring_view legacyLightThemeName{ L"legacyLight" };
GlobalAppearanceViewModel::GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings) :
_windowSettings{ windowSettings },
GlobalAppearanceViewModel::GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings) :
_GlobalSettings{ globalSettings },
_ThemeList{ single_threaded_observable_vector<Model::Theme>() }
{
@@ -47,7 +46,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
winrt::Windows::Foundation::IInspectable GlobalAppearanceViewModel::CurrentTheme()
{
return _GlobalSettings.CurrentTheme(_windowSettings);
return _GlobalSettings.CurrentTheme();
}
// Get the name out of the newly selected item, stash that as the Theme name
@@ -57,7 +56,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
if (const auto& theme{ tag.try_as<Model::Theme>() })
{
_windowSettings.Theme(Model::ThemePair{ theme.Name() });
_GlobalSettings.Theme(Model::ThemePair{ theme.Name() });
}
}
@@ -104,12 +103,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
bool GlobalAppearanceViewModel::InvertedDisableAnimations()
{
return !_windowSettings.DisableAnimations();
return !_GlobalSettings.DisableAnimations();
}
void GlobalAppearanceViewModel::InvertedDisableAnimations(bool value)
{
_windowSettings.DisableAnimations(!value);
_GlobalSettings.DisableAnimations(!value);
}
void GlobalAppearanceViewModel::ShowTitlebarToggled(const winrt::Windows::Foundation::IInspectable& /* sender */, const RoutedEventArgs& /* args */)

View File

@@ -12,14 +12,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
struct GlobalAppearanceViewModel : GlobalAppearanceViewModelT<GlobalAppearanceViewModel>, ViewModelHelper<GlobalAppearanceViewModel>
{
public:
GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings);
GlobalAppearanceViewModel(Model::GlobalAppSettings globalSettings);
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
using ViewModelHelper<GlobalAppearanceViewModel>::PropertyChanged;
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<Model::Theme>, ThemeList, nullptr);
GETSET_BINDABLE_ENUM_SETTING(NewTabPosition, Model::NewTabPosition, _windowSettings.NewTabPosition);
GETSET_BINDABLE_ENUM_SETTING(TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, _windowSettings.TabWidthMode);
GETSET_BINDABLE_ENUM_SETTING(NewTabPosition, Model::NewTabPosition, _GlobalSettings.NewTabPosition);
GETSET_BINDABLE_ENUM_SETTING(TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, _GlobalSettings.TabWidthMode);
public:
winrt::Windows::Foundation::IInspectable CurrentTheme();
@@ -31,20 +31,19 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void ShowTitlebarToggled(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& args);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, AlwaysShowTabs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ShowTabsFullscreen);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ShowTabsInTitlebar);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, UseAcrylicInTabRow);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ShowTitleInTitlebar);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, AlwaysOnTop);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, AutoHideWindow);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysShowTabs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTabsFullscreen);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTabsInTitlebar);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, UseAcrylicInTabRow);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTitleInTitlebar);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysOnTop);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AutoHideWindow);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysShowNotificationIcon);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, MinimizeToNotificationArea);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ShowAdminShield);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, EnableUnfocusedAcrylic);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, MinimizeToNotificationArea);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowAdminShield);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, EnableUnfocusedAcrylic);
private:
Model::WindowSettings _windowSettings;
Model::GlobalAppSettings _GlobalSettings;
winrt::Windows::Foundation::IInspectable _currentTheme;

View File

@@ -9,8 +9,7 @@ namespace Microsoft.Terminal.Settings.Editor
{
runtimeclass GlobalAppearanceViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
GlobalAppearanceViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings,
Microsoft.Terminal.Settings.Model.WindowSettings windowSettings);
GlobalAppearanceViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);
IInspectable CurrentTheme;
static String ThemeNameConverter(Microsoft.Terminal.Settings.Model.Theme theme);

View File

@@ -12,9 +12,8 @@ using namespace winrt::Microsoft::Terminal::Settings::Model;
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
InteractionViewModel::InteractionViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings) :
_GlobalSettings{ globalSettings },
_windowSettings{ windowSettings }
InteractionViewModel::InteractionViewModel(Model::GlobalAppSettings globalSettings) :
_GlobalSettings{ globalSettings }
{
INITIALIZE_BINDABLE_ENUM_SETTING(TabSwitcherMode, TabSwitcherMode, TabSwitcherMode, L"Globals_TabSwitcherMode", L"Content");
INITIALIZE_BINDABLE_ENUM_SETTING(CopyFormat, CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, L"Globals_CopyFormat", L"Content");

View File

@@ -12,33 +12,32 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
struct InteractionViewModel : InteractionViewModelT<InteractionViewModel>, ViewModelHelper<InteractionViewModel>
{
public:
InteractionViewModel(Model::GlobalAppSettings globalSettings, Model::WindowSettings windowSettings);
InteractionViewModel(Model::GlobalAppSettings globalSettings);
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
using ViewModelHelper<InteractionViewModel>::PropertyChanged;
GETSET_BINDABLE_ENUM_SETTING(TabSwitcherMode, Model::TabSwitcherMode, _windowSettings.TabSwitcherMode);
GETSET_BINDABLE_ENUM_SETTING(CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, _windowSettings.CopyFormatting);
GETSET_BINDABLE_ENUM_SETTING(TabSwitcherMode, Model::TabSwitcherMode, _GlobalSettings.TabSwitcherMode);
GETSET_BINDABLE_ENUM_SETTING(CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, _GlobalSettings.CopyFormatting);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, CopyOnSelect);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, TrimBlockSelection);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, TrimPaste);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, SnapToGridOnResize);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, FocusFollowMouse);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ScrollToZoom);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ScrollToChangeOpacity);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, DetectURLs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, SearchWebDefaultQueryUrl);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, WordDelimiters);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, ConfirmCloseAllTabs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, CopyOnSelect);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimBlockSelection);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimPaste);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SnapToGridOnResize);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, FocusFollowMouse);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ScrollToZoom);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ScrollToChangeOpacity);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DetectURLs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SearchWebDefaultQueryUrl);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WordDelimiters);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ConfirmCloseAllTabs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, InputServiceWarning);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, WarnAboutLargePaste);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_windowSettings, WarnAboutMultiLinePaste);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WarnAboutLargePaste);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WarnAboutMultiLinePaste);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, EnableColorSelection);
private:
Model::GlobalAppSettings _GlobalSettings;
Model::WindowSettings _windowSettings;
};
};

View File

@@ -9,8 +9,7 @@ namespace Microsoft.Terminal.Settings.Editor
{
runtimeclass InteractionViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
InteractionViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings,
Microsoft.Terminal.Settings.Model.WindowSettings windowSettings);
InteractionViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);
IInspectable CurrentTabSwitcherMode;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> TabSwitcherModeList { get; };

View File

@@ -231,7 +231,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
double LaunchViewModel::InitialPosX()
{
const auto x = _Settings.WindowSettingsDefaults().InitialPosition().X;
const auto x = _Settings.GlobalSettings().InitialPosition().X;
// If there's no value here, return NAN - XAML will ignore it and
// put the placeholder text in the box instead
const auto xCoord = x.try_as<int32_t>();
@@ -240,7 +240,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
double LaunchViewModel::InitialPosY()
{
const auto y = _Settings.WindowSettingsDefaults().InitialPosition().Y;
const auto y = _Settings.GlobalSettings().InitialPosition().Y;
// If there's no value here, return NAN - XAML will ignore it and
// put the placeholder text in the box instead
const auto yCoord = y.try_as<int32_t>();
@@ -255,8 +255,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
xCoordRef = gsl::narrow_cast<int32_t>(xCoord);
}
const LaunchPosition newPos{ xCoordRef, _Settings.WindowSettingsDefaults().InitialPosition().Y };
_Settings.WindowSettingsDefaults().InitialPosition(newPos);
const LaunchPosition newPos{ xCoordRef, _Settings.GlobalSettings().InitialPosition().Y };
_Settings.GlobalSettings().InitialPosition(newPos);
_NotifyChanges(L"LaunchParametersCurrentValue");
}
@@ -268,8 +268,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
yCoordRef = gsl::narrow_cast<int32_t>(yCoord);
}
const LaunchPosition newPos{ _Settings.WindowSettingsDefaults().InitialPosition().X, yCoordRef };
_Settings.WindowSettingsDefaults().InitialPosition(newPos);
const LaunchPosition newPos{ _Settings.GlobalSettings().InitialPosition().X, yCoordRef };
_Settings.GlobalSettings().InitialPosition(newPos);
_NotifyChanges(L"LaunchParametersCurrentValue");
}
@@ -291,7 +291,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
winrt::Windows::Foundation::IInspectable LaunchViewModel::CurrentLaunchMode()
{
return winrt::box_value<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(_LaunchModeMap.Lookup(_Settings.WindowSettingsDefaults().LaunchMode()));
return winrt::box_value<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(_LaunchModeMap.Lookup(_Settings.GlobalSettings().LaunchMode()));
}
void LaunchViewModel::CurrentLaunchMode(const winrt::Windows::Foundation::IInspectable& enumEntry)
@@ -299,7 +299,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
if (const auto ee = enumEntry.try_as<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>())
{
const auto setting = winrt::unbox_value<LaunchMode>(ee.EnumValue());
_Settings.WindowSettingsDefaults().LaunchMode(setting);
_Settings.GlobalSettings().LaunchMode(setting);
_NotifyChanges(L"LaunchParametersCurrentValue");
}
}
@@ -311,14 +311,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
winrt::Windows::Foundation::IInspectable LaunchViewModel::CurrentDefaultProfile()
{
const auto defaultProfileGuid{ _Settings.WindowSettingsDefaults().DefaultProfile() };
const auto defaultProfileGuid{ _Settings.GlobalSettings().DefaultProfile() };
return winrt::box_value(_Settings.FindProfile(defaultProfileGuid));
}
void LaunchViewModel::CurrentDefaultProfile(const IInspectable& value)
{
const auto profile{ winrt::unbox_value<Model::Profile>(value) };
_Settings.WindowSettingsDefaults().DefaultProfile(profile.Guid());
_Settings.GlobalSettings().DefaultProfile(profile.Guid());
}
winrt::Windows::Foundation::Collections::IObservableVector<Model::Profile> LaunchViewModel::DefaultProfiles() const

View File

@@ -46,13 +46,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void CurrentLaunchMode(const winrt::Windows::Foundation::IInspectable& enumEntry);
winrt::Windows::Foundation::Collections::IObservableVector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> LaunchModeList();
GETSET_BINDABLE_ENUM_SETTING(DefaultInputScope, winrt::Microsoft::Terminal::Control::DefaultInputScope, _Settings.WindowSettingsDefaults().DefaultInputScope);
GETSET_BINDABLE_ENUM_SETTING(DefaultInputScope, winrt::Microsoft::Terminal::Control::DefaultInputScope, _Settings.GlobalSettings().DefaultInputScope);
GETSET_BINDABLE_ENUM_SETTING(FirstWindowPreference, Model::FirstWindowPreference, _Settings.GlobalSettings().FirstWindowPreference);
GETSET_BINDABLE_ENUM_SETTING(WindowingBehavior, Model::WindowingMode, _Settings.GlobalSettings().WindowingBehavior);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.WindowSettingsDefaults(), CenterOnLaunch);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.WindowSettingsDefaults(), InitialRows);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.WindowSettingsDefaults(), InitialCols);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), CenterOnLaunch);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), InitialRows);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_Settings.GlobalSettings(), InitialCols);
bool StartOnUserLoginAvailable();
safe_void_coroutine PrepareStartOnUserLoginSettings();

File diff suppressed because it is too large Load Diff

View File

@@ -90,14 +90,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void _AddProfileHandler(const winrt::guid profileGuid);
void _SetupProfileEventHandling(const winrt::Microsoft::Terminal::Settings::Editor::ProfileViewModel profile);
void _SetupColorSchemesEventHandling();
void _SetupActionsEventHandling();
void _NavigateToProfileSubPage(const Editor::ProfileViewModel& profile, ProfileSubPage page, const IInspectable& breadcrumbTag, const hstring& elementToFocus);
void _PreNavigateHelper();
void _Navigate(hstring clickedItemTag, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const Editor::ProfileViewModel& profile, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const Editor::ColorSchemeViewModel& colorSchemeVM, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const Editor::NewTabMenuEntryViewModel& ntmEntryVM, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const Editor::ExtensionPackageViewModel& extPkgVM, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const Editor::CommandViewModel& commandVM, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const IInspectable& vm, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _NavigateToProfileHandler(const IInspectable& sender, winrt::guid profileGuid);
void _NavigateToColorSchemeHandler(const IInspectable& sender, const IInspectable& args);
Microsoft::UI::Xaml::Controls::NavigationViewItem _FindProfileNavItem(winrt::guid profileGuid) const;

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