Compare commits

...

23 Commits

Author SHA1 Message Date
Dustin L. Howett
34288a397a template bug 2025-09-08 14:43:04 -05:00
Dustin L. Howett
2cf42cc892 proper template root 2025-09-08 14:42:09 -05:00
Dustin L. Howett
7a11f79fa7 What if the CI build also did the packaging stuff 2025-09-08 14:38:00 -05:00
Dustin L. Howett
44d9fefbcb if the previous thing didn't work, why would this? 2025-09-08 14:12:26 -05:00
Dustin L. Howett
2d58e54110 at least this kind of error can be fixed 2025-09-08 13:15:39 -05:00
Dustin L. Howett
eae14cb16f I am sure this is going to be a disaster. 2025-09-08 13:15:15 -05:00
Dustin L. Howett
28ab0afb48 Convert the solution file to the new SLNX format 2025-09-08 13:04:30 -05:00
Dustin L. Howett
54aaa4a98a tests: add UIHelpers and ThemeHelpers to TestHostApp (#19323)
It can't actually activate TerminalApp.dll without these... lol.
2025-09-08 10:21:29 -07:00
Windows Console Service Bot
13ddefa635 Localization Updates - main - 09/04/2025 03:03:15 (#19319) 2025-09-05 17:13:47 -05:00
PankajBhojwani
f6303ac1ae Add reflection to the ActionArgs in the settings model (#18915)
Implements reflection to the various ActionArg types in the settings
model, which allows these structs to provide information about
themselves (i.e. what args they contain and what types they are). This
is necessary as a pre-requisite for the Settings Editor to display and
modify these arg values.

## Detailed Description of the Pull Request / Additional comments
* The `IActionArgs` interface now has additional methods:
	* Get the number of args
	* Get/Set an arg at a specific index
	* Get a vector of arg descriptions; the arg description contains:
		* name of the arg
		* type of the arg
		* whether the arg is required
* a tag, this is to cover special cases (for example the ColorScheme
argument is technically of type "string", but only allows specific
values)
* All the macros in `ActionArgsMagic` have been updated to support the
new interface
* `ActionMap` has been updated to support adding/editing/deleting
actions and keybindings from outside the SettingsModel
	* It also handles ID change requests for commands
* EnumMappings have been added to various ActionArg enums that weren't
there before

## Validation Steps Performed
Bug bashed in conjunction with #18917
2025-09-03 13:36:10 -07:00
Dustin L. Howett
52e60b95e4 Remove TerminalSettings from the TerminalSettingsModel project (#19262)
The idea with IControlSettings (and friends) was always that a consumer
of the terminal control could implement it in whatever way they pleased.

Windows Terminal (the application) was intended to be only one
consumer. It has a whole JSON settings model. Nobody wants to think
about JSON at the Terminal Control level. We could have an "adapter" in
TerminalApp, which spoke Terminal JSON Settings on one side and Terminal
Control on the other side.

That worked until we added the settings editor. The settings editor
needed to display a control, and that control's settings needed to be
based on the JSON settings. Oops. We took the expedient route of moving
the adapter into TerminalSettingsModel itself, and poking a bunch of
holes in it so that TerminalApp and TerminalSettingsEditor could tweak
it as needed.

Later, we doubled down on the control settings interface by having every
Terminal Control _make its own ControlSettings_ when we were going to do
the multi-process model. This reduced the number of IPC round trips for
every settings query to 0. Later we built color scheme previewing on top
of that--adding structs to carry color schemes and stuff which was
already in the Appearance config. Sheesh. Layers and layers and layers.

This pull request moves it back into its own library and strips it from
the surface of TerminalSettingsModel. It also deletes `ControlSettings`
and `struct CoreScheme`. That library is called
`TerminalSettingsAppAdapterLib`, and it contains a hidden WinRT
_implements_ type rather than a full-fledged activatable `runtimeclass`.
It also implements one-level inheritance on its own rather than using
IInheritable.

It adheres to the following principles:
- The control will never modify its settings in a way that is visible to
  the control's consumer; therefore, none of the properties have setters
- The settings should never contain things of interest only to the
  Application that the Application uses to communicate data _back to
  itself_ (see `ProfileName`, removed in 68b723c and `KeyBindings`,
  removed in fa09141). This generalizes to "we should never store stuff
  in an unrelated object passed between layers solely for the purpose of
  getting it back".

I made a few changes to the settings interface, including introducing a
new `ICoreScheme` interface that _only_ contains color scheme info. This
is designed to support the Preview/Set color scheme actions, which no
longer work by _app backing up the scheme and restoring it later._ All
of that machinery lives inside TermControl/ControlCore now.

`ICoreScheme` no longer supports `GetColorAtIndex`; you must read all 16
colors at the same time. I am not sorry. Every consumer did that
already, so now we have 15 fewer COM calls for every color scheme.

The new TerminalSettings is mostly consumed via
`com_ptr<TerminalSettings>`, so a bunch of `.` (projected) accesses had
to turn into `->` (com_ptr dereferencing) accesses.

I also realized, in the course of this work, that the old
TerminalSettings contained a partial hand-written reimplementation of
_every setting_ in `ControlProperties`. Every contributor had to add
every new setting to both places--why? I can't figure it out. I'm using
ControlProperties comprehensively now. I propagated any setting whose
default value was different from that in ControlProperties back to
ControlProperties.

This is part X in a series of pull requests that will remove all mention
of Microsoft.Terminal.Control and Microsoft.Terminal.Core from the
settings model. Once that is done, the settings model can consume _only_
the base WinRT types and build very early and test more easily.

Previewing is fun. I introduced a new place to stash an entire color
table on ControlCore, which we use to save the "active" colors while we
temporarily overwrite them. SetColorScheme is _also_ fun. We now have a
slot for overriding only the focused color scheme on ControlCore. It's
fine. It's clearer than "back up the focused appearance, overwrite the
focused appearance, create a child of the user's settings and apply the
color scheme to it, etc.".

There is a bug/design choice in color scheme overriding, which may or
may not matter: overlaying a color scheme on a terminal with an
unfocused appearance which _does not_ have its own color scheme will
result in the previously-deleted overridden focused color scheme peeking
through when the terminal is not focused.

I also got rid of our only in-product use of
`Terminal::CreateFromSettings` which required us to set `InitialRows`
and `InitialCols` on the incoming settings object (see core tenet 2).

Refs #19261
Refs #19314
Refs #19254
2025-09-03 14:01:36 -05:00
Dustin L. Howett
fa09141a16 Stop using Settings to shuttle IKeyBindings around (#19314)
For some reason, we went real hard on an architecture where the settings
object contained the key bindings handler for the terminal. To make this
work, we had to wind it through tons of layers: `TermControl`,
`ControlInteractivity`, `ControlCore` (which saved it on
`ControlSettings`), `ControlSettings`. Of course, because we have no
clear delineation of concerns at the App layer this required us to put
the bindings into the Settings Cache[^1].

Well, `TermControl` used `ControlCore` to get the Settings, to get the
Bindings, to dispatch keys.

Yes, `TermControl` stored `IKeyBindings` down three layers _only to fish
it back out and use it itself._

There is one place in the application where `TermControl`s are hooked up
to their owners. Instead of passing the key bindings dispatcher in
through nine hundred layers, we can just set it once--definitively!--
there.

[^1]: This was the last thing that made the settings cache
page-specific...
2025-09-03 16:43:34 +00:00
Myungchul Keum
8011f3e28c Adjust "Dimidium" color scheme (#19303)
- Add Selection BG color
- Make Bright white brighter

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

## References and Relevant Issues
#18563

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

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


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

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


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

This will be the final tune for Dimidum color scheme.
2025-09-03 11:04:28 -05:00
Leonard Hecker
8d41ace320 Avoid reentrancy issues when dropping AppHost (#19296)
tl;dr: ~Apphost() may pump the message loop.
That's no bueno. See comments in the diff.

Additionally, this PR enables `_assertIsMainThread` in
release to trace down mysterious crashes in those builds.
2025-09-01 15:33:11 +02:00
Leonard Hecker
7849b00cbd Fix CoreWindow being destroyed after handoff (#19298)
As per: https://github.com/microsoft/terminal/discussions/19280#discussioncomment-14237148

## Validation Steps Performed
* Launch wtd via handoff (spawn cmd, etc.)
* Shift+Click the tab bar + button to create a new window
* Close the initial window
* UI doesn't lock up 
2025-09-01 15:32:58 +02:00
Leonard Hecker
5899343237 Fix a race condition around Open/CloseClipboard (#19297)
tl;dr: Open/CloseClipboard are surprisingly not thread-safe.

## Validation Steps Performed
* Copy a large amount of text (>1MB)
* Run `edit.exe`
* Press and hold Ctrl+Shift+V
* Doesn't crash 
2025-08-29 20:20:53 +02:00
Windows Console Service Bot
1283c0f5b9 Localization Updates - main - 08/26/2025 03:03:22 (#19278) 2025-08-29 00:32:22 +02:00
Dustin L. Howett
4272151adc Include Profile.BellSound as a media resource (#19289)
I legitimately cannot figure out how I forgot this. Bell should support
all the same validation as other media resources! Technically this means
you can set `bellSound` to `desktopWallpaper`, but... we'll pretend that
makes sense.

I reworked the viewmodel to be a little more sensible. It no longer
requires somebody else to check that its files exist. The settings UI
now also displays `File not found` in the _preview_ for the bell if it
is a single file which failed validation!
2025-08-28 00:05:51 +00:00
Dustin L. Howett
bd14f69080 sb: add appId to the StoreBroker blobs (new AERO requirement) (#19290)
> _I am altering the deal. Pray I do not alter it further._
> -the AERO team, maybe
2025-08-27 10:22:28 -07:00
Dustin L. Howett
91c9a14a71 env: don't explode when GetShortPathNameW fails (#19284)
It fails inside app containers (!) such as the one used by LocalTests.
2025-08-26 21:50:32 +00:00
Dustin L. Howett
9e10436a80 Move adjustProcessPriorityThrottled ctor earlier (#19283)
Test Impact: The LocalTests do not call `Initialize(HWND)`, so we would
fail on launch.
Also, we have `Create()` and `Initialize()` and `event Initialized` (the
last of which is not called from either of the first two...)
2025-08-26 21:34:01 +00:00
Dustin L. Howett
a9b660cc36 version: bump to 1.25 on main (#19276) 2025-08-25 17:06:19 -05:00
Dustin L. Howett
7b754e3d8e Localization Updates - 08/25/2025 21:39:33 (#19277)
Co-authored-by: Console Service Bot <consvc@microsoft.com>
2025-08-25 17:02:41 -05:00
140 changed files with 6257 additions and 4099 deletions

View File

@@ -1585,6 +1585,7 @@ SLGP
SLIST
slmult
sln
slnx
slpit
SManifest
SMARTQUOTE

File diff suppressed because it is too large Load Diff

1070
OpenConsole.slnx Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -375,7 +375,7 @@ winget configure .config\configuration.winget
## Building the Code
OpenConsole.sln may be built from within Visual Studio or from the command-line
OpenConsole.slnx may be built from within Visual Studio or from the command-line
using a set of convenience scripts & tools in the **/tools** directory:
### Building in PowerShell

View File

@@ -56,11 +56,11 @@ Dies ist ein Open Source-Projekt, und wir freuen uns über die Teilnahme der Com
<ReleaseNotes>
Version __VERSION_NUMBER__
- Wir haben der Benutzeroberfläche durchschnittliche Einstellungen hinzugefügt, die nur einmal in der JSON-Datei vorhanden waren, einschließlich einer neuen Seite zum Anpassen des Layouts Ihres Menüs "Neue Registerkarte"!
- Wir haben die Fensterverwaltung zurückgesetzt, um die Zuverlässigkeit zu verbessern; Melden Sie alle Fehler, die mit dem alias "wt.exe" auftreten.
- Profile zeigen jetzt ein Symbol an, wenn sie ausgeblendet wurden oder auf programme verweisen, die deinstalliert wurden.
Eine komplett neue Erweiterungsseite, die anzeigt, was in Ihrem Terminal installiert ist
Die Befehlspalette wird jetzt sowohl in Ihrer Muttersprache als auch auf Englisch angezeigt
Neue VT-Features wie synchronisiertes Rendering, neue Farbschemas, Konfiguration für schnelle Mausaktionen wie Zoomen und mehr
Weitere Details finden Sie auf unserer GitHub-Releasesseite.
Weitere Informationen finden Sie auf unserer GitHub-Releaseseite.
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -56,11 +56,11 @@ Este es un proyecto de fuente abierta y animamos a la comunidad a participar. Pa
<ReleaseNotes>
Versión __VERSION_NUMBER__
- Hemos agregado decenas de configuraciones a la interfaz de usuario que solo existían una vez en el archivo JSON, incluida una página nueva para personalizar el diseño del menú Nueva pestaña.
- Tenemos administración de ventanas rearchitecdas para mejorar la confiabilidad; envíe los errores que encuentre con el alias de wt.exe.
- Ahora, los perfiles muestran un icono si se han ocultado o hacen referencia a programas que se han desinstalado.
- Página Extensiones completamente nueva que muestra lo que se ha instalado en tu terminal
- La paleta de comandos ahora se muestra en tu idioma nativo, así como en inglés
- Nuevas características de VT, como la representación sincronizada, nuevos esquemas de color, configuración para acciones rápidas del ratón, como el zoom, y más
Consulte nuestra página de versiones de GitHub para obtener más detalles.
Consulta la página de versiones de GitHub para más información.
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -54,13 +54,13 @@ Il sagit dun projet open source et nous vous invitons à participer dans l
</DevStudio>
<ReleaseNotes>
__VERSION_NUMBER__ de version
Version __VERSION_NUMBER__
- Nous avons ajouté des milliers de paramètres à linterface utilisateur qui nexistaient auparavant que dans le fichier JSON, y compris une nouvelle page pour personnaliser la disposition de votre menu Nouvel onglet !
- Nous avons réarchitialiser la gestion des fenêtres pour améliorer la fiabilité ; entrez les bogues rencontrés avec lalias wt.exe
- Les profils affichent désormais une icône sils ont été masqués ou sils font référence à des programmes qui ont été désinstallés.
- Une toute nouvelle page Extensions qui montre ce qui a été installé dans votre terminal
- La palette de commandes saffiche désormais dans votre langue native, ainsi quen anglais
- Nouvelles fonctionnalités VT telles que le rendu synchronisé, de nouveaux schémas de couleurs, la configuration pour des actions rapides de la souris comme le zoom, et plus encore
Pour plus dinformations, consultez notre page des mises en production GitHub.
Veuillez consulter notre page des versions GitHub pour découvrir dautres détails.
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -54,13 +54,13 @@ Si tratta di un progetto open source e la partecipazione della community è molt
</DevStudio>
<ReleaseNotes>
Versione __VERSION_NUMBER__
Versione __VERSION_NUMBER__
- Sono state aggiunte decine di impostazioni all'interfaccia utente che una volta esisteva solo nel file JSON, inclusa una nuova pagina per personalizzare il layout del menu Nuova scheda.
- È stata riattivata la gestione delle finestre per migliorare l'affidabilità; inserire eventuali bug riscontrati con l'alias wt.exe
- I profili ora mostrano un'icona se sono stati nascosti o fanno riferimento ai programmi che sono stati disinstallati.
- Una pagina Estensioni completamente nuova che mostra ciò che è stato installato nel terminale
- Il riquadro comandi ora viene visualizzato nella tua lingua di origine oltre che in inglese
- Nuove funzionalità VT come il rendering sincronizzato, le nuove combinazioni di colori, la configurazione per azioni rapide del mouse come lo zoom e altro ancora
Per altri dettagli, vedere la pagina delle versioni di GitHub.
Per altri dettagli, vedi la pagina delle release di GitHub.
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -56,11 +56,11 @@
<ReleaseNotes>
バージョン __VERSION_NUMBER__
- [新しいタブ] メニューのレイアウトをカスタマイズするための新しいページを含む、一度だけ JSON ファイルに存在した UI に多数の設定を追加しました。
- 信頼性を向上させるためにウィンドウ管理を再選択しました。wt.exe エイリアスで発生したバグを報告してください
- プロファイルが非表示になっているか、アンインストールされたプログラムを参照している場合にアイコンが表示されるようになりました。
- ターミナルに何がインストールされているかを表示する新しい [拡張機能] ページ
- コマンド パレットがネイティブ言語と英語で表示されるようになりました
- 同期レンダリング、新しい配色、ズームなどのクイック マウス操作の構成などの、新しい VT 機能
詳細については、GitHub リリース ページを参照してください。
詳細については、GitHub リリース ページをご覧ください。
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -56,9 +56,9 @@
<ReleaseNotes>
버전 __VERSION_NUMBER__
- 새 탭 메뉴의 레이아웃을 사용자 지정하기 위한 새 페이지를 포함하여 JSON 파일에 한 번만 존재했던 UI에 수천 개의 설정을 추가했습니다.
- 안정성을 개선하기 위해 창 관리를 다시 보관했습니다. wt.exe 별칭에 발생한 버그를 제출하세요.
- 프로필이 숨겨졌거나 제거된 프로그램을 참조하는 경우 이제 프로필에 아이콘이 표시됩니다.
- 터미널에 설치된 항목을 보여 주는 완전히 새로운 확장 페이지
- 명령 팔레트가 이제 영어뿐만 아니라 모국어로도 표시
- 동기화된 렌더링, 새로운 색 구성표, 확대/축소와 같은 빠른 마우스 동작을 위한 구성 등 새로운 VT 기능이 추가
자세한 내용은 GitHub 릴리스 페이지를 참조하세요.
</ReleaseNotes>

View File

@@ -54,13 +54,13 @@ Este é um projeto de código aberto e a participação da comunidade é bem-vin
</DevStudio>
<ReleaseNotes>
Versão __VERSION_NUMBER__
Version __VERSION_NUMBER__
- Adicionamos várias configurações à interface do usuário que só existiam no arquivo JSON, incluindo uma nova página para personalizar o layout do menu Nova Guia!
- Temos o gerenciamento de janelas rearmado para melhorar a confiabilidade; registre todos os bugs encontrados com o wt.exe alias
- Os perfis agora mostram um ícone se eles foram ocultos ou se referem a programas que foram desinstalados.
Uma nova página de Extensões que mostra o que foi instalado no seu Terminal
A Paleta de Comandos agora aparece no seu idioma nativo, além do inglês
Novos recursos da VT, como renderização sincronizada, novos esquemas de cores, configuração para ações rápidas do mouse, como zoom, e muito mais
Consulte nossa página de versões do GitHub para obter detalhes adicionais.
Confira nossa página de lançamentos no GitHub para obter mais detalhes.
</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

@@ -56,9 +56,9 @@
<ReleaseNotes>
Версия __VERSION_NUMBER__
- Мы добавили в пользовательский интерфейс десятки параметров, которые существовали только в JSON-файле, включая новую страницу для настройки макета меню "Новая вкладка".
- Для повышения надежности мы переупоряхлили управление окнами; создайте все ошибки, обнаруженные с wt.exe псевдонимом
- Профили теперь показывают значок, если они скрыты или ссылаются на программы, которые были удалены.
Новая страница расширений, на которой отображается информация о том, что было установлено в вашем терминале
Палитра команд теперь доступна на вашем языке, а также на английском
Новые функции VT, например синхронизированная отрисовка, новые цветовые схемы, настройка быстрых действий мыши, таких как масштабирование, и т. д.
Дополнительные сведения см. на странице выпусков GitHub.
</ReleaseNotes>

View File

@@ -54,13 +54,13 @@
</DevStudio>
<ReleaseNotes>
版本 __VERSION_NUMBER__
Version __VERSION_NUMBER__
- 我们向用户界面添加了许多设置,这些设置仅存在于 JSON 文件中,包括用于自定义“新建标签页”菜单布局的新页面!
- 我们已重新检测窗口管理以提高可靠性;请将遇到的任何 bug 归档为 wt.exe 别名
- 如果配置文件已隐藏或引用已卸载的程序,则它们现在将显示一个图标。
- 一个全新的“扩展”页,显示已安装到终端的内容
- 命令面板现在以你的母语和英语显示
- 新的 VT 功能,例如同步渲染、新配色方案、快速鼠标操作(如缩放)的配置等
有关其他详细信息,请参阅 GitHub 发布页面。
有关其他详细信息,请参阅我们的 GitHub 发布页面。
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

@@ -54,13 +54,13 @@
</DevStudio>
<ReleaseNotes>
版本 __VERSION_NUMBER__
Version __VERSION_NUMBER__
- 我們已新增數十個只存在於 JSON 檔案中的設定到 UI包括自定義 [新索引標籤] 功能表版面配置的新頁面!
- 我們已重新設定視窗管理,以改善可靠性;請提出您在 wt.exe 別名遇到的任何錯誤
- 設定文件現在會在隱藏或參照已卸載的程式時顯示圖示。
- 全新的延伸模組頁面會顯示已安裝在您終端機中的內容
- 命令選擇區現在以您的母語和英文顯示
- 新的 VT 功能,例如同步轉譯、新的色彩配置、快速滑鼠動作 (例如縮放) 設定等等
如需詳細數據,請參閱我們的 GitHub 版本頁面。
如需更多詳細資料,請參閱我們的 GitHub 發行版本頁面。
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

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

View File

@@ -56,12 +56,9 @@ Dies ist ein Open Source-Projekt, und wir freuen uns über die Teilnahme an der
<ReleaseNotes>
Version __VERSION_NUMBER__
Wir haben umgeschrieben, wie Konsolenanwendungen im Terminal gehostet werden! Melden Sie alle auftretenden Fehler.
Terminal unterstützt jetzt Sixels!
Sie können jetzt einen angedockten Bereich öffnen, der Ausschnitte von Befehlen enthält, die Sie gespeichert haben, um sie später zu verwenden.
Für Benutzer der Eingabeaufforderung der neuesten Version von Windows 11 wird möglicherweise ein QuickInfo-Symbol angezeigt, das installierbare Software von WinGet vorschlägt.
Ausgewählter Text wird jetzt viel sichtbarer (und anpassbarer!).
- Eine Reihe von Zuverlässigkeitsfehlern, Benutzerfreundlichkeitsproblemen und Ärgernissen wurden behoben.
Wir haben der Benutzeroberfläche Dutzende von Einstellungen hinzugefügt, die nur einmal in der JSON-Datei vorhanden waren, einschließlich einer neuen Seite zum Anpassen des Layouts Ihres Menüs „Neue Registerkarte“!
Wir haben die Fensterverwaltung umgestaltet, um die Zuverlässigkeit zu verbessern. Melden Sie alle Fehler, die beim alias „wt.exe“ auftreten
Profile zeigen jetzt ein Symbol an, wenn sie ausgeblendet wurden oder auf Programme verweisen, die deinstalliert wurden.
Weitere Informationen finden Sie auf unserer GitHub-Releaseseite.
</ReleaseNotes>

View File

@@ -56,12 +56,9 @@ Este es un proyecto de fuente abierta y animamos a la comunidad a participar. Pa
<ReleaseNotes>
Versión __VERSION_NUMBER__
- Hemos reescrito cómo se hospedan las aplicaciones de consola en Terminal. Informe de los errores que encuentre.
- Terminal ahora admite síxeles.
- Ahora puede abrir un panel acoplado que contenga fragmentos de comandos que haya guardado para usarlos más adelante
- Los usuarios del símbolo del sistema de la versión más reciente de Windows 11 pueden ver un icono de "sugerencia rápida" que sugiere software instalable de WinGet
- El texto seleccionado ahora será mucho más visible (y personalizable)
- Se han corregido varios errores de fiabilidad, problemas de comodidad y molestias.
- Hemos añadido decenas de configuraciones a la interfaz de usuario que antes solo existían en el archivo JSON, incluida una nueva página para personalizar el diseño del menú Nueva pestaña.
- Hemos reestructurado la gestión de ventanas para mejorar la fiabilidad; informe de cualquier error que encuentre con el alias wt.exe
- Ahora, los perfiles muestran un icono si han sido ocultados o hacen referencia a programas que han sido desinstalados.
Consulte la página de versiones de GitHub para más información.
</ReleaseNotes>

View File

@@ -56,12 +56,9 @@ Il sagit dun projet open source et nous encourageons la participation à l
<ReleaseNotes>
Version __VERSION_NUMBER__
Nous avons réécrit la manière dont les applications de console sont hébergées dans Terminal ! Veuillez signaler tout bogue que vous rencontrez.
Terminal prend désormais en charge Sixels !
Vous pouvez maintenant ouvrir un panneau ancré contenant des extraits de commandes que vous avez enregistrées pour les utiliser ultérieurement
Les utilisateurs de linvite de commande sur la dernière version de Windows 11 peuvent voir une icône « astuce rapide » qui suggère un logiciel installable à partir de WinGet
Le texte sélectionné sera désormais beaucoup plus visible (et personnalisable !)
Un certain nombre de bogues de fiabilité, de problèmes de commodité et de désagréments ont été corrigés.
- Nous avons ajouté des dizaines de paramètres à linterface utilisateur qui nexistaient auparavant que dans le fichier JSON, y compris une nouvelle page pour personnaliser la disposition de votre menu Nouvel onglet.
- Nous avons fait une refonte de la gestion des fenêtres pour améliorer la fiabilité. Veuillez signaler les bogues que vous rencontrez avec lalias wt.exe.
- Les profils affichent désormais une icône sils ont été masqués ou sils font référence à des programmes qui ont été désinstallés.
Veuillez consulter notre page des versions GitHub pour découvrir dautres détails.
</ReleaseNotes>

View File

@@ -56,12 +56,9 @@ Si tratta di un progetto open source e la partecipazione della community è molt
<ReleaseNotes>
Versione __VERSION_NUMBER__
- Abbiamo cambiato il modo in cui le applicazioni della console vengono ospitate allinterno di Terminale. Segnala eventuali bug riscontrati.
- Ora Terminale supporta i Sixel.
- Puoi aprire un pannello ancorato contenente frammenti di comandi salvati per usarli in seguito
- Gli utenti che usano il prompt dei comandi nella versione più recente di Windows 11 potrebbero visualizzare unicona di “suggerimento rapido” che consiglia il software installabile da WinGet
- Il testo selezionato sarà ora molto più visibile, oltre che personalizzabile.
- Sono stati risolti diversi bug di affidabilità e problemi di ordine pratico.
- Abbiamo aggiunto decine di impostazioni all'interfaccia utente che in precedenza esistevano solo nel file JSON, inclusa una nuova pagina per personalizzare il layout del menu Nuova scheda.
- Abbiamo riprogettato la gestione delle finestre per migliorarne l'affidabilità; segnala eventuali bug riscontrati con l'alias wt.exe
- I profili ora mostrano un'icona se sono stati nascosti o se fanno riferimento a programmi disinstallati.
Per altri dettagli, vedi la pagina delle release di GitHub.
</ReleaseNotes>

View File

@@ -56,12 +56,9 @@
<ReleaseNotes>
バージョン __VERSION_NUMBER__
- ターミナル内でのコンソール アプリケーションのホスト方法を書き換えました。発生したバグを報告してください
- ターミナルで Sixels がサポートされるようになりました。
- 後で使用するために保存したコマンドのスニペットを含むドッキング パネルを開けるようになりました
- 最新の Windows 11 リリースのコマンド プロンプト ユーザーには、WinGet からインストール可能なソフトウェアを提案する "クイック ヒント" アイコンが表示される場合があります
- 選択したテキストが大幅に見やすくなりました (カスタマイズも可能です)
- 信頼性に関するバグ、利便性の問題、不快な問題の多くが修正されました。
- 新しいタブ メニューのレイアウトをカスタマイズするための新しいページなど、以前は JSON ファイルにしかなかった設定が UI に多数追加されました
- 信頼性を向上させるために、ウィンドウ管理を再設計しました。wt.exe エイリアスで発生したバグを報告してください
- プロファイルが非表示になっている場合や、アンインストールされたプログラムを参照している場合に、アイコンが表示されるようになりました
詳細については、GitHub リリース ページをご覧ください。
</ReleaseNotes>

View File

@@ -56,12 +56,9 @@
<ReleaseNotes>
버전 __VERSION_NUMBER__
- 콘솔 애플리케이션이 터미널 내에서 호스팅되는 방법을 다시 작성했습니다. 버그가 발생하면 보고해 주세요.
- 터미널에서 이제 Sixels를 지원합니다.
- 이제 나중에 사용하기 위해 저장한 명령 조각이 포함된 도킹된 패널을 열 수 있습니다.
- 최신 Windows 11 릴리스의 명령 프롬프트 사용자는 WinGet에서 설치 가능한 소프트웨어를 추천하는 "간단한 팁" 아이콘을 볼 수 있습니다.
- 이제 선택한 텍스트가 훨씬 더 잘 보입니다(사용자 지정 가능).
- 여러 안정성 버그, 편의성 문제, 불편 사항이 수정되었습니다.
- 새 탭 메뉴의 레이아웃을 사용자 지정하기 위한 새 페이지를 포함하여 JSON 파일에만 존재했던 수십 개의 설정을 UI에 추가
- 안정성을 개선하기 위해 창 관리 구조를 재구성했습니다. wt.exe 별칭과 관련하여 발생한 버그 신고
- 프로필이 숨겨졌거나 제거된 프로그램을 참조하는 경우 이제 프로필에 아이콘이 표시됩니다.
자세한 내용은 GitHub 릴리스 페이지를 참조하세요.
</ReleaseNotes>

View File

@@ -54,14 +54,11 @@ Este é um projeto de código aberto e a participação da comunidade é bem-vin
</DevStudio>
<ReleaseNotes>
Versão __VERSION_NUMBER__
Version __VERSION_NUMBER__
Reescrevemos a forma como os aplicativos de console são hospedados no Terminal! Relate os bugs encontrados.
O terminal agora oferece suporte ao Sixels!
Agora você pode abrir um painel acoplado contendo snippets de comandos que você salvou para usar mais tarde
Os usuários do Prompt de Comando na versão mais recente do Windows 11 podem ver um ícone de "dica rápida", que sugere softwares instaláveis a partir do WinGet
O texto selecionado agora ficará muito mais visível (e personalizável!)
Vários bugs de confiabilidade, problemas de conveniência e incômodos foram resolvidos.
Adicionamos várias configurações à interface do usuário que antes só existiam no arquivo JSON, incluindo uma nova página para personalizar o layout do seu menu Nova Guia!
Reestruturamos o gerenciamento de janelas para melhorar a confiabilidade; registre os bugs que você encontrar com o alias wt.exe
Os perfis agora exibem um ícone se estiverem ocultos ou se referirem a programas que foram desinstalados.
Confira nossa página de lançamentos no GitHub para obter mais detalhes.
</ReleaseNotes>

View File

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

View File

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

View File

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

View File

@@ -56,12 +56,9 @@
<ReleaseNotes>
Версия __VERSION_NUMBER__
Мы переписали, как консольные приложения размещаются внутри Терминала! Сообщайте о любых ошибках, с которыми вы столкнулись.
Терминал теперь поддерживает форматы Sixel!
Теперь вы можете открыть закрепленную панель, содержащую фрагменты команд, которые вы сохранили для использования в дальнейшем
Пользователи командной строки в новейшем выпуске Windows 11 могут увидеть значок "краткой подсказки", который предлагает устанавливаемые программы из WinGet
Выделенный текст теперь станет более видимым (и настраиваемым!)
Исправлено несколько ошибок надежности, проблем с удобством, а также устранены раздражающие моменты.
Мы добавили в пользовательский интерфейс десятки параметров, которые ранее существовали только в JSON-файле, включая новую страницу для настройки макета меню новой вкладки.
Мы переработали управление окнами для повышения надежности. Сообщайте о любых ошибках, которые вы обнаружите с псевдонимом wt.exe
Профили теперь отображают значок, если они были скрыты или ссылаются на программы, которые были удалены.
Дополнительные сведения см. на странице выпусков GitHub.
</ReleaseNotes>

View File

@@ -56,12 +56,9 @@
<ReleaseNotes>
Version __VERSION_NUMBER__
- 我们已改变主机应用程序在终端内的托管方式!请报告遇到的任何 bug。
- 终端现在支持 Sixels!
- 现在可以打开一个停靠面板,其中包含已保存供以后使用的命令片段
- 最新 Windows 11 版本上的命令提示用户可能会看到“快速提示”图标,该图标建议从 WinGet 安装软件
- 所选文本现在将具有更高的可见性(和可自定义性!)
- 修复了许多可靠性 bug、便利性问题和令人烦恼的问题。
- 我们向用户界面添加了许多之前仅存在于 JSON 文件中的设置,包括用于自定义“新建标签页”菜单布局的新页面!
- 我们已重新架构窗口管理以提高可靠性; 请使用 wt.exe 别名提交您遇到的任何错误
- 配置文件如果已被隐藏或引用了已卸载的程序,现在会显示一个图标。
有关其他详细信息,请参阅我们的 GitHub 发布页面。
</ReleaseNotes>

View File

@@ -54,16 +54,13 @@
</DevStudio>
<ReleaseNotes>
版本 __VERSION_NUMBER__
Version __VERSION_NUMBER__
- 我們已重寫主機應用程式在終端機內託管的方式!請報告您遇到的錯誤。
- 終端機現在支援 Sixels!
- 現在,您可以開啟包含已儲存命令程式碼片段的固定面板,以供稍後使用
- 最新 Windows 11 版本中的 [命令提示] 使用者可能會看到「快速提示」圖示,建議可自 WinGet 安裝的軟體
- 選取的文字現在會更明顯 (且可自訂!)
- 已修正一些可靠性錯誤、便利性問題和令人困擾的問題。
- 我們已在使用者介面中新增數十個曾經僅存在於 JSON 檔案中的設定,包括一個可自訂新索引標籤選單版面配置的新頁面!
- 我們已重新架構視窗管理以提升可靠性; 如果您在使用 wt.exe 別名時遇到任何錯誤,請提交錯誤回報
- 如果設定檔已隱藏或參照已解除安裝的程式,現在會顯示圖示。
如需更多詳細資,請參閱我們的 GitHub 發行頁面。
如需更多詳細資,請參閱我們的 GitHub 發行版本頁面。
</ReleaseNotes>
<ScreenshotCaptions>
<!-- Valid length: 200 character limit, up to 9 elements per platform -->

View File

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

View File

@@ -100,3 +100,54 @@ stages:
platform: ${{ platform }}
# The tests might be run more than once; log one artifact per attempt.
outputArtifactStem: -$(System.JobAttempt)
- stage: Build_AnyCPU
displayName: Build Any CPU
dependsOn: []
jobs:
- template: ./templates-v2/job-build-project.yml
parameters:
jobName: BuildWPF
pool:
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
name: SHINE-INT-L
${{ else }}:
name: SHINE-OSS-L
buildTerminal: false
buildWPFDotNetComponents: true
buildPlatforms:
- Any CPU
buildConfigurations: [Release]
keepAllExpensiveBuildOutputs: false
- stage: Package
displayName: Package
variables:
XES_APPXMANIFESTVERSION: 0.1.0.0
XES_PACKAGEVERSIONNUMBER: 0.0.0.1
pool:
${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}:
name: SHINE-INT-L
${{ else }}:
name: SHINE-OSS-L
dependsOn:
- ${{ each platform in parameters.buildPlatforms }}:
- Build_${{ platform }}
- Build_AnyCPU
jobs:
- template: ./templates-v2/job-merge-msix-into-bundle.yml
parameters:
jobName: Bundle
buildConfigurations: [Release]
buildPlatforms: ${{ parameters.buildPlatforms }}
branding: Dev
- template: ./templates-v2/job-package-conpty.yml
parameters:
buildConfigurations: [Release]
buildPlatforms: ${{ parameters.buildPlatforms }}
- template: ./templates-v2/job-build-package-wpf.yml
parameters:
buildConfigurations: [Release]
buildPlatforms: ${{ parameters.buildPlatforms }}

View File

@@ -75,9 +75,9 @@ jobs:
- template: .\steps-restore-nuget.yml
- task: VSBuild@1
displayName: Build solution OpenConsole.sln for WPF Control (Pack)
displayName: Build solution OpenConsole.slnx for WPF Control (Pack)
inputs:
solution: 'OpenConsole.sln'
solution: 'OpenConsole.slnx'
msbuildArgs: >-
/p:WindowsTerminalReleaseBuild=true;Version=$(XES_PACKAGEVERSIONNUMBER)
/p:NoBuild=true

View File

@@ -170,9 +170,9 @@ jobs:
- ${{ parameters.beforeBuildSteps }}
- task: VSBuild@1
displayName: Build OpenConsole.sln
displayName: Build OpenConsole.slnx
inputs:
solution: 'OpenConsole.sln'
solution: 'OpenConsole.slnx'
msbuildArgs: >-
/p:WindowsTerminalOfficialBuild=true;WindowsTerminalBranding=${{ parameters.branding }};PGOBuildMode=${{ parameters.pgoBuildMode }}
${{ parameters.additionalBuildOptions }}

View File

@@ -19,14 +19,16 @@ steps:
restoreSolution: build/packages.config
restoreDirectory: '$(Build.SourcesDirectory)\packages'
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
- task: VSBuild@1
displayName: Restore NuGet packages for solution
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: OpenConsole.sln
restoreDirectory: '$(Build.SourcesDirectory)\packages'
solution: 'OpenConsole.slnx'
msbuildArgs: /t:Restore
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
msbuildArchitecture: x64
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
- task: 333b11bd-d341-40d9-afcf-b32d5ce6f23b@2
displayName: Restore NuGet packages for global nuget

View File

@@ -5,7 +5,7 @@
<XesUseOneStoreVersioning>true</XesUseOneStoreVersioning>
<XesBaseYearForStoreVersion>2025</XesBaseYearForStoreVersion>
<VersionMajor>1</VersionMajor>
<VersionMinor>24</VersionMinor>
<VersionMinor>25</VersionMinor>
<VersionInfoProductName>Windows Terminal</VersionInfoProductName>
<VersionInfoCulture>1033</VersionInfoCulture>
<!-- The default has a spacing problem -->

View File

@@ -7,7 +7,7 @@ This repository uses [git submodules](https://git-scm.com/book/en/v2/Git-Tools-S
git submodule update --init --recursive
```
OpenConsole.sln may be built from within Visual Studio or from the command-line using a set of convenience scripts & tools in the **/tools** directory:
OpenConsole.slnx may be built from within Visual Studio or from the command-line using a set of convenience scripts & tools in the **/tools** directory:
When using Visual Studio, be sure to set up the path for code formatting. To download the required clang-format.exe file, follow one of the building instructions below and run:
```powershell
@@ -103,7 +103,7 @@ If you want to use .nupkg files instead of the downloaded Nuget package, you can
The Terminal is bundled as an `.msix`, which is produced by the `CascadiaPackage.wapproj` project. To build that project from the commandline, you can run the following (from a window you've already run `tools\razzle.cmd` in):
```cmd
"%msbuild%" "%OPENCON%\OpenConsole.sln" /p:Configuration=%_LAST_BUILD_CONF% /p:Platform=%ARCH% /p:AppxSymbolPackageEnabled=false /t:Terminal\CascadiaPackage /m
"%msbuild%" "%OPENCON%\OpenConsole.slnx" /p:Configuration=%_LAST_BUILD_CONF% /p:Platform=%ARCH% /p:AppxSymbolPackageEnabled=false /t:Terminal\CascadiaPackage /m
```
This takes quite some time, and only generates an `msix`. It does not install the msix. To deploy the package:

View File

@@ -5,12 +5,14 @@
#include "../TerminalApp/TerminalPage.h"
#include "../UnitTests_SettingsModel/TestUtils.h"
#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h"
using namespace Microsoft::Console;
using namespace WEX::Logging;
using namespace WEX::TestExecution;
using namespace WEX::Common;
using namespace winrt::TerminalApp;
using namespace winrt::Microsoft::Terminal::Settings;
using namespace winrt::Microsoft::Terminal::Settings::Model;
using namespace winrt::Microsoft::Terminal::Control;
@@ -1419,10 +1421,10 @@ namespace TerminalAppLocalTests
VERIFY_ARE_EQUAL(L"profile0", terminalArgs.Profile());
VERIFY_IS_NULL(terminalArgs.Elevate());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, nullptr);
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());
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
}
{
Log::Comment(L"profile.elevate=true, action.elevate=nullopt: DO auto elevate");
@@ -1442,10 +1444,10 @@ namespace TerminalAppLocalTests
VERIFY_ARE_EQUAL(L"profile1", terminalArgs.Profile());
VERIFY_IS_NULL(terminalArgs.Elevate());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, nullptr);
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());
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(true, termSettings->Elevate());
}
{
Log::Comment(L"profile.elevate=false, action.elevate=nullopt: don't auto elevate");
@@ -1465,10 +1467,10 @@ namespace TerminalAppLocalTests
VERIFY_ARE_EQUAL(L"profile2", terminalArgs.Profile());
VERIFY_IS_NULL(terminalArgs.Elevate());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, nullptr);
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());
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
}
{
@@ -1490,10 +1492,10 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_FALSE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, nullptr);
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());
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
}
{
Log::Comment(L"profile.elevate=true, action.elevate=false: don't auto elevate");
@@ -1514,10 +1516,10 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_FALSE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, nullptr);
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());
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
}
{
Log::Comment(L"profile.elevate=false, action.elevate=false: don't auto elevate");
@@ -1538,10 +1540,10 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_FALSE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, nullptr);
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());
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(false, termSettings->Elevate());
}
{
@@ -1563,10 +1565,10 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_TRUE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, nullptr);
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());
VERIFY_ARE_EQUAL(L"cmd.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(true, termSettings->Elevate());
}
{
Log::Comment(L"profile.elevate=true, action.elevate=true: DO auto elevate");
@@ -1586,10 +1588,10 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_TRUE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, nullptr);
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());
VERIFY_ARE_EQUAL(L"pwsh.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(true, termSettings->Elevate());
}
{
Log::Comment(L"profile.elevate=false, action.elevate=true: DO auto elevate");
@@ -1610,10 +1612,10 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(terminalArgs.Elevate());
VERIFY_IS_TRUE(terminalArgs.Elevate().Value());
const auto termSettingsResult = TerminalSettings::CreateWithNewTerminalArgs(settings, terminalArgs, nullptr);
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());
VERIFY_ARE_EQUAL(L"wsl.exe", termSettings->Commandline());
VERIFY_ARE_EQUAL(true, termSettings->Elevate());
}
}

View File

@@ -66,7 +66,6 @@ namespace TerminalAppLocalTests
// can help you identify if something much lower in the stack has
// failed.
TEST_METHOD(EnsureTestsActivate);
TEST_METHOD(TryCreateSettingsType);
TEST_METHOD(TryCreateConnectionType);
TEST_METHOD(TryCreateXamlObjects);
@@ -131,23 +130,12 @@ namespace TerminalAppLocalTests
VERIFY_IS_TRUE(true);
}
void TabTests::TryCreateSettingsType()
{
// Verify we can create a WinRT type we authored
// Just creating it is enough to know that everything is working.
TerminalSettings settings;
VERIFY_IS_NOT_NULL(settings);
}
void TabTests::TryCreateConnectionType()
{
// Verify we can create a WinRT type we authored
// Just creating it is enough to know that everything is working.
winrt::Microsoft::Terminal::TerminalConnection::EchoConnection conn{};
VERIFY_IS_NOT_NULL(conn);
// We're doing this test separately from the TryCreateSettingsType test,
// to ensure both dependent binaries (TerminalSettings and
// TerminalConnection) both work individually.
}
void TabTests::TryCreateXamlObjects()
@@ -1306,6 +1294,15 @@ namespace TerminalAppLocalTests
});
}
static til::color _getControlBackgroundColor(winrt::TerminalApp::implementation::ContentManager* contentManager,
const winrt::Microsoft::Terminal::Control::TermControl& c)
{
auto interactivity{ contentManager->TryLookupCore(c.ContentId()) };
VERIFY_IS_NOT_NULL(interactivity);
const auto core{ interactivity.Core() };
return til::color{ core.BackgroundColor() };
}
void TabTests::TestPreviewCommitScheme()
{
Log::Comment(L"Preview a color scheme. Make sure it's applied, then committed accordingly");
@@ -1313,14 +1310,12 @@ namespace TerminalAppLocalTests
auto page = _commonSetup();
VERIFY_IS_NOT_NULL(page);
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, backgroundColor);
});
TestOnUIThread([&page]() {
@@ -1330,15 +1325,13 @@ namespace TerminalAppLocalTests
page->_PreviewAction(actionAndArgs);
});
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
Log::Comment(L"Color should be changed to the preview");
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, backgroundColor);
// And we should have stored a function to revert the change.
VERIFY_ARE_EQUAL(1u, page->_restorePreviewFuncs.size());
@@ -1352,15 +1345,13 @@ namespace TerminalAppLocalTests
page->_HandleSetColorScheme(nullptr, ActionEventArgs{ args });
});
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
Log::Comment(L"Color should be changed");
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, backgroundColor);
// After preview there should be no more restore functions to execute.
VERIFY_ARE_EQUAL(0u, page->_restorePreviewFuncs.size());
@@ -1381,14 +1372,12 @@ namespace TerminalAppLocalTests
auto page = _commonSetup();
VERIFY_IS_NOT_NULL(page);
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, backgroundColor);
});
TestOnUIThread([&page]() {
@@ -1398,15 +1387,13 @@ namespace TerminalAppLocalTests
page->_PreviewAction(actionAndArgs);
});
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
Log::Comment(L"Color should be changed to the preview");
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, backgroundColor);
});
TestOnUIThread([&page]() {
@@ -1414,15 +1401,13 @@ namespace TerminalAppLocalTests
page->_EndPreview();
});
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
Log::Comment(L"Color should be the same as it originally was");
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, backgroundColor);
});
Log::Comment(L"Sleep to let events propagate");
Sleep(250);
@@ -1437,14 +1422,12 @@ namespace TerminalAppLocalTests
auto page = _commonSetup();
VERIFY_IS_NOT_NULL(page);
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, backgroundColor);
});
TestOnUIThread([&page]() {
@@ -1453,15 +1436,13 @@ namespace TerminalAppLocalTests
page->_PreviewColorScheme(args);
});
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
Log::Comment(L"Color should be changed to the preview");
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, backgroundColor);
});
TestOnUIThread([&page]() {
@@ -1470,15 +1451,13 @@ namespace TerminalAppLocalTests
page->_PreviewColorScheme(args);
});
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
Log::Comment(L"Color should be changed to the preview");
VERIFY_ARE_EQUAL(til::color{ 0xffFAFAFA }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xffFAFAFA }, backgroundColor);
});
TestOnUIThread([&page]() {
@@ -1489,15 +1468,13 @@ namespace TerminalAppLocalTests
page->_HandleSetColorScheme(nullptr, ActionEventArgs{ args });
});
TestOnUIThread([&page]() {
TestOnUIThread([&page, this]() {
const auto& activeControl{ page->_GetActiveControl() };
VERIFY_IS_NOT_NULL(activeControl);
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);
Log::Comment(L"Color should be changed");
VERIFY_ARE_EQUAL(til::color{ 0xffFAFAFA }, til::color{ controlSettings.DefaultBackground() });
const auto backgroundColor{ _getControlBackgroundColor(_contentManager.get(), activeControl) };
VERIFY_ARE_EQUAL(til::color{ 0xffFAFAFA }, backgroundColor);
});
Log::Comment(L"Sleep to let events propagate");
Sleep(250);

View File

@@ -60,6 +60,9 @@
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalConnection\TerminalConnection.vcxproj" />
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalApp\dll\TerminalApp.vcxproj" />
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalSettingsModel\dll\Microsoft.Terminal.Settings.Model.vcxproj" />
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalSettingsAppAdapterLib\TerminalSettingsAppAdapterLib.vcxproj">
<Project>{3c46e2b0-ae6c-4132-9122-6772fb411959}</Project>
</ProjectReference>
</ItemGroup>
<!-- ========================= Globals ======================== -->

View File

@@ -22,6 +22,7 @@
<VcpkgAutoLink>false</VcpkgAutoLink>
<TerminalMUX>true</TerminalMUX>
<TerminalThemeHelpers>true</TerminalThemeHelpers>
<!--
These two properties are very important!
@@ -114,6 +115,9 @@
<Project>{CA5CAD1A-082C-4476-9F33-94B339494076}</Project>
</ProjectReference>
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\UIHelpers\UIHelpers.vcxproj">
<Project>{6515F03F-E56D-4DB4-B23D-AC4FB80DB36F}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup>

View File

@@ -5,6 +5,7 @@
#include "TerminalPage.h"
#include "Utils.h"
#include "../../types/inc/utils.hpp"
#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h"
#include <LibraryResources.h>
@@ -97,24 +98,19 @@ namespace winrt::TerminalApp::implementation
{
if (const auto& scheme{ _settings.GlobalSettings().ColorSchemes().TryLookup(args.SchemeName()) })
{
const auto backup = _restorePreviewFuncs.empty();
// Clear the saved preview funcs because we don't need to add a restore each time
// the preview color changes, we only need to be able to restore the last one.
_restorePreviewFuncs.clear();
_ApplyToActiveControls([&](const auto& control) {
// Stash a copy of the current scheme.
auto originalScheme{ control.ColorScheme() };
auto temporarySettings{ winrt::make_self<Settings::TerminalSettings>() };
temporarySettings->ApplyColorScheme(scheme);
control.ApplyPreviewColorScheme(temporarySettings.try_as<winrt::Microsoft::Terminal::Core::ICoreScheme>());
// Apply the new scheme.
control.ColorScheme(scheme.ToCoreScheme());
if (backup)
{
// Each control will emplace a revert into the
// _restorePreviewFuncs for itself.
_restorePreviewFuncs.emplace_back([=]() {
// On dismiss, restore the original scheme.
control.ColorScheme(originalScheme);
});
}
// Take a copy of the inputs, since they are pointers anyways.
_restorePreviewFuncs.emplace_back([=]() {
control.ResetPreviewColorScheme();
});
});
}
}

View File

@@ -8,6 +8,7 @@
#include "ScratchpadContent.h"
#include "../WinRTUtils/inc/WtExeUtils.h"
#include "../../types/inc/utils.hpp"
#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h"
#include "Utils.h"
using namespace winrt::Windows::ApplicationModel::DataTransfer;
@@ -668,8 +669,10 @@ namespace winrt::TerminalApp::implementation
{
if (const auto scheme = _settings.GlobalSettings().ColorSchemes().TryLookup(realArgs.SchemeName()))
{
auto temporarySettings{ winrt::make_self<Settings::TerminalSettings>() };
temporarySettings->ApplyColorScheme(scheme);
const auto res = _ApplyToActiveControls([&](auto& control) {
control.ColorScheme(scheme.ToCoreScheme());
control.SetOverrideColorScheme(temporarySettings.try_as<winrt::Microsoft::Terminal::Core::ICoreScheme>());
});
args.Handled(res);
}

View File

@@ -20,6 +20,7 @@
#include "TabRowControl.h"
#include "DebugTapConnection.h"
#include "..\TerminalSettingsModel\FileUtils.h"
#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h"
#include <shlobj.h>
@@ -74,7 +75,7 @@ namespace winrt::TerminalApp::implementation
{
return S_FALSE;
}
const auto settings{ TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings) };
const auto settings{ Settings::TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs) };
// Try to handle auto-elevation
if (_maybeElevate(newTerminalArgs, settings, profile))

View File

@@ -414,6 +414,9 @@
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\UIHelpers\UIHelpers.vcxproj">
<Project>{6515F03F-E56D-4DB4-B23D-AC4FB80DB36F}</Project>
</ProjectReference>
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalSettingsAppAdapterLib\TerminalSettingsAppAdapterLib.vcxproj">
<Project>{3c46e2b0-ae6c-4132-9122-6772fb411959}</Project>
</ProjectReference>
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\UIMarkdown\UIMarkdown.vcxproj">
<Project>{7615F03F-E56D-4DB4-B23D-BD4FB80DB36F}</Project>
<Private>true</Private>

View File

@@ -21,6 +21,7 @@
#include "TerminalSettingsCache.h"
#include "../../types/inc/ColorFix.hpp"
#include "../../types/inc/utils.hpp"
#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h"
#include "LaunchPositionRequest.g.cpp"
#include "RenameWindowRequestedArgs.g.cpp"
@@ -60,8 +61,42 @@ namespace winrt
namespace clipboard
{
wil::unique_close_clipboard_call open(HWND hwnd)
static SRWLOCK lock = SRWLOCK_INIT;
struct ClipboardHandle
{
explicit ClipboardHandle(bool open) :
_open{ open }
{
}
~ClipboardHandle()
{
if (_open)
{
ReleaseSRWLockExclusive(&lock);
CloseClipboard();
}
}
explicit operator bool() const noexcept
{
return _open;
}
private:
bool _open = false;
};
ClipboardHandle open(HWND hwnd)
{
// Turns out, OpenClipboard/CloseClipboard are not thread-safe whatsoever,
// and on CloseClipboard, the GetClipboardData handle may get freed.
// The problem is that WinUI also uses OpenClipboard (through WinRT which uses OLE),
// and so even with this mutex we can still crash randomly if you copy something via WinUI.
// Makes you wonder how many Windows apps are subtly broken, huh.
AcquireSRWLockExclusive(&lock);
bool success = false;
// OpenClipboard may fail to acquire the internal lock --> retry.
@@ -80,7 +115,12 @@ namespace clipboard
Sleep(sleep);
}
return wil::unique_close_clipboard_call{ success };
if (!success)
{
ReleaseSRWLockExclusive(&lock);
}
return ClipboardHandle{ success };
}
void write(wil::zwstring_view text, std::string_view html, std::string_view rtf)
@@ -220,16 +260,6 @@ namespace winrt::TerminalApp::implementation
}
}
_adjustProcessPriorityThrottled = std::make_shared<ThrottledFunc<>>(
DispatcherQueue::GetForCurrentThread(),
til::throttled_func_options{
.delay = std::chrono::milliseconds{ 100 },
.debounce = true,
.trailing = true,
},
[=]() {
_adjustProcessPriority();
});
_hostingHwnd = hwnd;
return S_OK;
}
@@ -241,7 +271,7 @@ namespace winrt::TerminalApp::implementation
if (_settings == nullptr)
{
// Create this only on the first time we load the settings.
_terminalSettingsCache = std::make_shared<TerminalSettingsCache>(settings, *_bindings);
_terminalSettingsCache = std::make_shared<TerminalSettingsCache>(settings);
}
_settings = settings;
@@ -410,6 +440,17 @@ namespace winrt::TerminalApp::implementation
// them.
_tabRow.ShowElevationShield(IsRunningElevated() && _settings.GlobalSettings().ShowAdminShield());
_adjustProcessPriorityThrottled = std::make_shared<ThrottledFunc<>>(
DispatcherQueue::GetForCurrentThread(),
til::throttled_func_options{
.delay = std::chrono::milliseconds{ 100 },
.debounce = true,
.trailing = true,
},
[=]() {
_adjustProcessPriority();
});
}
Windows::UI::Xaml::Automation::Peers::AutomationPeer TerminalPage::OnCreateAutomationPeer()
@@ -1423,7 +1464,7 @@ namespace winrt::TerminalApp::implementation
// Return value:
// - the desired connection
TerminalConnection::ITerminalConnection TerminalPage::_CreateConnectionFromSettings(Profile profile,
TerminalSettings settings,
IControlSettings settings,
const bool inheritCursor)
{
static const auto textMeasurement = [&]() -> std::wstring_view {
@@ -1473,9 +1514,8 @@ namespace winrt::TerminalApp::implementation
else
{
const auto environment = settings.EnvironmentVariables() != nullptr ?
settings.EnvironmentVariables().GetView() :
nullptr;
auto settingsInternal{ winrt::get_self<Settings::TerminalSettings>(settings) };
const auto environment = settingsInternal->EnvironmentVariables();
// Update the path to be relative to whatever our CWD is.
//
@@ -1497,7 +1537,7 @@ namespace winrt::TerminalApp::implementation
valueSet = TerminalConnection::ConptyConnection::CreateSettings(settings.Commandline(),
newWorkingDirectory,
settings.StartingTitle(),
settings.ReloadEnvironmentVariables(),
settingsInternal->ReloadEnvironmentVariables(),
_WindowProperties.VirtualEnvVars(),
environment,
settings.InitialRows(),
@@ -1551,20 +1591,20 @@ namespace winrt::TerminalApp::implementation
const auto& connection = control.Connection();
auto profile{ paneContent.GetProfile() };
TerminalSettingsCreateResult controlSettings{ nullptr };
Settings::TerminalSettingsCreateResult controlSettings{ nullptr };
if (profile)
{
// TODO GH#5047 If we cache the NewTerminalArgs, we no longer need to do this.
profile = GetClosestProfileForDuplicationOfProfile(profile);
controlSettings = TerminalSettings::CreateWithProfile(_settings, profile, *_bindings);
controlSettings = Settings::TerminalSettings::CreateWithProfile(_settings, profile);
// Replace the Starting directory with the CWD, if given
const auto workingDirectory = control.WorkingDirectory();
const auto validWorkingDirectory = !workingDirectory.empty();
if (validWorkingDirectory)
{
controlSettings.DefaultSettings().StartingDirectory(workingDirectory);
controlSettings.DefaultSettings()->StartingDirectory(workingDirectory);
}
// To facilitate restarting defterm connections: grab the original
@@ -1572,11 +1612,11 @@ namespace winrt::TerminalApp::implementation
// settings.
if (const auto& conpty{ connection.try_as<TerminalConnection::ConptyConnection>() })
{
controlSettings.DefaultSettings().Commandline(conpty.Commandline());
controlSettings.DefaultSettings()->Commandline(conpty.Commandline());
}
}
return _CreateConnectionFromSettings(profile, controlSettings.DefaultSettings(), true);
return _CreateConnectionFromSettings(profile, *controlSettings.DefaultSettings(), true);
}
// Method Description:
@@ -3377,13 +3417,11 @@ namespace winrt::TerminalApp::implementation
}
}
TermControl TerminalPage::_CreateNewControlAndContent(const TerminalSettingsCreateResult& settings, const ITerminalConnection& connection)
TermControl TerminalPage::_CreateNewControlAndContent(const Settings::TerminalSettingsCreateResult& settings, const ITerminalConnection& connection)
{
// Do any initialization that needs to apply to _every_ TermControl we
// create here.
// TermControl will copy the settings out of the settings passed to it.
const auto content = _manager.CreateCore(settings.DefaultSettings(), settings.UnfocusedSettings(), connection);
const auto content = _manager.CreateCore(*settings.DefaultSettings(), settings.UnfocusedSettings().try_as<IControlAppearance>(), connection);
const TermControl control{ content };
return _SetupControl(control);
}
@@ -3397,7 +3435,7 @@ namespace winrt::TerminalApp::implementation
// don't, then when we move the content to another thread, and it
// tries to handle a key, it'll callback on the original page's
// stack, inevitably resulting in a wrong_thread
return _SetupControl(TermControl::NewControlByAttachingContent(content, *_bindings));
return _SetupControl(TermControl::NewControlByAttachingContent(content));
}
return nullptr;
}
@@ -3417,6 +3455,8 @@ namespace winrt::TerminalApp::implementation
term.OwningHwnd(reinterpret_cast<uint64_t>(*_hostingHwnd));
}
term.KeyBindings(*_bindings);
_RegisterTerminalEvents(term);
return term;
}
@@ -3453,7 +3493,7 @@ namespace winrt::TerminalApp::implementation
return std::make_shared<Pane>(paneContent);
}
TerminalSettingsCreateResult controlSettings{ nullptr };
Settings::TerminalSettingsCreateResult controlSettings{ nullptr };
Profile profile{ nullptr };
if (const auto& tabImpl{ _GetTabImpl(sourceTab) })
@@ -3463,19 +3503,19 @@ namespace winrt::TerminalApp::implementation
{
// TODO GH#5047 If we cache the NewTerminalArgs, we no longer need to do this.
profile = GetClosestProfileForDuplicationOfProfile(profile);
controlSettings = TerminalSettings::CreateWithProfile(_settings, profile, *_bindings);
controlSettings = Settings::TerminalSettings::CreateWithProfile(_settings, profile);
const auto workingDirectory = tabImpl->GetActiveTerminalControl().WorkingDirectory();
const auto validWorkingDirectory = !workingDirectory.empty();
if (validWorkingDirectory)
{
controlSettings.DefaultSettings().StartingDirectory(workingDirectory);
controlSettings.DefaultSettings()->StartingDirectory(workingDirectory);
}
}
}
if (!profile)
{
profile = _settings.GetProfileForArgs(newTerminalArgs);
controlSettings = TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs, *_bindings);
controlSettings = Settings::TerminalSettings::CreateWithNewTerminalArgs(_settings, newTerminalArgs);
}
// Try to handle auto-elevation
@@ -3484,13 +3524,13 @@ namespace winrt::TerminalApp::implementation
return nullptr;
}
const auto sessionId = controlSettings.DefaultSettings().SessionId();
const auto sessionId = controlSettings.DefaultSettings()->SessionId();
const auto hasSessionId = sessionId != winrt::guid{};
auto connection = existingConnection ? existingConnection : _CreateConnectionFromSettings(profile, controlSettings.DefaultSettings(), hasSessionId);
auto connection = existingConnection ? existingConnection : _CreateConnectionFromSettings(profile, *controlSettings.DefaultSettings(), hasSessionId);
if (existingConnection)
{
connection.Resize(controlSettings.DefaultSettings().InitialRows(), controlSettings.DefaultSettings().InitialCols());
connection.Resize(controlSettings.DefaultSettings()->InitialRows(), controlSettings.DefaultSettings()->InitialCols());
}
TerminalConnection::ITerminalConnection debugConnection{ nullptr };
@@ -3734,7 +3774,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, *_bindings);
_terminalSettingsCache->Reset(_settings);
for (const auto& tab : _tabs)
{
@@ -4643,7 +4683,7 @@ namespace winrt::TerminalApp::implementation
// - true iff we tossed this request to an elevated window. Callers can use
// this result to early-return if needed.
bool TerminalPage::_maybeElevate(const NewTerminalArgs& newTerminalArgs,
const TerminalSettingsCreateResult& controlSettings,
const Settings::TerminalSettingsCreateResult& controlSettings,
const Profile& profile)
{
// When duplicating a tab there aren't any newTerminalArgs.
@@ -4656,7 +4696,7 @@ namespace winrt::TerminalApp::implementation
// If we don't even want to elevate we can return early.
// If we're already elevated we can also return, because it doesn't get any more elevated than that.
if (!defaultSettings.Elevate() || IsRunningElevated())
if (!defaultSettings->Elevate() || IsRunningElevated())
{
return false;
}
@@ -4666,7 +4706,7 @@ namespace winrt::TerminalApp::implementation
// will be that profile's GUID. If there wasn't, then we'll use
// whatever the default profile's GUID is.
newTerminalArgs.Profile(::Microsoft::Console::Utils::GuidToString(profile.Guid()));
newTerminalArgs.StartingDirectory(_evaluatePathForCwd(defaultSettings.StartingDirectory()));
newTerminalArgs.StartingDirectory(_evaluatePathForCwd(defaultSettings->StartingDirectory()));
_OpenElevatedWT(newTerminalArgs);
return true;
}

View File

@@ -29,6 +29,11 @@ namespace Microsoft::Terminal::Core
class ControlKeyStates;
}
namespace winrt::Microsoft::Terminal::Settings
{
struct TerminalSettingsCreateResult;
}
namespace winrt::TerminalApp::implementation
{
struct TerminalSettingsCache;
@@ -313,7 +318,7 @@ namespace winrt::TerminalApp::implementation
std::wstring _evaluatePathForCwd(std::wstring_view path);
winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection _CreateConnectionFromSettings(Microsoft::Terminal::Settings::Model::Profile profile, Microsoft::Terminal::Settings::Model::TerminalSettings settings, const bool inheritCursor);
winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection _CreateConnectionFromSettings(Microsoft::Terminal::Settings::Model::Profile profile, Microsoft::Terminal::Control::IControlSettings settings, const bool inheritCursor);
winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection _duplicateConnectionForRestart(const TerminalApp::TerminalPaneContent& paneContent);
void _restartPaneConnection(const TerminalApp::TerminalPaneContent&, const winrt::Windows::Foundation::IInspectable&);
@@ -456,7 +461,7 @@ namespace winrt::TerminalApp::implementation
void _Find(const Tab& tab);
winrt::Microsoft::Terminal::Control::TermControl _CreateNewControlAndContent(const winrt::Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult& settings,
winrt::Microsoft::Terminal::Control::TermControl _CreateNewControlAndContent(const winrt::Microsoft::Terminal::Settings::TerminalSettingsCreateResult& settings,
const winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection& connection);
winrt::Microsoft::Terminal::Control::TermControl _SetupControl(const winrt::Microsoft::Terminal::Control::TermControl& term);
winrt::Microsoft::Terminal::Control::TermControl _AttachControlToContent(const uint64_t& contentGuid);
@@ -511,7 +516,7 @@ namespace winrt::TerminalApp::implementation
winrt::Microsoft::Terminal::Settings::Model::Profile GetClosestProfileForDuplicationOfProfile(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile) const noexcept;
bool _maybeElevate(const winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs& newTerminalArgs,
const winrt::Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult& controlSettings,
const winrt::Microsoft::Terminal::Settings::TerminalSettingsCreateResult& controlSettings,
const winrt::Microsoft::Terminal::Settings::Model::Profile& profile);
void _OpenElevatedWT(winrt::Microsoft::Terminal::Settings::Model::NewTerminalArgs newTerminalArgs);

View File

@@ -127,11 +127,9 @@ namespace winrt::TerminalApp::implementation
// TODO:GH#9800 - we used to be able to persist the color scheme that a
// TermControl was initialized with, by name. With the change to having the
// control own its own copy of its settings, this isn't possible anymore.
//
// We may be able to get around this by storing the Name in the Core::Scheme
// object. That would work for schemes set by the Terminal, but not ones set
// by VT, but that seems good enough.
// control own its own copy of its settings, this wasn't possible anymore.
// It probably is once again possible, but Dustin doesn't know how to undo
// the damage done in the ControlSettings migration.
switch (kind)
{
@@ -279,7 +277,7 @@ namespace winrt::TerminalApp::implementation
auto sounds{ _profile.BellSound() };
if (sounds && sounds.Size() > 0)
{
winrt::hstring soundPath{ wil::ExpandEnvironmentStringsW<std::wstring>(sounds.GetAt(rand() % sounds.Size()).c_str()) };
winrt::hstring soundPath{ sounds.GetAt(rand() % sounds.Size()).Resolved() };
winrt::Windows::Foundation::Uri uri{ soundPath };
_playBellSound(uri);
}
@@ -347,9 +345,9 @@ namespace winrt::TerminalApp::implementation
const auto profile{ settings.FindProfile(_profile.Guid()) };
_profile = profile ? profile : settings.ProfileDefaults();
if (const auto& settings{ _cache->TryLookup(_profile) })
if (const auto settings{ _cache->TryLookup(_profile) })
{
_control.UpdateControlSettings(settings.DefaultSettings(), settings.UnfocusedSettings());
_control.UpdateControlSettings(settings->DefaultSettings(), settings->UnfocusedSettings());
}
}

View File

@@ -3,22 +3,27 @@
#include "pch.h"
#include "TerminalSettingsCache.h"
#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h"
namespace winrt
{
namespace MUX = Microsoft::UI::Xaml;
namespace WUX = Windows::UI::Xaml;
namespace MTSM = Microsoft::Terminal::Settings::Model;
}
namespace winrt::TerminalApp::implementation
{
TerminalSettingsCache::TerminalSettingsCache(const MTSM::CascadiaSettings& settings, const TerminalApp::AppKeyBindings& bindings)
TerminalSettingsPair::TerminalSettingsPair(const winrt::Microsoft::Terminal::Settings::TerminalSettingsCreateResult& result)
{
Reset(settings, bindings);
result.DefaultSettings().try_as(_defaultSettings);
result.UnfocusedSettings().try_as(_unfocusedSettings);
}
MTSM::TerminalSettingsCreateResult TerminalSettingsCache::TryLookup(const MTSM::Profile& profile)
TerminalSettingsCache::TerminalSettingsCache(const MTSM::CascadiaSettings& settings)
{
Reset(settings);
}
std::optional<TerminalSettingsPair> TerminalSettingsCache::TryLookup(const MTSM::Profile& profile)
{
const auto found{ profileGuidSettingsMap.find(profile.Guid()) };
// GH#2455: If there are any panes with controls that had been
@@ -30,18 +35,17 @@ namespace winrt::TerminalApp::implementation
auto& pair{ found->second };
if (!pair.second)
{
pair.second = MTSM::TerminalSettings::CreateWithProfile(_settings, pair.first, _bindings);
pair.second = winrt::Microsoft::Terminal::Settings::TerminalSettings::CreateWithProfile(_settings, pair.first);
}
return pair.second;
return std::optional{ TerminalSettingsPair{ *pair.second } };
}
return nullptr;
return std::nullopt;
}
void TerminalSettingsCache::Reset(const MTSM::CascadiaSettings& settings, const TerminalApp::AppKeyBindings& bindings)
void TerminalSettingsCache::Reset(const MTSM::CascadiaSettings& settings)
{
_settings = settings;
_bindings = bindings;
// 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.
@@ -51,12 +55,12 @@ namespace winrt::TerminalApp::implementation
profileGuidSettingsMap.reserve(allProfiles.Size() + 1);
// Include the Defaults profile for consideration
profileGuidSettingsMap.insert_or_assign(profileDefaults.Guid(), std::pair{ profileDefaults, nullptr });
profileGuidSettingsMap.insert_or_assign(profileDefaults.Guid(), std::pair{ profileDefaults, std::nullopt });
for (const auto& newProfile : allProfiles)
{
// Avoid creating a TerminalSettings right now. They're not totally cheap, and we suspect that users with many
// panes may not be using all of their profiles at the same time. Lazy evaluation is king!
profileGuidSettingsMap.insert_or_assign(newProfile.Guid(), std::pair{ newProfile, nullptr });
profileGuidSettingsMap.insert_or_assign(newProfile.Guid(), std::pair{ newProfile, std::nullopt });
}
}
}

View File

@@ -16,17 +16,34 @@ Abstract:
#include "winrt/Microsoft.Terminal.Settings.Model.h"
#include "winrt/TerminalApp.h"
namespace winrt::Microsoft::Terminal::Settings
{
struct TerminalSettingsCreateResult;
}
namespace winrt::TerminalApp::implementation
{
class TerminalSettingsPair
{
public:
TerminalSettingsPair(const winrt::Microsoft::Terminal::Settings::TerminalSettingsCreateResult& result);
winrt::Microsoft::Terminal::Control::IControlSettings DefaultSettings() const { return _defaultSettings; };
winrt::Microsoft::Terminal::Control::IControlSettings UnfocusedSettings() const { return _unfocusedSettings; };
private:
winrt::Microsoft::Terminal::Control::IControlSettings _defaultSettings{ nullptr };
winrt::Microsoft::Terminal::Control::IControlSettings _unfocusedSettings{ nullptr };
};
struct TerminalSettingsCache
{
TerminalSettingsCache(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings, const TerminalApp::AppKeyBindings& bindings);
Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult TryLookup(const Microsoft::Terminal::Settings::Model::Profile& profile);
void Reset(const Microsoft::Terminal::Settings::Model::CascadiaSettings& settings, const TerminalApp::AppKeyBindings& bindings);
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);
private:
Microsoft::Terminal::Settings::Model::CascadiaSettings _settings{ nullptr };
TerminalApp::AppKeyBindings _bindings{ nullptr };
std::unordered_map<winrt::guid, std::pair<Microsoft::Terminal::Settings::Model::Profile, Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult>> profileGuidSettingsMap;
std::unordered_map<winrt::guid, std::pair<Microsoft::Terminal::Settings::Model::Profile, std::optional<winrt::Microsoft::Terminal::Settings::TerminalSettingsCreateResult>>> profileGuidSettingsMap;
};
}

View File

@@ -13,6 +13,8 @@
#include "SettingsLoadEventArgs.g.cpp"
#include "WindowProperties.g.cpp"
#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h"
using namespace winrt::Windows::ApplicationModel;
using namespace winrt::Windows::ApplicationModel::DataTransfer;
using namespace winrt::Windows::Graphics::Display;
@@ -613,11 +615,11 @@ 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{ TerminalSettings::CreateWithNewTerminalArgs(_settings, nullptr, nullptr) };
const auto settings{ Settings::TerminalSettings::CreateWithNewTerminalArgs(_settings, nullptr) };
const til::size emptySize{};
const auto commandlineSize = _appArgs ? _appArgs->ParsedArgs().GetSize().value_or(emptySize) : til::size{};
proposedSize = TermControl::GetProposedDimensions(settings.DefaultSettings(),
proposedSize = TermControl::GetProposedDimensions(*settings.DefaultSettings(),
dpi,
commandlineSize.width,
commandlineSize.height);

View File

@@ -1,49 +0,0 @@
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
--*/
#pragma once
#include "../../inc/cppwinrt_utils.h"
#include "../../inc/ControlProperties.h"
#include <DefaultSettings.h>
#include <conattrs.hpp>
namespace winrt::Microsoft::Terminal::Control::implementation
{
struct ControlAppearance : public winrt::implements<ControlAppearance, Microsoft::Terminal::Core::ICoreAppearance, Microsoft::Terminal::Control::IControlAppearance>
{
#define SETTINGS_GEN(type, name, ...) WINRT_PROPERTY(type, name, __VA_ARGS__);
CORE_APPEARANCE_SETTINGS(SETTINGS_GEN)
CONTROL_APPEARANCE_SETTINGS(SETTINGS_GEN)
#undef SETTINGS_GEN
private:
// Color Table is special because it's an array
std::array<winrt::Microsoft::Terminal::Core::Color, COLOR_TABLE_SIZE> _ColorTable;
public:
winrt::Microsoft::Terminal::Core::Color GetColorTableEntry(int32_t index) noexcept
{
return _ColorTable.at(index);
}
void SetColorTableEntry(int32_t index,
winrt::Microsoft::Terminal::Core::Color color) noexcept
{
_ColorTable.at(index) = color;
}
ControlAppearance(Control::IControlAppearance appearance)
{
#define COPY_SETTING(type, name, ...) _##name = appearance.name();
CORE_APPEARANCE_SETTINGS(COPY_SETTING)
CONTROL_APPEARANCE_SETTINGS(COPY_SETTING)
#undef COPY_SETTING
for (size_t i = 0; i < _ColorTable.size(); i++)
{
_ColorTable[i] = appearance.GetColorTableEntry(static_cast<int32_t>(i));
}
}
};
}

View File

@@ -19,10 +19,12 @@
#include "../../renderer/base/renderer.hpp"
#include "../../renderer/uia/UiaRenderer.hpp"
#include "../../types/inc/CodepointWidthDetector.hpp"
#include "../../types/inc/utils.hpp"
#include "ControlCore.g.cpp"
#include "SelectionColor.g.cpp"
using namespace ::Microsoft::Console;
using namespace ::Microsoft::Console::Types;
using namespace ::Microsoft::Console::VirtualTerminal;
using namespace ::Microsoft::Terminal::Core;
@@ -89,7 +91,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return true;
}();
_settings = winrt::make_self<implementation::ControlSettings>(settings, unfocusedAppearance);
_settings = settings;
_hasUnfocusedAppearance = static_cast<bool>(unfocusedAppearance);
_unfocusedAppearance = _hasUnfocusedAppearance ? unfocusedAppearance : settings;
_terminal = std::make_shared<::Microsoft::Terminal::Core::Terminal>();
const auto lock = _terminal->LockForWriting();
@@ -102,7 +106,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
});
// GH#8969: pre-seed working directory to prevent potential races
_terminal->SetWorkingDirectory(_settings->StartingDirectory());
_terminal->SetWorkingDirectory(_settings.StartingDirectory());
_terminal->SetCopyToClipboardCallback([this](wil::zwstring_view wstr) {
WriteToClipboard.raise(*this, winrt::make<WriteToClipboardEventArgs>(winrt::hstring{ std::wstring_view{ wstr } }, std::string{}, std::string{}));
@@ -265,9 +269,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
shared->updateScrollBar.reset();
}
void ControlCore::AttachToNewControl(const Microsoft::Terminal::Control::IKeyBindings& keyBindings)
void ControlCore::AttachToNewControl()
{
_settings->KeyBindings(keyBindings);
_setupDispatcherAndCallbacks();
const auto actualNewSize = _actualFont.GetSize();
// Bubble this up, so our new control knows how big we want the font.
@@ -399,10 +402,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
// Override the default width and height to match the size of the swapChainPanel
_settings->InitialCols(width);
_settings->InitialRows(height);
const til::size viewportSize{ Utils::ClampToShortMax(width, 1),
Utils::ClampToShortMax(height, 1) };
_terminal->CreateFromSettings(*_settings, *_renderer);
// TODO:MSFT:20642297 - Support infinite scrollback here, if HistorySize is -1
_terminal->Create(viewportSize, Utils::ClampToShortMax(_settings.HistorySize(), 0), *_renderer);
_terminal->UpdateSettings(_settings);
// Tell the render engine to notify us when the swap chain changes.
// We do this after we initially set the swapchain so as to avoid
@@ -411,12 +416,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_renderEngineSwapChainChanged(handle);
});
_renderEngine->SetRetroTerminalEffect(_settings->RetroTerminalEffect());
_renderEngine->SetPixelShaderPath(_settings->PixelShaderPath());
_renderEngine->SetPixelShaderImagePath(_settings->PixelShaderImagePath());
_renderEngine->SetGraphicsAPI(parseGraphicsAPI(_settings->GraphicsAPI()));
_renderEngine->SetDisablePartialInvalidation(_settings->DisablePartialInvalidation());
_renderEngine->SetSoftwareRendering(_settings->SoftwareRendering());
_renderEngine->SetRetroTerminalEffect(_settings.RetroTerminalEffect());
_renderEngine->SetPixelShaderPath(_settings.PixelShaderPath());
_renderEngine->SetPixelShaderImagePath(_settings.PixelShaderImagePath());
_renderEngine->SetGraphicsAPI(parseGraphicsAPI(_settings.GraphicsAPI()));
_renderEngine->SetDisablePartialInvalidation(_settings.DisablePartialInvalidation());
_renderEngine->SetSoftwareRendering(_settings.SoftwareRendering());
_updateAntiAliasingMode();
@@ -573,7 +578,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_updateSelectionUI();
return true;
}
else if (vkey == VK_TAB && !mods.IsAltPressed() && !mods.IsCtrlPressed() && _settings->DetectURLs())
else if (vkey == VK_TAB && !mods.IsAltPressed() && !mods.IsCtrlPressed() && _settings.DetectURLs())
{
// [Shift +] Tab --> next/previous hyperlink
const auto direction = mods.IsShiftPressed() ? ::Terminal::SearchDirection::Backward : ::Terminal::SearchDirection::Forward;
@@ -600,7 +605,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
else if (vkey == VK_RETURN && !mods.IsCtrlPressed() && !mods.IsAltPressed())
{
// [Shift +] Enter --> copy text
CopySelectionToClipboard(mods.IsShiftPressed(), false, _settings->CopyFormatting());
CopySelectionToClipboard(mods.IsShiftPressed(), false, _settings.CopyFormatting());
_terminal->ClearSelection();
_updateSelectionUI();
return true;
@@ -758,7 +763,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_runtimeFocusedOpacity = focused ? newOpacity : _runtimeFocusedOpacity;
// Manually turn off acrylic if they turn off transparency.
_runtimeUseAcrylic = newOpacity < 1.0f && _settings->UseAcrylic();
_runtimeUseAcrylic = newOpacity < 1.0f && _settings.UseAcrylic();
// Update the renderer as well. It might need to fall back from
// cleartype -> grayscale if the BG is transparent / acrylic.
@@ -775,7 +780,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void ControlCore::ToggleShaderEffects()
{
const auto path = _settings->PixelShaderPath();
const auto path = _settings.PixelShaderPath();
const auto lock = _terminal->LockForWriting();
// Originally, this action could be used to enable the retro effects
// even when they're set to `false` in the settings. If the user didn't
@@ -880,24 +885,26 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - INVARIANT: This method can only be called if the caller DOES NOT HAVE writing lock on the terminal.
void ControlCore::UpdateSettings(const IControlSettings& settings, const IControlAppearance& newAppearance)
{
_settings = winrt::make_self<implementation::ControlSettings>(settings, newAppearance);
_settings = settings;
_hasUnfocusedAppearance = static_cast<bool>(newAppearance);
_unfocusedAppearance = _hasUnfocusedAppearance ? newAppearance : settings;
const auto lock = _terminal->LockForWriting();
_builtinGlyphs = _settings->EnableBuiltinGlyphs();
_colorGlyphs = _settings->EnableColorGlyphs();
_cellWidth = CSSLengthPercentage::FromString(_settings->CellWidth().c_str());
_cellHeight = CSSLengthPercentage::FromString(_settings->CellHeight().c_str());
_builtinGlyphs = _settings.EnableBuiltinGlyphs();
_colorGlyphs = _settings.EnableColorGlyphs();
_cellWidth = CSSLengthPercentage::FromString(_settings.CellWidth().c_str());
_cellHeight = CSSLengthPercentage::FromString(_settings.CellHeight().c_str());
_runtimeOpacity = std::nullopt;
_runtimeFocusedOpacity = std::nullopt;
// Manually turn off acrylic if they turn off transparency.
_runtimeUseAcrylic = _settings->Opacity() < 1.0 && _settings->UseAcrylic();
_runtimeUseAcrylic = _settings.Opacity() < 1.0 && _settings.UseAcrylic();
const auto sizeChanged = _setFontSizeUnderLock(_settings->FontSize());
const auto sizeChanged = _setFontSizeUnderLock(_settings.FontSize());
// Update the terminal core with its new Core settings
_terminal->UpdateSettings(*_settings);
_terminal->UpdateSettings(_settings);
if (!_initializedTerminal.load(std::memory_order_relaxed))
{
@@ -906,9 +913,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return;
}
_renderEngine->SetGraphicsAPI(parseGraphicsAPI(_settings->GraphicsAPI()));
_renderEngine->SetDisablePartialInvalidation(_settings->DisablePartialInvalidation());
_renderEngine->SetSoftwareRendering(_settings->SoftwareRendering());
_renderEngine->SetGraphicsAPI(parseGraphicsAPI(_settings.GraphicsAPI()));
_renderEngine->SetDisablePartialInvalidation(_settings.DisablePartialInvalidation());
_renderEngine->SetSoftwareRendering(_settings.SoftwareRendering());
// Inform the renderer of our opacity
_renderEngine->EnableTransparentBackground(_isBackgroundTransparent());
@@ -929,30 +936,34 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void ControlCore::ApplyAppearance(const bool focused)
{
const auto lock = _terminal->LockForWriting();
const auto& newAppearance{ focused ? _settings->FocusedAppearance() : _settings->UnfocusedAppearance() };
const IControlAppearance newAppearance{ focused ? _settings : _unfocusedAppearance };
// Update the terminal core with its new Core settings
_terminal->UpdateAppearance(*newAppearance);
_terminal->UpdateAppearance(newAppearance);
if ((focused || !_hasUnfocusedAppearance) && _focusedColorSchemeOverride)
{
_terminal->UpdateColorScheme(_focusedColorSchemeOverride);
}
// Update AtlasEngine settings under the lock
if (_renderEngine)
{
// Update AtlasEngine settings under the lock
_renderEngine->SetRetroTerminalEffect(newAppearance->RetroTerminalEffect());
_renderEngine->SetPixelShaderPath(newAppearance->PixelShaderPath());
_renderEngine->SetPixelShaderImagePath(newAppearance->PixelShaderImagePath());
_renderEngine->SetRetroTerminalEffect(newAppearance.RetroTerminalEffect());
_renderEngine->SetPixelShaderPath(newAppearance.PixelShaderPath());
_renderEngine->SetPixelShaderImagePath(newAppearance.PixelShaderImagePath());
// Incase EnableUnfocusedAcrylic is disabled and Focused Acrylic is set to true,
// the terminal should ignore the unfocused opacity from settings.
// The Focused Opacity from settings should be ignored if overridden at runtime.
const auto useFocusedRuntimeOpacity = focused || (!_settings->EnableUnfocusedAcrylic() && UseAcrylic());
const auto newOpacity = useFocusedRuntimeOpacity ? FocusedOpacity() : newAppearance->Opacity();
const auto useFocusedRuntimeOpacity = focused || (!_settings.EnableUnfocusedAcrylic() && UseAcrylic());
const auto newOpacity = useFocusedRuntimeOpacity ? FocusedOpacity() : newAppearance.Opacity();
_setOpacity(newOpacity, focused);
// No need to update Acrylic if UnfocusedAcrylic is disabled
if (_settings->EnableUnfocusedAcrylic())
if (_settings.EnableUnfocusedAcrylic())
{
// Manually turn off acrylic if they turn off transparency.
_runtimeUseAcrylic = Opacity() < 1.0 && newAppearance->UseAcrylic();
_runtimeUseAcrylic = Opacity() < 1.0 && newAppearance.UseAcrylic();
}
// Update the renderer as well. It might need to fall back from
@@ -974,24 +985,68 @@ namespace winrt::Microsoft::Terminal::Control::implementation
Control::IControlSettings ControlCore::Settings()
{
return *_settings;
return _settings;
}
Control::IControlAppearance ControlCore::FocusedAppearance() const
{
return *_settings->FocusedAppearance();
return _settings;
}
Control::IControlAppearance ControlCore::UnfocusedAppearance() const
{
return *_settings->UnfocusedAppearance();
return _unfocusedAppearance;
}
void ControlCore::ApplyPreviewColorScheme(const Core::ICoreScheme& scheme)
{
const auto lock = _terminal->LockForReading();
auto& renderSettings = _terminal->GetRenderSettings();
if (!_stashedColorScheme)
{
_stashedColorScheme = std::make_unique_for_overwrite<StashedColorScheme>();
*_stashedColorScheme = {
.scheme = renderSettings.GetColorTable(),
.foregroundAlias = renderSettings.GetColorAliasIndex(ColorAlias::DefaultForeground),
.backgroundAlias = renderSettings.GetColorAliasIndex(ColorAlias::DefaultBackground),
};
}
_terminal->UpdateColorScheme(scheme);
_renderer->TriggerRedrawAll(true);
}
void ControlCore::ResetPreviewColorScheme()
{
if (_stashedColorScheme)
{
const auto lock = _terminal->LockForWriting();
auto& renderSettings = _terminal->GetRenderSettings();
decltype(auto) stashedScheme{ *_stashedColorScheme.get() };
for (size_t i = 0; i < TextColor::TABLE_SIZE; ++i)
{
renderSettings.SetColorTableEntry(i, til::at(stashedScheme.scheme, i));
}
renderSettings.SetColorAliasIndex(ColorAlias::DefaultForeground, stashedScheme.foregroundAlias);
renderSettings.SetColorAliasIndex(ColorAlias::DefaultBackground, stashedScheme.backgroundAlias);
_renderer->TriggerRedrawAll(true);
}
_stashedColorScheme.reset();
}
void ControlCore::SetOverrideColorScheme(const Core::ICoreScheme& scheme)
{
const auto lock = _terminal->LockForWriting();
_focusedColorSchemeOverride = scheme;
_terminal->UpdateColorScheme(scheme ? scheme : _settings.as<Core::ICoreScheme>());
_renderer->TriggerRedrawAll(true);
}
void ControlCore::_updateAntiAliasingMode()
{
D2D1_TEXT_ANTIALIAS_MODE mode;
// Update AtlasEngine's AntialiasingMode
switch (_settings->AntialiasingMode())
switch (_settings.AntialiasingMode())
{
case TextAntialiasingMode::Cleartype:
mode = D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE;
@@ -1024,7 +1079,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
if (_renderEngine)
{
static constexpr auto cloneMap = [](const IFontFeatureMap& map) {
static constexpr auto cloneMap = [](const auto& map) {
std::unordered_map<std::wstring_view, float> clone;
if (map)
{
@@ -1037,8 +1092,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return clone;
};
const auto fontFeatures = _settings->FontFeatures();
const auto fontAxes = _settings->FontAxes();
const auto fontFeatures = _settings.FontFeatures();
const auto fontAxes = _settings.FontAxes();
const auto featureMap = cloneMap(fontFeatures);
const auto axesMap = cloneMap(fontAxes);
@@ -1062,8 +1117,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
// Make sure we have a non-zero font size
const auto newSize = std::max(fontSize, 1.0f);
const auto fontFace = _settings->FontFace();
const auto fontWeight = _settings->FontWeight();
const auto fontFace = _settings.FontFace();
const auto fontWeight = _settings.FontWeight();
_desiredFont = { fontFace, 0, fontWeight.Weight, newSize, CP_UTF8 };
_actualFont = { fontFace, 0, fontWeight.Weight, _desiredFont.GetEngineSize(), CP_UTF8, false };
@@ -1085,7 +1140,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
const auto lock = _terminal->LockForWriting();
if (_setFontSizeUnderLock(_settings->FontSize()))
if (_setFontSizeUnderLock(_settings.FontSize()))
{
_refreshSizeUnderLock();
}
@@ -1642,7 +1697,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
bool ControlCore::CopyOnSelect() const
{
return _settings->CopyOnSelect();
return _settings.CopyOnSelect();
}
winrt::hstring ControlCore::SelectedText(bool trimTrailingWhitespace) const
@@ -1999,7 +2054,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_terminal->MultiClickSelection(terminalPosition, mode);
selectionNeedsToBeCopied = true;
}
else if (_settings->RepositionCursorWithMouse() && !selectionNeedsToBeCopied) // Don't reposition cursor if this is part of a selection operation
else if (_settings.RepositionCursorWithMouse() && !selectionNeedsToBeCopied) // Don't reposition cursor if this is part of a selection operation
{
_repositionCursorWithMouse(terminalPosition);
}
@@ -2333,109 +2388,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_cachedQuickFixes = quickFixes;
}
Core::Scheme ControlCore::ColorScheme() const noexcept
{
Core::Scheme s;
// This part is definitely a hack.
//
// This function is usually used by the "Preview Color Scheme"
// functionality in TerminalPage. If we've got an unfocused appearance,
// then we've applied that appearance before this is even getting called
// (because the command palette is open with focus on top of us). If we
// return the _current_ colors now, we'll return out the _unfocused_
// colors. If we do that, and the user dismisses the command palette,
// then the scheme that will get restored is the _unfocused_ one, which
// is not what we want.
//
// So if that's the case, then let's grab the colors from the focused
// appearance as the scheme instead. We'll lose any current runtime
// changes to the color table, but those were already blown away when we
// switched to an unfocused appearance.
//
// IF WE DON'T HAVE AN UNFOCUSED APPEARANCE: then just ask the Terminal
// for its current color table. That way, we can restore those colors
// back.
if (HasUnfocusedAppearance())
{
s.Foreground = _settings->FocusedAppearance()->DefaultForeground();
s.Background = _settings->FocusedAppearance()->DefaultBackground();
s.CursorColor = _settings->FocusedAppearance()->CursorColor();
s.Black = _settings->FocusedAppearance()->GetColorTableEntry(0);
s.Red = _settings->FocusedAppearance()->GetColorTableEntry(1);
s.Green = _settings->FocusedAppearance()->GetColorTableEntry(2);
s.Yellow = _settings->FocusedAppearance()->GetColorTableEntry(3);
s.Blue = _settings->FocusedAppearance()->GetColorTableEntry(4);
s.Purple = _settings->FocusedAppearance()->GetColorTableEntry(5);
s.Cyan = _settings->FocusedAppearance()->GetColorTableEntry(6);
s.White = _settings->FocusedAppearance()->GetColorTableEntry(7);
s.BrightBlack = _settings->FocusedAppearance()->GetColorTableEntry(8);
s.BrightRed = _settings->FocusedAppearance()->GetColorTableEntry(9);
s.BrightGreen = _settings->FocusedAppearance()->GetColorTableEntry(10);
s.BrightYellow = _settings->FocusedAppearance()->GetColorTableEntry(11);
s.BrightBlue = _settings->FocusedAppearance()->GetColorTableEntry(12);
s.BrightPurple = _settings->FocusedAppearance()->GetColorTableEntry(13);
s.BrightCyan = _settings->FocusedAppearance()->GetColorTableEntry(14);
s.BrightWhite = _settings->FocusedAppearance()->GetColorTableEntry(15);
}
else
{
const auto lock = _terminal->LockForReading();
s = _terminal->GetColorScheme();
}
// This might be a tad bit of a hack. This event only gets called by set
// color scheme / preview color scheme, and in that case, we know the
// control _is_ focused.
s.SelectionBackground = _settings->FocusedAppearance()->SelectionBackground();
return s;
}
// Method Description:
// - Apply the given color scheme to this control. We'll take the colors out
// of it and apply them to our focused appearance, and update the terminal
// buffer with the new color table.
// - This is here to support the Set Color Scheme action, and the ability to
// preview schemes in the control.
// Arguments:
// - scheme: the collection of colors to apply.
// Return Value:
// - <none>
void ControlCore::ColorScheme(const Core::Scheme& scheme)
{
_settings->FocusedAppearance()->DefaultForeground(scheme.Foreground);
_settings->FocusedAppearance()->DefaultBackground(scheme.Background);
_settings->FocusedAppearance()->CursorColor(scheme.CursorColor);
_settings->FocusedAppearance()->SelectionBackground(scheme.SelectionBackground);
_settings->FocusedAppearance()->SetColorTableEntry(0, scheme.Black);
_settings->FocusedAppearance()->SetColorTableEntry(1, scheme.Red);
_settings->FocusedAppearance()->SetColorTableEntry(2, scheme.Green);
_settings->FocusedAppearance()->SetColorTableEntry(3, scheme.Yellow);
_settings->FocusedAppearance()->SetColorTableEntry(4, scheme.Blue);
_settings->FocusedAppearance()->SetColorTableEntry(5, scheme.Purple);
_settings->FocusedAppearance()->SetColorTableEntry(6, scheme.Cyan);
_settings->FocusedAppearance()->SetColorTableEntry(7, scheme.White);
_settings->FocusedAppearance()->SetColorTableEntry(8, scheme.BrightBlack);
_settings->FocusedAppearance()->SetColorTableEntry(9, scheme.BrightRed);
_settings->FocusedAppearance()->SetColorTableEntry(10, scheme.BrightGreen);
_settings->FocusedAppearance()->SetColorTableEntry(11, scheme.BrightYellow);
_settings->FocusedAppearance()->SetColorTableEntry(12, scheme.BrightBlue);
_settings->FocusedAppearance()->SetColorTableEntry(13, scheme.BrightPurple);
_settings->FocusedAppearance()->SetColorTableEntry(14, scheme.BrightCyan);
_settings->FocusedAppearance()->SetColorTableEntry(15, scheme.BrightWhite);
const auto lock = _terminal->LockForWriting();
_terminal->ApplyScheme(scheme);
_renderer->TriggerRedrawAll(true);
}
bool ControlCore::HasUnfocusedAppearance() const
{
return _settings->HasUnfocusedAppearance();
return _hasUnfocusedAppearance;
}
void ControlCore::AdjustOpacity(const float opacityAdjust, const bool relative)
@@ -2523,7 +2478,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// then the renderer should not render "default background" text with a
// fully opaque background. Doing that would cover up our nice
// transparency, or our acrylic, or our image.
return Opacity() < 1.0f || !_settings->BackgroundImage().empty() || _settings->UseBackgroundImageForWindow();
return Opacity() < 1.0f || !_settings.BackgroundImage().empty() || _settings.UseBackgroundImageForWindow();
}
uint64_t ControlCore::OwningHwnd()

View File

@@ -19,7 +19,6 @@
#include "SelectionColor.g.h"
#include "CommandHistoryContext.g.h"
#include "ControlSettings.h"
#include "../../audio/midi/MidiAudio.hpp"
#include "../../buffer/out/search.h"
#include "../../cascadia/TerminalCore/Terminal.hpp"
@@ -100,12 +99,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
Control::IControlAppearance UnfocusedAppearance() const;
bool HasUnfocusedAppearance() const;
winrt::Microsoft::Terminal::Core::Scheme ColorScheme() const noexcept;
void ColorScheme(const winrt::Microsoft::Terminal::Core::Scheme& scheme);
void ApplyPreviewColorScheme(const Core::ICoreScheme&);
void ResetPreviewColorScheme();
void SetOverrideColorScheme(const Core::ICoreScheme&);
::Microsoft::Console::Render::Renderer* GetRenderer() const noexcept;
uint64_t SwapChainHandle() const;
void AttachToNewControl(const Microsoft::Terminal::Control::IKeyBindings& keyBindings);
void AttachToNewControl();
void SizeChanged(const float width, const float height);
void ScaleChanged(const float scale);
@@ -268,9 +268,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void PreviewInput(std::wstring_view input);
RUNTIME_SETTING(float, Opacity, _settings->Opacity());
RUNTIME_SETTING(float, Opacity, _settings.Opacity());
RUNTIME_SETTING(float, FocusedOpacity, FocusedAppearance().Opacity());
RUNTIME_SETTING(bool, UseAcrylic, _settings->UseAcrylic());
RUNTIME_SETTING(bool, UseAcrylic, _settings.UseAcrylic());
// -------------------------------- WinRT Events ---------------------------------
// clang-format off
@@ -408,7 +408,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// Other stuff.
winrt::Windows::System::DispatcherQueue _dispatcher{ nullptr };
winrt::com_ptr<ControlSettings> _settings{ nullptr };
IControlSettings _settings{ nullptr };
bool _hasUnfocusedAppearance{ false };
IControlAppearance _unfocusedAppearance{ nullptr };
Core::ICoreScheme _focusedColorSchemeOverride{ nullptr };
til::point _contextMenuBufferPosition{ 0, 0 };
Windows::Foundation::Collections::IVector<hstring> _cachedQuickFixes{ nullptr };
::Search _searcher;
@@ -420,6 +423,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation
bool _isReadOnly{ false };
bool _closing{ false };
struct StashedColorScheme
{
std::array<COLORREF, TextColor::TABLE_SIZE> scheme;
size_t foregroundAlias;
size_t backgroundAlias;
};
std::unique_ptr<StashedColorScheme> _stashedColorScheme;
// ----------------------------------------------------------------------------------------
// These are ordered last to ensure they're destroyed first.
// This ensures that their respective contents stops taking dependency on the above.

View File

@@ -104,6 +104,11 @@ namespace Microsoft.Terminal.Control
Boolean HasUnfocusedAppearance();
void SetHighContrastMode(Boolean enabled);
void ApplyPreviewColorScheme(Microsoft.Terminal.Core.ICoreScheme scheme);
void ResetPreviewColorScheme();
void SetOverrideColorScheme(Microsoft.Terminal.Core.ICoreScheme scheme);
UInt64 SwapChainHandle { get; };
Windows.Foundation.Size FontSize { get; };

View File

@@ -84,9 +84,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_core->Detach();
}
void ControlInteractivity::AttachToNewControl(const Microsoft::Terminal::Control::IKeyBindings& keyBindings)
void ControlInteractivity::AttachToNewControl()
{
_core->AttachToNewControl(keyBindings);
_core->AttachToNewControl();
}
// Method Description:

View File

@@ -89,7 +89,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void SetEndSelectionPoint(const Core::Point pixelPosition);
uint64_t Id();
void AttachToNewControl(const Microsoft::Terminal::Control::IKeyBindings& keyBindings);
void AttachToNewControl();
til::typed_event<IInspectable, Control::OpenHyperlinkEventArgs> OpenHyperlink;
til::typed_event<IInspectable, Control::PasteFromClipboardEventArgs> PasteFromClipboard;

View File

@@ -25,7 +25,7 @@ namespace Microsoft.Terminal.Control
UInt64 Id { get; };
void AttachToNewControl(Microsoft.Terminal.Control.IKeyBindings keyBindings);
void AttachToNewControl();
void Detach();
void Close();

View File

@@ -1,87 +0,0 @@
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
--*/
#pragma once
#include "../../inc/cppwinrt_utils.h"
#include "../../inc/ControlProperties.h"
#include <DefaultSettings.h>
#include <conattrs.hpp>
#include "ControlAppearance.h"
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
namespace winrt::Microsoft::Terminal::Control::implementation
{
struct ControlSettings : public winrt::implements<ControlSettings, Microsoft::Terminal::Control::IControlSettings, Microsoft::Terminal::Control::IControlAppearance, Microsoft::Terminal::Core::ICoreSettings, Microsoft::Terminal::Core::ICoreAppearance>
{
// Getters and setters for each *Setting member. We're not using
// WINRT_PROPERTY for these, because they actually exist inside the
// _focusedAppearance member. We don't need to reserve another member to
// hold them.
#define SETTINGS_GEN(type, name, ...) WINRT_PROPERTY(type, name, __VA_ARGS__);
CORE_SETTINGS(SETTINGS_GEN)
CONTROL_SETTINGS(SETTINGS_GEN)
#undef SETTINGS_GEN
private:
winrt::com_ptr<ControlAppearance> _unfocusedAppearance{ nullptr };
winrt::com_ptr<ControlAppearance> _focusedAppearance{ nullptr };
bool _hasUnfocusedAppearance{ false };
public:
ControlSettings(const Control::IControlSettings& settings,
const Control::IControlAppearance& unfocusedAppearance)
{
_hasUnfocusedAppearance = unfocusedAppearance != nullptr;
_focusedAppearance = winrt::make_self<implementation::ControlAppearance>(settings);
_unfocusedAppearance = unfocusedAppearance ?
winrt::make_self<implementation::ControlAppearance>(unfocusedAppearance) :
_focusedAppearance;
// Copy every value from the passed in settings, into us.
#define COPY_SETTING(type, name, ...) _##name = settings.name();
CORE_SETTINGS(COPY_SETTING)
CONTROL_SETTINGS(COPY_SETTING)
#undef COPY_SETTING
}
winrt::com_ptr<ControlAppearance> UnfocusedAppearance() { return _unfocusedAppearance; }
winrt::com_ptr<ControlAppearance> FocusedAppearance() { return _focusedAppearance; }
bool HasUnfocusedAppearance() { return _hasUnfocusedAppearance; }
// Getters and setters for each Appearance member. We're not using
// WINRT_PROPERTY for these, because they actually exist inside the
// _focusedAppearance member. We don't need to reserve another member to
// hold them.
//
// The Appearance members (including GetColorTableEntry below) are used
// when this ControlSettings is cast to a IControlAppearance or
// ICoreAppearance. In those cases, we'll always return the Focused
// appearance's version of the member. Callers who care about which
// appearance is being used should be more careful. Fortunately, this
// situation is generally only used when a control is first created, or
// when calling UpdateSettings.
#define APPEARANCE_GEN(type, name, ...) \
type name() const noexcept \
{ \
return _focusedAppearance->name(); \
} \
void name(const type& value) noexcept \
{ \
_focusedAppearance->name(value); \
}
CORE_APPEARANCE_SETTINGS(APPEARANCE_GEN)
CONTROL_APPEARANCE_SETTINGS(APPEARANCE_GEN)
#undef APPEARANCE_GEN
winrt::Microsoft::Terminal::Core::Color GetColorTableEntry(int32_t index) noexcept
{
return _focusedAppearance->GetColorTableEntry(index);
}
};
}

View File

@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import "IKeyBindings.idl";
import "IControlAppearance.idl";
import "EventArgs.idl";
@@ -53,8 +52,6 @@ namespace Microsoft.Terminal.Control
String CellWidth { get; };
String CellHeight { get; };
Microsoft.Terminal.Control.IKeyBindings KeyBindings { get; };
Boolean CopyOnSelect { get; };
Microsoft.Terminal.Control.CopyFormat CopyFormatting { get; };
Boolean FocusFollowMouse { get; };

View File

@@ -50,8 +50,6 @@ namespace Microsoft.Terminal.Control
Microsoft.Terminal.TerminalConnection.ConnectionState ConnectionState { get; };
Microsoft.Terminal.Core.Scheme ColorScheme { get; set; };
UInt64 OwningHwnd;
void AddMark(ScrollMark mark);

View File

@@ -487,25 +487,22 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// Function Description:
// - Static helper for building a new TermControl from an already existing
// content. We'll attach the existing swapchain to this new control's
// SwapChainPanel. The IKeyBindings might belong to a non-agile object on
// a new thread, so we'll hook up the core to these new bindings.
// SwapChainPanel.
// Arguments:
// - content: The preexisting ControlInteractivity to connect to.
// - keybindings: The new IKeyBindings instance to use for this control.
// Return Value:
// - The newly constructed TermControl.
Control::TermControl TermControl::NewControlByAttachingContent(Control::ControlInteractivity content,
const Microsoft::Terminal::Control::IKeyBindings& keyBindings)
Control::TermControl TermControl::NewControlByAttachingContent(Control::ControlInteractivity content)
{
const auto term{ winrt::make_self<TermControl>(content) };
term->_initializeForAttach(keyBindings);
term->_initializeForAttach();
return *term;
}
void TermControl::_initializeForAttach(const Microsoft::Terminal::Control::IKeyBindings& keyBindings)
void TermControl::_initializeForAttach()
{
_AttachDxgiSwapChainToXaml(reinterpret_cast<HANDLE>(_core.SwapChainHandle()));
_interactivity.AttachToNewControl(keyBindings);
_interactivity.AttachToNewControl();
// Initialize the terminal only once the swapchainpanel is loaded - that
// way, we'll be able to query the real pixel size it got on layout
@@ -1848,13 +1845,12 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return true;
}
auto bindings = _core.Settings().KeyBindings();
if (!bindings)
if (!_keyBindings)
{
return false;
}
auto success = bindings.TryKeyChord({
auto success = _keyBindings.TryKeyChord({
modifiers.IsCtrlPressed(),
modifiers.IsAltPressed(),
modifiers.IsShiftPressed(),
@@ -3791,16 +3787,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
get_self<ControlCore>(_core)->UpdateQuickFixes(suggestions);
}
Core::Scheme TermControl::ColorScheme() const noexcept
{
return _core.ColorScheme();
}
void TermControl::ColorScheme(const Core::Scheme& scheme) const noexcept
{
_core.ColorScheme(scheme);
}
void TermControl::AdjustOpacity(const float opacity, const bool relative)
{
_core.AdjustOpacity(opacity, relative);

View File

@@ -11,7 +11,6 @@
#include "../../tsf/Handle.h"
#include "ControlInteractivity.h"
#include "ControlSettings.h"
namespace Microsoft::Console::VirtualTerminal
{
@@ -50,12 +49,14 @@ namespace winrt::Microsoft::Terminal::Control::implementation
TermControl(IControlSettings settings, Control::IControlAppearance unfocusedAppearance, TerminalConnection::ITerminalConnection connection);
static Control::TermControl NewControlByAttachingContent(Control::ControlInteractivity content, const Microsoft::Terminal::Control::IKeyBindings& keyBindings);
static Control::TermControl NewControlByAttachingContent(Control::ControlInteractivity content);
void UpdateControlSettings(Control::IControlSettings settings);
void UpdateControlSettings(Control::IControlSettings settings, Control::IControlAppearance unfocusedAppearance);
IControlSettings Settings() const;
void KeyBindings(const Control::IKeyBindings& bindings) { _keyBindings = bindings; }
uint64_t ContentId() const;
hstring GetStartingTitle() const;
@@ -176,9 +177,6 @@ namespace winrt::Microsoft::Terminal::Control::implementation
Control::CommandHistoryContext CommandHistory() const;
void UpdateWinGetSuggestions(Windows::Foundation::Collections::IVector<hstring> suggestions);
winrt::Microsoft::Terminal::Core::Scheme ColorScheme() const noexcept;
void ColorScheme(const winrt::Microsoft::Terminal::Core::Scheme& scheme) const noexcept;
void AdjustOpacity(const float opacity, const bool relative);
bool RawWriteKeyEvent(const WORD vkey, const WORD scanCode, const winrt::Microsoft::Terminal::Core::ControlKeyStates modifiers, const bool keyDown);
@@ -198,6 +196,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
Control::CursorDisplayState CursorVisibility() const noexcept;
void CursorVisibility(Control::CursorDisplayState cursorVisibility);
void ApplyPreviewColorScheme(const Core::ICoreScheme& scheme) { _core.ApplyPreviewColorScheme(scheme); }
void ResetPreviewColorScheme() { _core.ResetPreviewColorScheme(); }
void SetOverrideColorScheme(const Core::ICoreScheme& scheme) { _core.SetOverrideColorScheme(scheme); }
// -------------------------------- WinRT Events ---------------------------------
// clang-format off
til::property_changed_event PropertyChanged;
@@ -249,6 +251,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
Control::TermControlAutomationPeer _automationPeer{ nullptr };
Control::ControlInteractivity _interactivity{ nullptr };
Control::ControlCore _core{ nullptr };
Control::IKeyBindings _keyBindings{ nullptr };
TsfDataProvider _tsfDataProvider{ this };
winrt::com_ptr<SearchBoxControl> _searchBox;
@@ -340,7 +343,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return _closing;
}
void _initializeForAttach(const Microsoft::Terminal::Control::IKeyBindings& keyBindings);
void _initializeForAttach();
void _UpdateSettingsFromUIThread();
void _UpdateAppearanceFromUIThread(Control::IControlAppearance newAppearance);

View File

@@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import "IKeyBindings.idl";
import "IMouseWheelListener.idl";
import "IControlSettings.idl";
import "ControlInteractivity.idl";
@@ -36,7 +37,7 @@ namespace Microsoft.Terminal.Control
IControlAppearance unfocusedAppearance,
Microsoft.Terminal.TerminalConnection.ITerminalConnection connection);
static TermControl NewControlByAttachingContent(ControlInteractivity content, Microsoft.Terminal.Control.IKeyBindings keyBindings);
static TermControl NewControlByAttachingContent(ControlInteractivity content);
static Windows.Foundation.Size GetProposedDimensions(IControlSettings settings,
UInt32 dpi,
@@ -46,12 +47,20 @@ namespace Microsoft.Terminal.Control
void UpdateControlSettings(IControlSettings settings);
void UpdateControlSettings(IControlSettings settings, IControlAppearance unfocusedAppearance);
void ApplyPreviewColorScheme(Microsoft.Terminal.Core.ICoreScheme scheme);
void ResetPreviewColorScheme();
void SetOverrideColorScheme(Microsoft.Terminal.Core.ICoreScheme scheme);
Microsoft.Terminal.TerminalConnection.ITerminalConnection Connection;
UInt64 ContentId{ get; };
Microsoft.Terminal.Control.IControlSettings Settings { get; };
// MIDL 3 does not support setter-only properties.
void KeyBindings(Microsoft.Terminal.Control.IKeyBindings KeyBindings);
event Windows.Foundation.TypedEventHandler<Object, TitleChangedEventArgs> TitleChanged;
event Windows.Foundation.TypedEventHandler<Object, WriteToClipboardEventArgs> WriteToClipboard;
event Windows.Foundation.TypedEventHandler<Object, PasteFromClipboardEventArgs> PasteFromClipboard;

View File

@@ -1,130 +0,0 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
namespace Microsoft.Terminal.Core
{
enum MatchMode
{
None,
All
};
enum CursorStyle
{
Vintage,
Bar,
Underscore,
DoubleUnderscore,
FilledBox,
EmptyBox
};
enum AdjustTextMode
{
Never,
Indexed,
Always,
Automatic
};
// TerminalCore declares its own Color struct to avoid depending
// on Windows.UI.Color and to avoid passing around unclothed uint32s.
// It is supported by til::color for conversions in and out of WinRT land.
struct Color
{
UInt8 R;
UInt8 G;
UInt8 B;
UInt8 A;
};
// Yes, this is also just an IReference<Color>. However, IReference has some
// weird ownership semantics that just make it a pain for something as
// simple as "maybe this color doesn't have a value set".
struct OptionalColor
{
Boolean HasValue;
Microsoft.Terminal.Core.Color Color;
};
// TerminalCore declares its own Color struct to avoid depending on
// Windows.UI. Windows.Foundation.Point also exists, but it's composed of
// floating-point coordinates, when we almost always need integer coordinates.
// It is supported by til::point for conversions in and out of WinRT land.
struct Point
{
Int32 X;
Int32 Y;
};
// Same thing here, but with padding. Can't use Windows.UI.Thickness, so
// we'll declare our own.
struct Padding {
Single Left;
Single Top;
Single Right;
Single Bottom;
};
// This is a projection of Microsoft::Terminal::Core::ControlKeyStates,
// for conversions in and out of WinRT land.
struct ControlKeyStates
{
UInt32 Value;
};
struct Scheme
{
Microsoft.Terminal.Core.Color Foreground;
Microsoft.Terminal.Core.Color Background;
Microsoft.Terminal.Core.Color SelectionBackground;
Microsoft.Terminal.Core.Color CursorColor;
// Table: A WinRT struct doesn't allow pointers (READ: doesn't allow
// array members) in structs, but we very much would like this object to
// be a struct. So we'll call out each color individually. There's only
// 16, it's not that bad.
Microsoft.Terminal.Core.Color Black;
Microsoft.Terminal.Core.Color Red;
Microsoft.Terminal.Core.Color Green;
Microsoft.Terminal.Core.Color Yellow;
Microsoft.Terminal.Core.Color Blue;
Microsoft.Terminal.Core.Color Purple;
Microsoft.Terminal.Core.Color Cyan;
Microsoft.Terminal.Core.Color White;
Microsoft.Terminal.Core.Color BrightBlack;
Microsoft.Terminal.Core.Color BrightRed;
Microsoft.Terminal.Core.Color BrightGreen;
Microsoft.Terminal.Core.Color BrightYellow;
Microsoft.Terminal.Core.Color BrightBlue;
Microsoft.Terminal.Core.Color BrightPurple;
Microsoft.Terminal.Core.Color BrightCyan;
Microsoft.Terminal.Core.Color BrightWhite;
};
declare
{
// Forward declare this parameterized specialization so that it lives
// in TerminalCore instead of being flung to the winds of all IDL dependents.
interface Windows.Foundation.IReference<Microsoft.Terminal.Core.Color>;
interface Windows.Foundation.IReference<Microsoft.Terminal.Core.Point>;
}
interface ICoreAppearance
{
Microsoft.Terminal.Core.Color DefaultForeground;
Microsoft.Terminal.Core.Color DefaultBackground;
Microsoft.Terminal.Core.Color SelectionBackground;
Microsoft.Terminal.Core.Color GetColorTableEntry(Int32 index);
Microsoft.Terminal.Core.Color CursorColor;
CursorStyle CursorShape;
UInt32 CursorHeight;
Boolean IntenseIsBold;
Boolean IntenseIsBright;
AdjustTextMode AdjustIndistinguishableColors;
// NOTE! When adding something here, make sure to update ControlProperties.h too!
};
}

View File

@@ -1,36 +1,136 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import "..\ICoreAppearance.idl";
namespace Microsoft.Terminal.Core
{
enum MatchMode
{
None,
All
};
enum CursorStyle
{
Vintage,
Bar,
Underscore,
DoubleUnderscore,
FilledBox,
EmptyBox
};
enum AdjustTextMode
{
Never,
Indexed,
Always,
Automatic
};
// TerminalCore declares its own Color struct to avoid depending
// on Windows.UI.Color and to avoid passing around unclothed uint32s.
// It is supported by til::color for conversions in and out of WinRT land.
struct Color
{
UInt8 R;
UInt8 G;
UInt8 B;
UInt8 A;
};
// Yes, this is also just an IReference<Color>. However, IReference has some
// weird ownership semantics that just make it a pain for something as
// simple as "maybe this color doesn't have a value set".
struct OptionalColor
{
Boolean HasValue;
Microsoft.Terminal.Core.Color Color;
};
// TerminalCore declares its own Color struct to avoid depending on
// Windows.UI. Windows.Foundation.Point also exists, but it's composed of
// floating-point coordinates, when we almost always need integer coordinates.
// It is supported by til::point for conversions in and out of WinRT land.
struct Point
{
Int32 X;
Int32 Y;
};
// Same thing here, but with padding. Can't use Windows.UI.Thickness, so
// we'll declare our own.
struct Padding {
Single Left;
Single Top;
Single Right;
Single Bottom;
};
// This is a projection of Microsoft::Terminal::Core::ControlKeyStates,
// for conversions in and out of WinRT land.
struct ControlKeyStates
{
UInt32 Value;
};
declare
{
// Forward declare this parameterized specialization so that it lives
// in TerminalCore instead of being flung to the winds of all IDL dependents.
interface Windows.Foundation.IReference<Microsoft.Terminal.Core.Color>;
interface Windows.Foundation.IReference<Microsoft.Terminal.Core.Point>;
}
interface ICoreScheme
{
// Table is callee-allocated
void GetColorTable(out Microsoft.Terminal.Core.Color[] table);
Microsoft.Terminal.Core.Color DefaultForeground { get; };
Microsoft.Terminal.Core.Color DefaultBackground { get; };
Microsoft.Terminal.Core.Color SelectionBackground { get; };
Microsoft.Terminal.Core.Color CursorColor { get; };
// NOTE! When adding something here, make sure to update ControlProperties.h too!
};
interface ICoreAppearance requires ICoreScheme
{
CursorStyle CursorShape { get; };
UInt32 CursorHeight { get; };
Boolean IntenseIsBold { get; };
Boolean IntenseIsBright { get; };
AdjustTextMode AdjustIndistinguishableColors { get; };
// NOTE! When adding something here, make sure to update ControlProperties.h too!
};
interface ICoreSettings requires ICoreAppearance
{
// TODO:MSFT:20642297 - define a sentinel for Infinite Scrollback
Int32 HistorySize;
Int32 InitialRows;
Int32 InitialCols;
Int32 HistorySize { get; };
Int32 InitialRows { get; };
Int32 InitialCols { get; };
Boolean SnapOnInput;
Boolean AltGrAliasing;
String AnswerbackMessage;
Boolean SnapOnInput { get; };
Boolean AltGrAliasing { get; };
String AnswerbackMessage { get; };
String StartingTitle;
Boolean SuppressApplicationTitle;
String WordDelimiters;
String StartingTitle { get; };
Boolean SuppressApplicationTitle { get; };
String WordDelimiters { get; };
Boolean ForceVTInput;
Boolean AllowVtChecksumReport;
Boolean AllowVtClipboardWrite;
Boolean TrimBlockSelection;
Boolean DetectURLs;
Boolean ForceVTInput { get; };
Boolean AllowVtChecksumReport { get; };
Boolean AllowVtClipboardWrite { get; };
Boolean TrimBlockSelection { get; };
Boolean DetectURLs { get; };
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> TabColor;
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> StartingTabColor;
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> TabColor { get; };
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> StartingTabColor { get; };
Boolean AutoMarkPrompts;
Boolean RainbowSuggestions;
Boolean AutoMarkPrompts { get; };
Boolean RainbowSuggestions { get; };
// NOTE! When adding something here, make sure to update ControlProperties.h too!
};

View File

@@ -167,20 +167,6 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
break;
}
const til::color newBackgroundColor{ appearance.DefaultBackground() };
renderSettings.SetColorAlias(ColorAlias::DefaultBackground, TextColor::DEFAULT_BACKGROUND, newBackgroundColor);
const til::color newForegroundColor{ appearance.DefaultForeground() };
renderSettings.SetColorAlias(ColorAlias::DefaultForeground, TextColor::DEFAULT_FOREGROUND, newForegroundColor);
const til::color newCursorColor{ appearance.CursorColor() };
renderSettings.SetColorTableEntry(TextColor::CURSOR_COLOR, newCursorColor);
const til::color newSelectionColor{ appearance.SelectionBackground() };
renderSettings.SetColorTableEntry(TextColor::SELECTION_BACKGROUND, newSelectionColor);
for (auto i = 0; i < 16; i++)
{
renderSettings.SetColorTableEntry(i, til::color{ appearance.GetColorTableEntry(i) });
}
auto cursorShape = CursorType::VerticalBar;
switch (appearance.CursorShape())
{
@@ -215,6 +201,32 @@ void Terminal::UpdateAppearance(const ICoreAppearance& appearance)
_defaultCursorShape = cursorShape;
UpdateColorScheme(appearance);
}
void Terminal::UpdateColorScheme(const ICoreScheme& scheme)
{
auto& renderSettings = GetRenderSettings();
const til::color newBackgroundColor{ scheme.DefaultBackground() };
renderSettings.SetColorAlias(ColorAlias::DefaultBackground, TextColor::DEFAULT_BACKGROUND, newBackgroundColor);
const til::color newForegroundColor{ scheme.DefaultForeground() };
renderSettings.SetColorAlias(ColorAlias::DefaultForeground, TextColor::DEFAULT_FOREGROUND, newForegroundColor);
const til::color newCursorColor{ scheme.CursorColor() };
renderSettings.SetColorTableEntry(TextColor::CURSOR_COLOR, newCursorColor);
const til::color newSelectionColor{ scheme.SelectionBackground() };
renderSettings.SetColorTableEntry(TextColor::SELECTION_BACKGROUND, newSelectionColor);
winrt::com_array<Color> colors;
scheme.GetColorTable(colors);
assert(colors.size() == 16);
for (auto i = 0; i < 16; i++)
{
renderSettings.SetColorTableEntry(i, til::color{ til::at(colors, i) });
}
// Tell the control that the scrollbar has somehow changed. Used as a
// workaround to force the control to redraw any scrollbar marks whose color
// may have changed.
@@ -1298,69 +1310,6 @@ void Terminal::ScrollToSearchHighlight(til::CoordType searchScrollOffset)
}
}
Scheme Terminal::GetColorScheme() const
{
const auto& renderSettings = GetRenderSettings();
Scheme s;
s.Foreground = til::color{ renderSettings.GetColorAlias(ColorAlias::DefaultForeground) };
s.Background = til::color{ renderSettings.GetColorAlias(ColorAlias::DefaultBackground) };
s.CursorColor = til::color{ renderSettings.GetColorTableEntry(TextColor::CURSOR_COLOR) };
s.SelectionBackground = til::color{ renderSettings.GetColorTableEntry(TextColor::SELECTION_BACKGROUND) };
s.Black = til::color{ renderSettings.GetColorTableEntry(TextColor::DARK_BLACK) };
s.Red = til::color{ renderSettings.GetColorTableEntry(TextColor::DARK_RED) };
s.Green = til::color{ renderSettings.GetColorTableEntry(TextColor::DARK_GREEN) };
s.Yellow = til::color{ renderSettings.GetColorTableEntry(TextColor::DARK_YELLOW) };
s.Blue = til::color{ renderSettings.GetColorTableEntry(TextColor::DARK_BLUE) };
s.Purple = til::color{ renderSettings.GetColorTableEntry(TextColor::DARK_MAGENTA) };
s.Cyan = til::color{ renderSettings.GetColorTableEntry(TextColor::DARK_CYAN) };
s.White = til::color{ renderSettings.GetColorTableEntry(TextColor::DARK_WHITE) };
s.BrightBlack = til::color{ renderSettings.GetColorTableEntry(TextColor::BRIGHT_BLACK) };
s.BrightRed = til::color{ renderSettings.GetColorTableEntry(TextColor::BRIGHT_RED) };
s.BrightGreen = til::color{ renderSettings.GetColorTableEntry(TextColor::BRIGHT_GREEN) };
s.BrightYellow = til::color{ renderSettings.GetColorTableEntry(TextColor::BRIGHT_YELLOW) };
s.BrightBlue = til::color{ renderSettings.GetColorTableEntry(TextColor::BRIGHT_BLUE) };
s.BrightPurple = til::color{ renderSettings.GetColorTableEntry(TextColor::BRIGHT_MAGENTA) };
s.BrightCyan = til::color{ renderSettings.GetColorTableEntry(TextColor::BRIGHT_CYAN) };
s.BrightWhite = til::color{ renderSettings.GetColorTableEntry(TextColor::BRIGHT_WHITE) };
return s;
}
void Terminal::ApplyScheme(const Scheme& colorScheme)
{
auto& renderSettings = GetRenderSettings();
renderSettings.SetColorAlias(ColorAlias::DefaultForeground, TextColor::DEFAULT_FOREGROUND, til::color{ colorScheme.Foreground });
renderSettings.SetColorAlias(ColorAlias::DefaultBackground, TextColor::DEFAULT_BACKGROUND, til::color{ colorScheme.Background });
renderSettings.SetColorTableEntry(TextColor::DARK_BLACK, til::color{ colorScheme.Black });
renderSettings.SetColorTableEntry(TextColor::DARK_RED, til::color{ colorScheme.Red });
renderSettings.SetColorTableEntry(TextColor::DARK_GREEN, til::color{ colorScheme.Green });
renderSettings.SetColorTableEntry(TextColor::DARK_YELLOW, til::color{ colorScheme.Yellow });
renderSettings.SetColorTableEntry(TextColor::DARK_BLUE, til::color{ colorScheme.Blue });
renderSettings.SetColorTableEntry(TextColor::DARK_MAGENTA, til::color{ colorScheme.Purple });
renderSettings.SetColorTableEntry(TextColor::DARK_CYAN, til::color{ colorScheme.Cyan });
renderSettings.SetColorTableEntry(TextColor::DARK_WHITE, til::color{ colorScheme.White });
renderSettings.SetColorTableEntry(TextColor::BRIGHT_BLACK, til::color{ colorScheme.BrightBlack });
renderSettings.SetColorTableEntry(TextColor::BRIGHT_RED, til::color{ colorScheme.BrightRed });
renderSettings.SetColorTableEntry(TextColor::BRIGHT_GREEN, til::color{ colorScheme.BrightGreen });
renderSettings.SetColorTableEntry(TextColor::BRIGHT_YELLOW, til::color{ colorScheme.BrightYellow });
renderSettings.SetColorTableEntry(TextColor::BRIGHT_BLUE, til::color{ colorScheme.BrightBlue });
renderSettings.SetColorTableEntry(TextColor::BRIGHT_MAGENTA, til::color{ colorScheme.BrightPurple });
renderSettings.SetColorTableEntry(TextColor::BRIGHT_CYAN, til::color{ colorScheme.BrightCyan });
renderSettings.SetColorTableEntry(TextColor::BRIGHT_WHITE, til::color{ colorScheme.BrightWhite });
renderSettings.SetColorTableEntry(TextColor::CURSOR_COLOR, til::color{ colorScheme.CursorColor });
renderSettings.SetColorTableEntry(TextColor::SELECTION_BACKGROUND, til::color{ colorScheme.SelectionBackground });
// Tell the control that the scrollbar has somehow changed. Used as a
// workaround to force the control to redraw any scrollbar marks whose color
// may have changed.
_NotifyScrollEvent();
}
bool Terminal::_inAltBuffer() const noexcept
{
_assertLocked();

View File

@@ -28,7 +28,6 @@ namespace winrt::Microsoft::Terminal::Core
{
struct ICoreSettings;
struct ICoreAppearance;
struct Scheme;
enum class MatchMode;
}
@@ -92,6 +91,7 @@ public:
void UpdateSettings(winrt::Microsoft::Terminal::Core::ICoreSettings settings);
void UpdateAppearance(const winrt::Microsoft::Terminal::Core::ICoreAppearance& appearance);
void UpdateColorScheme(const winrt::Microsoft::Terminal::Core::ICoreScheme& scheme);
void SetHighContrastMode(bool hc) noexcept;
void SetFontInfo(const FontInfo& fontInfo);
void SetCursorStyle(const ::Microsoft::Console::VirtualTerminal::DispatchTypes::CursorStyle cursorStyle);
@@ -248,9 +248,6 @@ public:
const std::optional<til::color> GetTabColor() const;
winrt::Microsoft::Terminal::Core::Scheme GetColorScheme() const;
void ApplyScheme(const winrt::Microsoft::Terminal::Core::Scheme& scheme);
const size_t GetTaskbarState() const noexcept;
const size_t GetTaskbarProgress() const noexcept;
@@ -373,7 +370,7 @@ private:
bool _snapOnInput = true;
bool _altGrAliasing = true;
bool _suppressApplicationTitle = false;
bool _trimBlockSelection = false;
bool _trimBlockSelection = true;
bool _autoMarkPrompts = false;
bool _rainbowSuggestions = false;

View File

@@ -50,7 +50,6 @@
<ItemGroup>
<Midl Include="..\ICoreSettings.idl" />
<Midl Include="..\ICoreAppearance.idl" />
</ItemGroup>
<ItemDefinitionGroup>
<ClCompile>

View File

@@ -3,20 +3,18 @@
#include "pch.h"
#include "TerminalSettings.h"
#include "winrt/Windows.UI.ViewManagement.h"
#include "../../types/inc/colorTable.hpp"
#include "AppearanceConfig.h"
#include "TerminalSettings.g.cpp"
#include "TerminalSettingsCreateResult.g.cpp"
using namespace winrt::Microsoft::Terminal::Control;
using namespace winrt::Microsoft::Terminal::Settings;
using namespace Microsoft::Console::Utils;
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
namespace winrt::Microsoft::Terminal::Settings
{
static std::tuple<Windows::UI::Xaml::HorizontalAlignment, Windows::UI::Xaml::VerticalAlignment> ConvertConvergedAlignment(ConvergedAlignment alignment)
static std::tuple<Windows::UI::Xaml::HorizontalAlignment, Windows::UI::Xaml::VerticalAlignment> ConvertConvergedAlignment(Model::ConvergedAlignment alignment)
{
using Model::ConvergedAlignment;
// extract horizontal alignment
Windows::UI::Xaml::HorizontalAlignment horizAlign;
switch (alignment & static_cast<ConvergedAlignment>(0x0F))
@@ -52,7 +50,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return { horizAlign, vertAlign };
}
winrt::com_ptr<implementation::TerminalSettings> TerminalSettings::_CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
winrt::com_ptr<TerminalSettings> TerminalSettings::_CreateWithProfileCommon(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
{
auto settings{ winrt::make_self<TerminalSettings>() };
@@ -64,11 +62,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return settings;
}
Model::TerminalSettings TerminalSettings::CreateForPreview(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
winrt::com_ptr<TerminalSettings> TerminalSettings::CreateForPreview(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
{
const auto settings = _CreateWithProfileCommon(appSettings, profile);
settings->UseBackgroundImageForWindow(false);
return *settings;
settings->_UseBackgroundImageForWindow = false;
return settings;
}
// Method Description:
@@ -79,25 +77,23 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// Arguments:
// - appSettings: the set of settings being used to construct the new terminal
// - profileGuid: the unique identifier (guid) of the profile
// - keybindings: the keybinding handler
// 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
Model::TerminalSettingsCreateResult TerminalSettings::CreateWithProfile(const Model::CascadiaSettings& appSettings, const Model::Profile& profile, const IKeyBindings& keybindings)
TerminalSettingsCreateResult TerminalSettings::CreateWithProfile(const Model::CascadiaSettings& appSettings, const Model::Profile& profile)
{
const auto settings = _CreateWithProfileCommon(appSettings, profile);
settings->_KeyBindings = keybindings;
Model::TerminalSettings child{ nullptr };
winrt::com_ptr<TerminalSettings> child{ nullptr };
if (const auto& unfocusedAppearance{ profile.UnfocusedAppearance() })
{
const auto globals = appSettings.GlobalSettings();
auto childImpl = settings->CreateChild();
childImpl->_ApplyAppearanceSettings(unfocusedAppearance, globals.ColorSchemes(), globals.CurrentTheme());
child = *childImpl;
child = winrt::make_self<TerminalSettings>();
child->_parent = settings->get_strong();
child->_ApplyAppearanceSettings(unfocusedAppearance, globals.ColorSchemes(), globals.CurrentTheme());
}
return winrt::make<TerminalSettingsCreateResult>(*settings, child);
return TerminalSettingsCreateResult{ settings.get(), child.get() };
}
// Method Description:
@@ -114,23 +110,21 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// * Additionally, we'll use other values (such as Commandline,
// StartingDirectory) in this object to override the settings directly from
// the profile.
// - keybindings: the keybinding handler
// Return Value:
// - 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.
Model::TerminalSettingsCreateResult TerminalSettings::CreateWithNewTerminalArgs(const CascadiaSettings& appSettings,
const NewTerminalArgs& newTerminalArgs,
const IKeyBindings& keybindings)
TerminalSettingsCreateResult TerminalSettings::CreateWithNewTerminalArgs(const Model::CascadiaSettings& appSettings,
const Model::NewTerminalArgs& newTerminalArgs)
{
const auto profile = appSettings.GetProfileForArgs(newTerminalArgs);
auto settingsPair{ CreateWithProfile(appSettings, profile, keybindings) };
auto settingsPair{ CreateWithProfile(appSettings, profile) };
auto defaultSettings = settingsPair.DefaultSettings();
if (newTerminalArgs)
{
if (const auto id = newTerminalArgs.SessionId(); id != winrt::guid{})
{
defaultSettings.SessionId(id);
defaultSettings->_SessionId = id;
}
// Override commandline, starting directory if they exist in newTerminalArgs
@@ -138,20 +132,20 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
if (!newTerminalArgs.AppendCommandLine())
{
defaultSettings.Commandline(newTerminalArgs.Commandline());
defaultSettings->_Commandline = newTerminalArgs.Commandline();
}
else
{
defaultSettings.Commandline(defaultSettings.Commandline() + L" " + newTerminalArgs.Commandline());
defaultSettings->_Commandline = defaultSettings->Commandline() + L" " + newTerminalArgs.Commandline();
}
}
if (!newTerminalArgs.StartingDirectory().empty())
{
defaultSettings.StartingDirectory(newTerminalArgs.StartingDirectory());
defaultSettings->_StartingDirectory = newTerminalArgs.StartingDirectory();
}
if (!newTerminalArgs.TabTitle().empty())
{
defaultSettings.StartingTitle(newTerminalArgs.TabTitle());
defaultSettings->_StartingTitle = newTerminalArgs.TabTitle();
}
else
{
@@ -165,23 +159,23 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
const auto terminator{ commandLine.find_first_of(start ? L'"' : L' ', start) }; // look past the first character if it starts with "
// We have to take a copy here; winrt::param::hstring requires a null-terminated string
const std::wstring firstComponent{ commandLine.substr(start, terminator - start) };
defaultSettings.StartingTitle(firstComponent);
defaultSettings->_StartingTitle = winrt::hstring{ firstComponent };
}
}
if (newTerminalArgs.TabColor())
{
defaultSettings.StartingTabColor(winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>{ static_cast<winrt::Microsoft::Terminal::Core::Color>(til::color{ newTerminalArgs.TabColor().Value() }) });
defaultSettings->_StartingTabColor = winrt::Windows::Foundation::IReference<winrt::Microsoft::Terminal::Core::Color>{ static_cast<winrt::Microsoft::Terminal::Core::Color>(til::color{ newTerminalArgs.TabColor().Value() }) };
}
if (newTerminalArgs.SuppressApplicationTitle())
{
defaultSettings.SuppressApplicationTitle(newTerminalArgs.SuppressApplicationTitle().Value());
defaultSettings->_SuppressApplicationTitle = newTerminalArgs.SuppressApplicationTitle().Value();
}
if (!newTerminalArgs.ColorScheme().empty())
{
const auto schemes = appSettings.GlobalSettings().ColorSchemes();
if (const auto& scheme = schemes.TryLookup(newTerminalArgs.ColorScheme()))
{
defaultSettings.ApplyColorScheme(scheme);
defaultSettings->ApplyColorScheme(scheme);
}
}
// Elevate on NewTerminalArgs is an optional value, so the default
@@ -190,20 +184,20 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// profile will still be launched elevated.
if (newTerminalArgs.Elevate())
{
defaultSettings.Elevate(newTerminalArgs.Elevate().Value());
defaultSettings->_Elevate = newTerminalArgs.Elevate().Value();
}
if (newTerminalArgs.ReloadEnvironmentVariables())
{
defaultSettings.ReloadEnvironmentVariables(newTerminalArgs.ReloadEnvironmentVariables().Value());
defaultSettings->_ReloadEnvironmentVariables = newTerminalArgs.ReloadEnvironmentVariables().Value();
}
}
return settingsPair;
}
void TerminalSettings::_ApplyAppearanceSettings(const IAppearanceConfig& appearance,
const Windows::Foundation::Collections::IMapView<winrt::hstring, ColorScheme>& schemes,
void TerminalSettings::_ApplyAppearanceSettings(const Model::IAppearanceConfig& appearance,
const Windows::Foundation::Collections::IMapView<winrt::hstring, Model::ColorScheme>& schemes,
const winrt::Microsoft::Terminal::Settings::Model::Theme currentTheme)
{
_CursorShape = appearance.CursorShape();
@@ -289,7 +283,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// - schemes: a map of schemes to look for our color scheme in, if we have one.
// Return Value:
// - <none>
void TerminalSettings::_ApplyProfileSettings(const Profile& profile)
void TerminalSettings::_ApplyProfileSettings(const Model::Profile& profile)
{
// Fill in the Terminal Setting's CoreSettings from the profile
_HistorySize = profile.HistorySize();
@@ -332,18 +326,18 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
_TabColor = static_cast<winrt::Microsoft::Terminal::Core::Color>(colorRef);
}
const auto profileEnvVars = profile.EnvironmentVariables();
if (profileEnvVars == nullptr)
if (const auto profileEnvVars{ profile.EnvironmentVariables() })
{
_EnvironmentVariables = std::nullopt;
std::unordered_map<winrt::hstring, winrt::hstring> environmentVariables;
for (const auto& [key, value] : profileEnvVars)
{
environmentVariables.emplace(key, value);
}
_EnvironmentVariables = winrt::single_threaded_map(std::move(environmentVariables)).GetView();
}
else
{
_EnvironmentVariables = winrt::single_threaded_map<winrt::hstring, winrt::hstring>();
for (const auto& [key, value] : profileEnvVars)
{
_EnvironmentVariables.value().Insert(key, value);
}
_EnvironmentVariables = std::nullopt;
}
_Elevate = profile.Elevate();
@@ -401,16 +395,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// settings.
if (scheme == nullptr)
{
ClearAppliedColorScheme();
ClearDefaultForeground();
ClearDefaultBackground();
ClearSelectionBackground();
ClearCursorColor();
_DefaultForeground = std::nullopt;
_DefaultBackground = std::nullopt;
_SelectionBackground = std::nullopt;
_CursorColor = std::nullopt;
_ColorTable = std::nullopt;
}
else
{
AppliedColorScheme(scheme);
_DefaultForeground = til::color{ scheme.Foreground() };
_DefaultBackground = til::color{ scheme.Background() };
_SelectionBackground = til::color{ scheme.SelectionBackground() };
@@ -421,21 +413,16 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
std::transform(table.cbegin(), table.cend(), colorTable.begin(), [](auto&& color) {
return static_cast<winrt::Microsoft::Terminal::Core::Color>(til::color{ color });
});
ColorTable(colorTable);
SetColorTable(colorTable);
}
}
winrt::Microsoft::Terminal::Core::Color TerminalSettings::GetColorTableEntry(int32_t index) noexcept
{
return ColorTable().at(index);
}
void TerminalSettings::ColorTable(std::array<winrt::Microsoft::Terminal::Core::Color, 16> colors)
void TerminalSettings::SetColorTable(const std::array<winrt::Microsoft::Terminal::Core::Color, 16>& colors)
{
_ColorTable = colors;
}
std::array<winrt::Microsoft::Terminal::Core::Color, COLOR_TABLE_SIZE> TerminalSettings::ColorTable()
void TerminalSettings::GetColorTable(winrt::com_array<Microsoft::Terminal::Core::Color>& table) noexcept
{
auto span = _getColorTableImpl();
std::array<winrt::Microsoft::Terminal::Core::Color, COLOR_TABLE_SIZE> colorTable{};
@@ -449,8 +436,10 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
std::transform(campbellSpan.begin(), campbellSpan.end(), colorTable.begin(), [](auto&& color) {
return static_cast<winrt::Microsoft::Terminal::Core::Color>(til::color{ color });
});
span = colorTable;
}
return colorTable;
table = winrt::com_array(span.begin(), span.end());
}
std::span<winrt::Microsoft::Terminal::Core::Color> TerminalSettings::_getColorTableImpl()
@@ -459,9 +448,9 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
return std::span{ *_ColorTable };
}
for (auto&& parent : _parents)
if (_parent)
{
auto parentSpan = parent->_getColorTableImpl();
auto parentSpan = _parent->_getColorTableImpl();
if (parentSpan.size() > 0)
{
return parentSpan;

View File

@@ -0,0 +1,145 @@
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- TerminalSettings.h
Abstract:
- The implementation of the TerminalSettings winrt class. Provides both
terminal control settings and terminal core settings.
Author(s):
- Mike Griese - March 2019
--*/
#pragma once
#include <../inc/ControlProperties.h>
#include <DefaultSettings.h>
#include <conattrs.hpp>
#define SIMPLE_OVERRIDABLE_SETTING(type, name, ...) \
private: \
std::optional<type> _##name{ std::nullopt }; \
\
public: \
/* Returns the resolved value for this setting */ \
type name() const \
{ \
if (_##name.has_value()) \
{ \
return *_##name; \
} \
if (_parent && _parent->_##name.has_value()) \
{ \
return *_parent->_##name; \
} \
return type{ __VA_ARGS__ }; \
}
#ifdef UNIT_TESTING
namespace SettingsModelUnitTests
{
class TerminalSettingsTests;
}
#endif
namespace winrt::Microsoft::Terminal::Settings
{
using IFontAxesMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, float>;
using IEnvironmentVariableMapView = winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, winrt::hstring>;
struct TerminalSettingsCreateResult;
struct TerminalSettings :
winrt::implements<TerminalSettings, winrt::Microsoft::Terminal::Core::ICoreSettings, winrt::Microsoft::Terminal::Control::IControlSettings, winrt::Microsoft::Terminal::Core::ICoreAppearance, winrt::Microsoft::Terminal::Core::ICoreScheme, winrt::Microsoft::Terminal::Control::IControlAppearance>
{
TerminalSettings() = default;
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);
static TerminalSettingsCreateResult CreateWithNewTerminalArgs(const Model::CascadiaSettings& appSettings,
const Model::NewTerminalArgs& newTerminalArgs);
void ApplyColorScheme(const Model::ColorScheme& scheme);
void GetColorTable(winrt::com_array<Microsoft::Terminal::Core::Color>& table) noexcept;
void SetColorTable(const std::array<Microsoft::Terminal::Core::Color, 16>& colors);
// When set, StartingTabColor allows to create a terminal with a "sticky" tab color.
// This color is prioritized above the TabColor (that is usually initialized based on profile settings).
// Due to this prioritization, the tab color will be preserved upon settings reload
// (even if the profile's tab color gets altered or removed).
// This property is expected to be passed only once upon terminal creation.
// TODO: to ensure that this property is not populated during settings reload,
// we should consider moving this property to a separate interface,
// passed to the terminal only upon creation.
CORE_APPEARANCE_SETTINGS(SIMPLE_OVERRIDABLE_SETTING);
CONTROL_APPEARANCE_SETTINGS(SIMPLE_OVERRIDABLE_SETTING);
CORE_SETTINGS(SIMPLE_OVERRIDABLE_SETTING);
CONTROL_SETTINGS(SIMPLE_OVERRIDABLE_SETTING);
#if 0
SIMPLE_OVERRIDABLE_SETTING(float, Opacity, UseAcrylic() ? 0.5f : 1.0f);
SIMPLE_OVERRIDABLE_SETTING(hstring, FontFace, DEFAULT_FONT_FACE);
#endif
// Settings which do not pertain to the control (why are they here?)
SIMPLE_OVERRIDABLE_SETTING(bool, Elevate, false);
SIMPLE_OVERRIDABLE_SETTING(IEnvironmentVariableMapView, EnvironmentVariables, nullptr);
SIMPLE_OVERRIDABLE_SETTING(bool, ReloadEnvironmentVariables, true);
public:
// TerminalApp overrides these when duplicating a session
void StartingDirectory(const hstring& startingDirectory) { _StartingDirectory = startingDirectory; }
void Commandline(const hstring& commandline) { _Commandline = commandline; }
private:
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);
void _ApplyProfileSettings(const Model::Profile& profile);
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);
winrt::com_ptr<TerminalSettings> _parent;
#ifdef UNIT_TESTING
friend class SettingsModelUnitTests::TerminalSettingsTests;
#endif
};
struct TerminalSettingsCreateResult
{
public:
TerminalSettingsCreateResult(TerminalSettings* defaultSettings, TerminalSettings* unfocusedSettings)
{
_defaultSettings.copy_from(defaultSettings);
_unfocusedSettings.copy_from(unfocusedSettings);
}
TerminalSettingsCreateResult(TerminalSettings* defaultSettings) :
_unfocusedSettings{ nullptr }
{
_defaultSettings.copy_from(defaultSettings);
}
winrt::com_ptr<TerminalSettings> DefaultSettings() const { return _defaultSettings; };
winrt::com_ptr<TerminalSettings> UnfocusedSettings() const { return _unfocusedSettings; };
private:
winrt::com_ptr<TerminalSettings> _defaultSettings;
winrt::com_ptr<TerminalSettings> _unfocusedSettings;
};
}
#undef SIMPLE_OVERRIDABLE_SETTING

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<Reference>
<Private>false</Private>
</Reference>
</ItemDefinitionGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3c46e2b0-ae6c-4132-9122-6772fb411959}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>TerminalSettingsAppAdapterLib</RootNamespace>
<ProjectName>TerminalSettingsAppAdapterLib</ProjectName>
<TargetName>TerminalSettingsAppAdapterLib</TargetName>
<ConfigurationType>StaticLibrary</ConfigurationType>
<SubSystem>Console</SubSystem>
<OpenConsoleUniversalApp>true</OpenConsoleUniversalApp>
<CppWinRTGenerateWindowsMetadata>false</CppWinRTGenerateWindowsMetadata>
</PropertyGroup>
<PropertyGroup Label="NuGet Dependencies">
<TerminalCppWinrt>true</TerminalCppWinrt>
<TerminalMUX>true</TerminalMUX>
</PropertyGroup>
<Import Project="..\..\..\common.openconsole.props" Condition="'$(OpenConsoleDir)'==''" />
<Import Project="$(OpenConsoleDir)src\common.nugetversions.props" />
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.pre.props" />
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="TerminalSettings.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TerminalSettings.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(OpenConsoleDir)src\types\lib\types.vcxproj" />
<Reference Include="Microsoft.Terminal.TerminalConnection">
<HintPath>$(OpenConsoleCommonOutDir)TerminalConnection\Microsoft.Terminal.TerminalConnection.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
<Reference Include="Microsoft.Terminal.Settings.Model">
<HintPath>$(OpenConsoleCommonOutDir)Microsoft.Terminal.Settings.Model\Microsoft.Terminal.Settings.Model.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
<Reference Include="Microsoft.Terminal.Control">
<HintPath>$(OpenConsoleCommonOutDir)Microsoft.Terminal.Control\Microsoft.Terminal.Control.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
<Reference Include="Microsoft.Terminal.Core">
<HintPath>$(OpenConsoleCommonOutDir)TerminalCore\Microsoft.Terminal.Core.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Private>false</Private>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
</ItemGroup>
<Import Project="$(OpenConsoleDir)src\cppwinrt.build.post.props" />
<Import Project="$(OpenConsoleDir)src\common.nugetversions.targets" />
</Project>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Natvis Include="$(SolutionDir)tools\ConsoleTypes.natvis" />
<Natvis Include="$(MSBuildThisFileDirectory)..\..\natvis\wil.natvis" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp" />
<ClCompile Include="TerminalSettings.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="TerminalSettings.h" />
</ItemGroup>
</Project>

View File

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

View File

@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
//
// pch.h
// Header for platform projection include files
//
#pragma once
#define WIN32_LEAN_AND_MEAN
#define NOMCX
#define NOHELP
#define NOCOMM
// Manually include til after we include Windows.Foundation to give it winrt superpowers
#define BLOCK_TIL
#include <LibraryIncludes.h>
// This is inexplicable, but for whatever reason, cppwinrt conflicts with the
// SDK definition of this function, so the only fix is to undef it.
// from WinBase.h
// Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime
#ifdef GetCurrentTime
#undef GetCurrentTime
#endif
#include <wil/cppwinrt.h>
#include <unknwn.h>
#include <hstring.h>
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Microsoft.Terminal.Settings.Model.h>
#include <winrt/Microsoft.Terminal.Core.h>
#include <winrt/Microsoft.Terminal.Control.h>
#include <cppwinrt_utils.h>
// Manually include til after we include Windows.Foundation to give it winrt superpowers
#include "til.h"

View File

@@ -492,6 +492,10 @@
<ProjectReference Include="$(OpenConsoleDir)src\cascadia\TerminalSettingsModel\dll\Microsoft.Terminal.Settings.Model.vcxproj">
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="$(OpenConsoleDir)\src\cascadia\TerminalSettingsAppAdapterLib\TerminalSettingsAppAdapterLib.vcxproj">
<Project>{3c46e2b0-ae6c-4132-9122-6772fb411959}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<!-- Manually add a reference to TerminalControl here. We need this so

View File

@@ -10,6 +10,7 @@
#include <LibraryResources.h>
#include "../WinRTUtils/inc/Utils.h"
#include "../../renderer/base/FontCache.h"
#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h"
#include "SegoeFluentIconList.h"
#include "../../types/inc/utils.hpp"
@@ -284,12 +285,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
return _parsedPadding.Bottom;
}
Model::TerminalSettings ProfileViewModel::TermSettings() const
Control::IControlSettings ProfileViewModel::TermSettings() const
{
// This may look pricey, but it only resolves resources that have not been visited
// and the preview update is debounced.
_appSettings.ResolveMediaResources();
return Model::TerminalSettings::CreateForPreview(_appSettings, _profile);
return *Settings::TerminalSettings::CreateForPreview(_appSettings, _profile);
}
// Method Description:
@@ -720,7 +721,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
}
_MarkDuplicateBellSoundDirectories();
_CheckBellSoundsExistence();
_NotifyChanges(L"CurrentBellSounds");
}
@@ -732,19 +732,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
if (!_profile.HasBellSound())
{
std::vector<hstring> newSounds;
std::vector<IMediaResource> newSounds;
if (const auto inheritedSounds = _profile.BellSound())
{
// copy inherited bell sounds to the current layer
newSounds.reserve(inheritedSounds.Size());
for (const auto sound : inheritedSounds)
{
newSounds.push_back(sound);
}
newSounds = wil::to_vector(inheritedSounds);
}
// if we didn't inherit any bell sounds,
// we should still set the bell sound to an empty list (instead of null)
_profile.BellSound(winrt::single_threaded_vector<hstring>(std::move(newSounds)));
_profile.BellSound(winrt::single_threaded_vector(std::move(newSounds)));
}
}
@@ -768,56 +763,35 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
}
// Method Description:
// - Check if the bell sounds exist on disk. Mark any that don't exist
// so that they show the appropriate UI
safe_void_coroutine ProfileViewModel::_CheckBellSoundsExistence()
BellSoundViewModel::BellSoundViewModel(const Model::IMediaResource& resource) :
_resource{ resource }
{
co_await winrt::resume_background();
std::vector<Editor::BellSoundViewModel> markedSounds;
for (auto&& sound : _CurrentBellSounds)
if (_resource.Ok() && _resource.Path() != _resource.Resolved())
{
if (!std::filesystem::exists(std::wstring_view{ sound.Path() }))
{
markedSounds.push_back(sound);
}
// If the resource was resolved to something other than its path, show the path!
_ShowDirectory = true;
}
co_await winrt::resume_foreground(_dispatcher);
for (auto&& sound : markedSounds)
{
get_self<BellSoundViewModel>(sound)->FileExists(false);
}
}
BellSoundViewModel::BellSoundViewModel(hstring path) :
_Path{ path }
{
PropertyChanged([this](auto&&, const PropertyChangedEventArgs& args) {
if (args.PropertyName() == L"FileExists")
{
_NotifyChanges(L"DisplayPath", L"SubText");
}
});
}
hstring BellSoundViewModel::DisplayPath() const
{
if (_FileExists)
if (_resource.Ok())
{
// filename
const std::filesystem::path filePath{ std::wstring_view{ _Path } };
// filename; start from the resolved path to show where it actually landed
auto resolvedPath{ _resource.Resolved() };
const std::filesystem::path filePath{ std::wstring_view{ resolvedPath } };
return hstring{ filePath.filename().wstring() };
}
return _Path;
return _resource.Path();
}
hstring BellSoundViewModel::SubText() const
{
if (_FileExists)
if (_resource.Ok())
{
// Directory
const std::filesystem::path filePath{ std::wstring_view{ _Path } };
auto resolvedPath{ _resource.Resolved() };
const std::filesystem::path filePath{ std::wstring_view{ resolvedPath } };
return hstring{ filePath.parent_path().wstring() };
}
return RS_(L"Profile_BellSoundNotFound");
@@ -825,17 +799,22 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
hstring ProfileViewModel::BellSoundPreview()
{
const auto& currentSound = BellSound();
if (!currentSound || currentSound.Size() == 0)
if (!_CurrentBellSounds || _CurrentBellSounds.Size() == 0)
{
return RS_(L"Profile_BellSoundPreviewDefault");
}
else if (currentSound.Size() == 1)
if (_CurrentBellSounds.Size() > 1)
{
std::filesystem::path filePath{ std::wstring_view{ currentSound.GetAt(0) } };
return hstring{ filePath.filename().wstring() };
return RS_(L"Profile_BellSoundPreviewMultiple");
}
return RS_(L"Profile_BellSoundPreviewMultiple");
const auto currentBellSound = _CurrentBellSounds.GetAt(0);
if (currentBellSound.FileExists())
{
return currentBellSound.DisplayPath();
}
return RS_(L"Profile_BellSoundNotFound");
}
void ProfileViewModel::RequestAddBellSound(hstring path)
@@ -844,9 +823,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
// copy it over to the current layer and apply modifications
_PrepareModelForBellSoundModification();
// No need to check if the file exists. We came from the FilePicker. That's good enough.
_CurrentBellSounds.Append(winrt::make<BellSoundViewModel>(path));
_profile.BellSound().Append(path);
auto bellResource{ MediaResourceHelper::FromString(path) };
bellResource.Resolve(path); // No need to check if the file exists. We came from the FilePicker. That's good enough.
_CurrentBellSounds.Append(winrt::make<BellSoundViewModel>(bellResource));
_profile.BellSound().Append(bellResource);
_NotifyChanges(L"CurrentBellSounds");
}

View File

@@ -30,13 +30,16 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
struct BellSoundViewModel : BellSoundViewModelT<BellSoundViewModel>, ViewModelHelper<BellSoundViewModel>
{
public:
BellSoundViewModel(hstring path);
BellSoundViewModel(const Model::IMediaResource& resource);
hstring Path() const { return _resource.Path(); }
bool FileExists() const { return _resource.Ok(); }
hstring DisplayPath() const;
hstring SubText() const;
VIEW_MODEL_OBSERVABLE_PROPERTY(bool, FileExists, true);
VIEW_MODEL_OBSERVABLE_PROPERTY(hstring, Path);
VIEW_MODEL_OBSERVABLE_PROPERTY(bool, ShowDirectory);
private:
Model::IMediaResource _resource;
};
struct ProfileViewModel : ProfileViewModelT<ProfileViewModel>, ViewModelHelper<ProfileViewModel>
@@ -49,7 +52,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
static Windows::Foundation::Collections::IVector<IInspectable> BuiltInIcons() noexcept { return _BuiltInIcons; };
ProfileViewModel(const Model::Profile& profile, const Model::CascadiaSettings& settings, const Windows::UI::Core::CoreDispatcher& dispatcher);
Model::TerminalSettings TermSettings() const;
Control::IControlSettings TermSettings() const;
void DeleteProfile();
void SetupAppearances(Windows::Foundation::Collections::IObservableVector<Editor::ColorSchemeViewModel> schemesList);
@@ -190,7 +193,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void _InitializeCurrentBellSounds();
void _PrepareModelForBellSoundModification();
void _MarkDuplicateBellSoundDirectories();
safe_void_coroutine _CheckBellSoundsExistence();
static Windows::Foundation::Collections::IObservableVector<Editor::Font> _MonospaceFontList;
static Windows::Foundation::Collections::IObservableVector<Editor::Font> _FontList;
static Windows::Foundation::Collections::IVector<Windows::Foundation::IInspectable> _BuiltInIcons;

View File

@@ -27,7 +27,7 @@ namespace Microsoft.Terminal.Settings.Editor
runtimeclass BellSoundViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
String Path;
String Path { get; };
String DisplayPath { get; };
String SubText { get; };
Boolean ShowDirectory { get; };
@@ -52,8 +52,6 @@ namespace Microsoft.Terminal.Settings.Editor
runtimeclass ProfileViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
Microsoft.Terminal.Settings.Model.TerminalSettings TermSettings { get; };
event Windows.Foundation.TypedEventHandler<ProfileViewModel, DeleteProfileEventArgs> DeleteProfileRequested;
void SetupAppearances(Windows.Foundation.Collections.IObservableVector<ColorSchemeViewModel> schemesList);
@@ -149,7 +147,7 @@ namespace Microsoft.Terminal.Settings.Editor
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, SnapOnInput);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AltGrAliasing);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Microsoft.Terminal.Settings.Model.BellStyle, BellStyle);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Windows.Foundation.Collections.IVector<String>, BellSound);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Windows.Foundation.Collections.IVector<Microsoft.Terminal.Settings.Model.IMediaResource>, BellSound);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, Elevate);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, ReloadEnvironmentVariables);
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RightClickContextMenu);

View File

@@ -28,7 +28,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
if (!_previewControl)
{
const auto settings = _Profile.TermSettings();
const auto settings = winrt::get_self<implementation::ProfileViewModel>(_Profile)->TermSettings();
_previewConnection->DisplayPowerlineGlyphs(_Profile.DefaultAppearance().HasPowerlineCharacters());
_previewControl = Control::TermControl(settings, settings, *_previewConnection);
_previewControl.IsEnabled(false);
@@ -97,7 +97,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
.trailing = true,
},
[this]() {
const auto settings = _Profile.TermSettings();
const auto settings = winrt::get_self<implementation::ProfileViewModel>(_Profile)->TermSettings();
_previewConnection->DisplayPowerlineGlyphs(_Profile.DefaultAppearance().HasPowerlineCharacters());
_previewControl.UpdateControlSettings(settings, settings);
});

View File

@@ -342,107 +342,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
winrt::hstring ActionAndArgs::GenerateName(const winrt::Windows::ApplicationModel::Resources::Core::ResourceContext& context) const
{
// Sentinel used to indicate this command must ALWAYS be generated by GenerateName
static constexpr wil::zwstring_view MustGenerate{};
// Use a magic static to initialize this map, because we won't be able
// to load the resources at _init_, only at runtime.
static const auto GeneratedActionNames = []() {
return std::unordered_map<ShortcutAction, wil::zwstring_view>{
{ ShortcutAction::AdjustFontSize, USES_RESOURCE(L"AdjustFontSizeCommandKey") },
{ ShortcutAction::CloseOtherPanes, USES_RESOURCE(L"CloseOtherPanesCommandKey") },
{ ShortcutAction::CloseOtherTabs, MustGenerate },
{ ShortcutAction::ClosePane, USES_RESOURCE(L"ClosePaneCommandKey") },
{ ShortcutAction::CloseTab, MustGenerate },
{ ShortcutAction::CloseTabsAfter, MustGenerate },
{ ShortcutAction::CloseWindow, USES_RESOURCE(L"CloseWindowCommandKey") },
{ ShortcutAction::CopyText, USES_RESOURCE(L"CopyTextCommandKey") },
{ ShortcutAction::DuplicateTab, USES_RESOURCE(L"DuplicateTabCommandKey") },
{ ShortcutAction::ExecuteCommandline, USES_RESOURCE(L"ExecuteCommandlineCommandKey") },
{ ShortcutAction::Find, USES_RESOURCE(L"FindCommandKey") },
{ ShortcutAction::Invalid, MustGenerate },
{ ShortcutAction::MoveFocus, USES_RESOURCE(L"MoveFocusCommandKey") },
{ ShortcutAction::MovePane, USES_RESOURCE(L"MovePaneCommandKey") },
{ ShortcutAction::SwapPane, USES_RESOURCE(L"SwapPaneCommandKey") },
{ ShortcutAction::NewTab, USES_RESOURCE(L"NewTabCommandKey") },
{ ShortcutAction::NextTab, USES_RESOURCE(L"NextTabCommandKey") },
{ ShortcutAction::OpenNewTabDropdown, USES_RESOURCE(L"OpenNewTabDropdownCommandKey") },
{ ShortcutAction::OpenSettings, USES_RESOURCE(L"OpenSettingsUICommandKey") },
{ ShortcutAction::OpenTabColorPicker, USES_RESOURCE(L"OpenTabColorPickerCommandKey") },
{ ShortcutAction::PasteText, USES_RESOURCE(L"PasteTextCommandKey") },
{ ShortcutAction::PrevTab, USES_RESOURCE(L"PrevTabCommandKey") },
{ ShortcutAction::RenameTab, USES_RESOURCE(L"ResetTabNameCommandKey") },
{ ShortcutAction::OpenTabRenamer, USES_RESOURCE(L"OpenTabRenamerCommandKey") },
{ ShortcutAction::ResetFontSize, USES_RESOURCE(L"ResetFontSizeCommandKey") },
{ ShortcutAction::ResizePane, USES_RESOURCE(L"ResizePaneCommandKey") },
{ ShortcutAction::ScrollDown, USES_RESOURCE(L"ScrollDownCommandKey") },
{ ShortcutAction::ScrollDownPage, USES_RESOURCE(L"ScrollDownPageCommandKey") },
{ ShortcutAction::ScrollUp, USES_RESOURCE(L"ScrollUpCommandKey") },
{ ShortcutAction::ScrollUpPage, USES_RESOURCE(L"ScrollUpPageCommandKey") },
{ ShortcutAction::ScrollToTop, USES_RESOURCE(L"ScrollToTopCommandKey") },
{ ShortcutAction::ScrollToBottom, USES_RESOURCE(L"ScrollToBottomCommandKey") },
{ ShortcutAction::ScrollToMark, USES_RESOURCE(L"ScrollToPreviousMarkCommandKey") },
{ ShortcutAction::AddMark, USES_RESOURCE(L"AddMarkCommandKey") },
{ ShortcutAction::ClearMark, USES_RESOURCE(L"ClearMarkCommandKey") },
{ ShortcutAction::ClearAllMarks, USES_RESOURCE(L"ClearAllMarksCommandKey") },
{ ShortcutAction::SendInput, MustGenerate },
{ ShortcutAction::SetColorScheme, MustGenerate },
{ ShortcutAction::SetTabColor, USES_RESOURCE(L"ResetTabColorCommandKey") },
{ ShortcutAction::SplitPane, USES_RESOURCE(L"SplitPaneCommandKey") },
{ ShortcutAction::SwitchToTab, USES_RESOURCE(L"SwitchToTabCommandKey") },
{ ShortcutAction::TabSearch, USES_RESOURCE(L"TabSearchCommandKey") },
{ ShortcutAction::ToggleAlwaysOnTop, USES_RESOURCE(L"ToggleAlwaysOnTopCommandKey") },
{ ShortcutAction::ToggleCommandPalette, MustGenerate },
{ ShortcutAction::SaveSnippet, MustGenerate },
{ ShortcutAction::Suggestions, MustGenerate },
{ ShortcutAction::ToggleFocusMode, USES_RESOURCE(L"ToggleFocusModeCommandKey") },
{ ShortcutAction::SetFocusMode, MustGenerate },
{ ShortcutAction::ToggleFullscreen, USES_RESOURCE(L"ToggleFullscreenCommandKey") },
{ ShortcutAction::SetFullScreen, MustGenerate },
{ ShortcutAction::SetMaximized, MustGenerate },
{ ShortcutAction::TogglePaneZoom, USES_RESOURCE(L"TogglePaneZoomCommandKey") },
{ ShortcutAction::ToggleSplitOrientation, USES_RESOURCE(L"ToggleSplitOrientationCommandKey") },
{ ShortcutAction::ToggleShaderEffects, USES_RESOURCE(L"ToggleShaderEffectsCommandKey") },
{ ShortcutAction::MoveTab, MustGenerate },
{ ShortcutAction::BreakIntoDebugger, USES_RESOURCE(L"BreakIntoDebuggerCommandKey") },
{ ShortcutAction::FindMatch, MustGenerate },
{ ShortcutAction::TogglePaneReadOnly, USES_RESOURCE(L"TogglePaneReadOnlyCommandKey") },
{ ShortcutAction::EnablePaneReadOnly, USES_RESOURCE(L"EnablePaneReadOnlyCommandKey") },
{ ShortcutAction::DisablePaneReadOnly, USES_RESOURCE(L"DisablePaneReadOnlyCommandKey") },
{ ShortcutAction::NewWindow, USES_RESOURCE(L"NewWindowCommandKey") },
{ ShortcutAction::IdentifyWindow, USES_RESOURCE(L"IdentifyWindowCommandKey") },
{ ShortcutAction::IdentifyWindows, USES_RESOURCE(L"IdentifyWindowsCommandKey") },
{ ShortcutAction::RenameWindow, USES_RESOURCE(L"ResetWindowNameCommandKey") },
{ ShortcutAction::OpenWindowRenamer, USES_RESOURCE(L"OpenWindowRenamerCommandKey") },
{ ShortcutAction::DisplayWorkingDirectory, USES_RESOURCE(L"DisplayWorkingDirectoryCommandKey") },
{ ShortcutAction::GlobalSummon, MustGenerate },
{ ShortcutAction::SearchForText, MustGenerate },
{ ShortcutAction::QuakeMode, USES_RESOURCE(L"QuakeModeCommandKey") },
{ ShortcutAction::FocusPane, MustGenerate },
{ ShortcutAction::OpenSystemMenu, USES_RESOURCE(L"OpenSystemMenuCommandKey") },
{ ShortcutAction::ExportBuffer, MustGenerate },
{ ShortcutAction::ClearBuffer, MustGenerate },
{ ShortcutAction::MultipleActions, MustGenerate },
{ ShortcutAction::Quit, USES_RESOURCE(L"QuitCommandKey") },
{ ShortcutAction::AdjustOpacity, MustGenerate },
{ ShortcutAction::RestoreLastClosed, USES_RESOURCE(L"RestoreLastClosedCommandKey") },
{ ShortcutAction::SelectCommand, MustGenerate },
{ ShortcutAction::SelectOutput, MustGenerate },
{ ShortcutAction::SelectAll, USES_RESOURCE(L"SelectAllCommandKey") },
{ ShortcutAction::MarkMode, USES_RESOURCE(L"MarkModeCommandKey") },
{ ShortcutAction::ToggleBlockSelection, USES_RESOURCE(L"ToggleBlockSelectionCommandKey") },
{ ShortcutAction::SwitchSelectionEndpoint, USES_RESOURCE(L"SwitchSelectionEndpointCommandKey") },
{ ShortcutAction::ColorSelection, MustGenerate },
{ ShortcutAction::ShowContextMenu, USES_RESOURCE(L"ShowContextMenuCommandKey") },
{ ShortcutAction::ExpandSelectionToWord, USES_RESOURCE(L"ExpandSelectionToWordCommandKey") },
{ ShortcutAction::RestartConnection, USES_RESOURCE(L"RestartConnectionKey") },
{ ShortcutAction::ToggleBroadcastInput, USES_RESOURCE(L"ToggleBroadcastInputCommandKey") },
{ ShortcutAction::OpenScratchpad, USES_RESOURCE(L"OpenScratchpadKey") },
{ ShortcutAction::OpenAbout, USES_RESOURCE(L"OpenAboutCommandKey") },
{ ShortcutAction::QuickFix, USES_RESOURCE(L"QuickFixCommandKey") },
{ ShortcutAction::OpenCWD, USES_RESOURCE(L"OpenCWDCommandKey") },
};
}();
if (_Args)
{
auto nameFromArgs = _Args.GenerateName(context);
@@ -452,12 +351,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
}
const auto found = GeneratedActionNames.find(_Action);
if (found != GeneratedActionNames.end() && !found->second.empty())
{
return GetLibraryResourceLoader().ResourceMap().GetValue(found->second, context).ValueAsString();
}
return winrt::hstring{};
return ActionArgFactory::GetNameForAction(_Action, context);
}
winrt::hstring ActionAndArgs::GenerateName() const

View File

@@ -56,6 +56,7 @@
#include "JsonUtils.h"
#include "HashUtils.h"
#include "TerminalWarnings.h"
#include "../WinRTUtils/inc/LibraryResources.h"
#include "TerminalSettingsSerializationHelpers.h"
@@ -105,189 +106,208 @@ protected: \
// false, if we don't really care if the parameter is required or not.
////////////////////////////////////////////////////////////////////////////////
#define COPY_TEXT_ARGS(X) \
X(bool, DismissSelection, "dismissSelection", false, true) \
X(bool, SingleLine, "singleLine", false, false) \
X(bool, WithControlSequences, "withControlSequences", false, false) \
X(Windows::Foundation::IReference<Control::CopyFormat>, CopyFormatting, "copyFormatting", false, nullptr)
#define COPY_TEXT_ARGS(X) \
X(bool, DismissSelection, "dismissSelection", false, ArgTypeHint::None, true) \
X(bool, SingleLine, "singleLine", false, ArgTypeHint::None, false) \
X(bool, WithControlSequences, "withControlSequences", false, ArgTypeHint::None, false) \
X(Windows::Foundation::IReference<Control::CopyFormat>, CopyFormatting, "copyFormatting", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define MOVE_PANE_ARGS(X) \
X(uint32_t, TabIndex, "index", false, 0) \
X(winrt::hstring, Window, "window", false, L"")
#define MOVE_PANE_ARGS(X) \
X(uint32_t, TabIndex, "index", false, ArgTypeHint::None, 0) \
X(winrt::hstring, Window, "window", false, ArgTypeHint::None, L"")
////////////////////////////////////////////////////////////////////////////////
#define SWITCH_TO_TAB_ARGS(X) \
X(uint32_t, TabIndex, "index", false, 0)
X(uint32_t, TabIndex, "index", false, ArgTypeHint::None, 0)
////////////////////////////////////////////////////////////////////////////////
#define RESIZE_PANE_ARGS(X) \
X(Model::ResizeDirection, ResizeDirection, "direction", args->ResizeDirection() == ResizeDirection::None, Model::ResizeDirection::None)
X(Model::ResizeDirection, ResizeDirection, "direction", args->ResizeDirection() == ResizeDirection::None, ArgTypeHint::None, Model::ResizeDirection::None)
////////////////////////////////////////////////////////////////////////////////
#define MOVE_FOCUS_ARGS(X) \
X(Model::FocusDirection, FocusDirection, "direction", args->FocusDirection() == Model::FocusDirection::None, Model::FocusDirection::None)
X(Model::FocusDirection, FocusDirection, "direction", args->FocusDirection() == Model::FocusDirection::None, ArgTypeHint::None, Model::FocusDirection::None)
////////////////////////////////////////////////////////////////////////////////
#define SWAP_PANE_ARGS(X) \
X(Model::FocusDirection, Direction, "direction", args->Direction() == Model::FocusDirection::None, Model::FocusDirection::None)
X(Model::FocusDirection, Direction, "direction", args->Direction() == Model::FocusDirection::None, ArgTypeHint::None, Model::FocusDirection::None)
////////////////////////////////////////////////////////////////////////////////
#define ADJUST_FONT_SIZE_ARGS(X) \
X(float, Delta, "delta", false, 0)
X(float, Delta, "delta", false, ArgTypeHint::None, 0)
////////////////////////////////////////////////////////////////////////////////
#define SEND_INPUT_ARGS(X) \
X(winrt::hstring, Input, "input", args->Input().empty(), L"")
X(winrt::hstring, Input, "input", args->Input().empty(), ArgTypeHint::None, L"")
////////////////////////////////////////////////////////////////////////////////
#define OPEN_SETTINGS_ARGS(X) \
X(SettingsTarget, Target, "target", false, SettingsTarget::SettingsFile)
X(SettingsTarget, Target, "target", false, ArgTypeHint::None, SettingsTarget::SettingsFile)
////////////////////////////////////////////////////////////////////////////////
#define SET_FOCUS_MODE_ARGS(X) \
X(bool, IsFocusMode, "isFocusMode", false, false)
X(bool, IsFocusMode, "isFocusMode", false, ArgTypeHint::None, false)
////////////////////////////////////////////////////////////////////////////////
#define SET_MAXIMIZED_ARGS(X) \
X(bool, IsMaximized, "isMaximized", false, false)
X(bool, IsMaximized, "isMaximized", false, ArgTypeHint::None, false)
////////////////////////////////////////////////////////////////////////////////
#define SET_FULL_SCREEN_ARGS(X) \
X(bool, IsFullScreen, "isFullScreen", false, false)
X(bool, IsFullScreen, "isFullScreen", false, ArgTypeHint::None, false)
////////////////////////////////////////////////////////////////////////////////
#define SET_MAXIMIZED_ARGS(X) \
X(bool, IsMaximized, "isMaximized", false, false)
X(bool, IsMaximized, "isMaximized", false, ArgTypeHint::None, false)
////////////////////////////////////////////////////////////////////////////////
#define SET_COLOR_SCHEME_ARGS(X) \
X(winrt::hstring, SchemeName, "colorScheme", args->SchemeName().empty(), L"")
X(winrt::hstring, SchemeName, "colorScheme", args->SchemeName().empty(), ArgTypeHint::ColorScheme, L"")
////////////////////////////////////////////////////////////////////////////////
#define SET_TAB_COLOR_ARGS(X) \
X(Windows::Foundation::IReference<Windows::UI::Color>, TabColor, "color", false, nullptr)
X(Windows::Foundation::IReference<Windows::UI::Color>, TabColor, "color", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define RENAME_TAB_ARGS(X) \
X(winrt::hstring, Title, "title", false, L"")
X(winrt::hstring, Title, "title", false, ArgTypeHint::None, L"")
////////////////////////////////////////////////////////////////////////////////
#define EXECUTE_COMMANDLINE_ARGS(X) \
X(winrt::hstring, Commandline, "commandline", args->Commandline().empty(), L"")
X(winrt::hstring, Commandline, "commandline", args->Commandline().empty(), ArgTypeHint::None, L"")
////////////////////////////////////////////////////////////////////////////////
#define CLOSE_OTHER_TABS_ARGS(X) \
X(Windows::Foundation::IReference<uint32_t>, Index, "index", false, nullptr)
X(Windows::Foundation::IReference<uint32_t>, Index, "index", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define CLOSE_TABS_AFTER_ARGS(X) \
X(Windows::Foundation::IReference<uint32_t>, Index, "index", false, nullptr)
X(Windows::Foundation::IReference<uint32_t>, Index, "index", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define CLOSE_TAB_ARGS(X) \
X(Windows::Foundation::IReference<uint32_t>, Index, "index", false, nullptr)
X(Windows::Foundation::IReference<uint32_t>, Index, "index", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
// Interestingly, the order MATTERS here. Window has to be BEFORE Direction,
// because otherwise we won't have parsed the Window yet when we validate the
// Direction.
#define MOVE_TAB_ARGS(X) \
X(winrt::hstring, Window, "window", false, L"") \
X(MoveTabDirection, Direction, "direction", (args->Direction() == MoveTabDirection::None) && (args->Window().empty()), MoveTabDirection::None)
#define MOVE_TAB_ARGS(X) \
X(winrt::hstring, Window, "window", false, ArgTypeHint::None, L"") \
X(MoveTabDirection, Direction, "direction", (args->Direction() == MoveTabDirection::None) && (args->Window().empty()), ArgTypeHint::None, MoveTabDirection::None)
// Other ideas:
// X(uint32_t, TabIndex, "index", false, 0) \ // target? source?
////////////////////////////////////////////////////////////////////////////////
#define SCROLL_UP_ARGS(X) \
X(Windows::Foundation::IReference<uint32_t>, RowsToScroll, "rowsToScroll", false, nullptr)
X(Windows::Foundation::IReference<uint32_t>, RowsToScroll, "rowsToScroll", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define SCROLL_DOWN_ARGS(X) \
X(Windows::Foundation::IReference<uint32_t>, RowsToScroll, "rowsToScroll", false, nullptr)
X(Windows::Foundation::IReference<uint32_t>, RowsToScroll, "rowsToScroll", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define SCROLL_TO_MARK_ARGS(X) \
X(Microsoft::Terminal::Control::ScrollToMarkDirection, Direction, "direction", false, Microsoft::Terminal::Control::ScrollToMarkDirection::Previous)
X(Microsoft::Terminal::Control::ScrollToMarkDirection, Direction, "direction", false, ArgTypeHint::None, Microsoft::Terminal::Control::ScrollToMarkDirection::Previous)
////////////////////////////////////////////////////////////////////////////////
#define ADD_MARK_ARGS(X) \
X(Windows::Foundation::IReference<Microsoft::Terminal::Core::Color>, Color, "color", false, nullptr)
X(Windows::Foundation::IReference<Microsoft::Terminal::Core::Color>, Color, "color", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define TOGGLE_COMMAND_PALETTE_ARGS(X) \
X(CommandPaletteLaunchMode, LaunchMode, "launchMode", false, CommandPaletteLaunchMode::Action)
X(CommandPaletteLaunchMode, LaunchMode, "launchMode", false, ArgTypeHint::None, CommandPaletteLaunchMode::Action)
////////////////////////////////////////////////////////////////////////////////
#define SAVE_TASK_ARGS(X) \
X(winrt::hstring, Name, "name", false, L"") \
X(winrt::hstring, Commandline, "commandline", args->Commandline().empty(), L"") \
X(winrt::hstring, KeyChord, "keyChord", false, L"")
#define SAVE_TASK_ARGS(X) \
X(winrt::hstring, Name, "name", false, ArgTypeHint::None, L"") \
X(winrt::hstring, Commandline, "commandline", args->Commandline().empty(), ArgTypeHint::None, L"") \
X(winrt::hstring, KeyChord, "keyChord", false, ArgTypeHint::None, L"")
////////////////////////////////////////////////////////////////////////////////
#define SUGGESTIONS_ARGS(X) \
X(SuggestionsSource, Source, "source", false, SuggestionsSource::Tasks) \
X(bool, UseCommandline, "useCommandline", false, false)
#define SUGGESTIONS_ARGS(X) \
X(SuggestionsSource, Source, "source", false, ArgTypeHint::None, SuggestionsSource::Tasks) \
X(bool, UseCommandline, "useCommandline", false, ArgTypeHint::None, false)
////////////////////////////////////////////////////////////////////////////////
#define FIND_MATCH_ARGS(X) \
X(FindMatchDirection, Direction, "direction", args->Direction() == FindMatchDirection::None, FindMatchDirection::None)
X(FindMatchDirection, Direction, "direction", args->Direction() == FindMatchDirection::None, ArgTypeHint::None, FindMatchDirection::None)
////////////////////////////////////////////////////////////////////////////////
#define PREV_TAB_ARGS(X) \
X(Windows::Foundation::IReference<TabSwitcherMode>, SwitcherMode, "tabSwitcherMode", false, nullptr)
X(Windows::Foundation::IReference<TabSwitcherMode>, SwitcherMode, "tabSwitcherMode", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define NEXT_TAB_ARGS(X) \
X(Windows::Foundation::IReference<TabSwitcherMode>, SwitcherMode, "tabSwitcherMode", false, nullptr)
X(Windows::Foundation::IReference<TabSwitcherMode>, SwitcherMode, "tabSwitcherMode", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define RENAME_WINDOW_ARGS(X) \
X(winrt::hstring, Name, "name", false, L"")
X(winrt::hstring, Name, "name", false, ArgTypeHint::None, L"")
////////////////////////////////////////////////////////////////////////////////
#define SEARCH_FOR_TEXT_ARGS(X) \
X(winrt::hstring, QueryUrl, "queryUrl", false, L"")
X(winrt::hstring, QueryUrl, "queryUrl", false, ArgTypeHint::None, L"")
////////////////////////////////////////////////////////////////////////////////
#define GLOBAL_SUMMON_ARGS(X) \
X(winrt::hstring, Name, "name", false, L"") \
X(Model::DesktopBehavior, Desktop, "desktop", false, Model::DesktopBehavior::ToCurrent) \
X(Model::MonitorBehavior, Monitor, "monitor", false, Model::MonitorBehavior::ToMouse) \
X(bool, ToggleVisibility, "toggleVisibility", false, true) \
X(uint32_t, DropdownDuration, "dropdownDuration", false, 0)
#define GLOBAL_SUMMON_ARGS(X) \
X(winrt::hstring, Name, "name", false, ArgTypeHint::None, L"") \
X(Model::DesktopBehavior, Desktop, "desktop", false, ArgTypeHint::None, Model::DesktopBehavior::ToCurrent) \
X(Model::MonitorBehavior, Monitor, "monitor", false, ArgTypeHint::None, Model::MonitorBehavior::ToMouse) \
X(bool, ToggleVisibility, "toggleVisibility", false, ArgTypeHint::None, true) \
X(uint32_t, DropdownDuration, "dropdownDuration", false, ArgTypeHint::None, 0)
////////////////////////////////////////////////////////////////////////////////
#define FOCUS_PANE_ARGS(X) \
X(uint32_t, Id, "id", false, 0u)
X(uint32_t, Id, "id", false, ArgTypeHint::None, 0u)
////////////////////////////////////////////////////////////////////////////////
#define EXPORT_BUFFER_ARGS(X) \
X(winrt::hstring, Path, "path", false, L"")
X(winrt::hstring, Path, "path", false, ArgTypeHint::FilePath, L"")
////////////////////////////////////////////////////////////////////////////////
#define CLEAR_BUFFER_ARGS(X) \
X(winrt::Microsoft::Terminal::Control::ClearBufferType, Clear, "clear", false, winrt::Microsoft::Terminal::Control::ClearBufferType::All)
X(winrt::Microsoft::Terminal::Control::ClearBufferType, Clear, "clear", false, ArgTypeHint::None, winrt::Microsoft::Terminal::Control::ClearBufferType::All)
////////////////////////////////////////////////////////////////////////////////
#define ADJUST_OPACITY_ARGS(X) \
X(int32_t, Opacity, "opacity", false, 0) \
X(bool, Relative, "relative", false, true)
#define ADJUST_OPACITY_ARGS(X) \
X(int32_t, Opacity, "opacity", false, ArgTypeHint::None, 0) \
X(bool, Relative, "relative", false, ArgTypeHint::None, true)
////////////////////////////////////////////////////////////////////////////////
#define SELECT_COMMAND_ARGS(X) \
X(SelectOutputDirection, Direction, "direction", false, SelectOutputDirection::Previous)
X(SelectOutputDirection, Direction, "direction", false, ArgTypeHint::None, SelectOutputDirection::Previous)
////////////////////////////////////////////////////////////////////////////////
#define SELECT_OUTPUT_ARGS(X) \
X(SelectOutputDirection, Direction, "direction", false, SelectOutputDirection::Previous)
X(SelectOutputDirection, Direction, "direction", false, ArgTypeHint::None, SelectOutputDirection::Previous)
////////////////////////////////////////////////////////////////////////////////
#define COLOR_SELECTION_ARGS(X) \
X(winrt::Microsoft::Terminal::Control::SelectionColor, Foreground, "foreground", false, nullptr) \
X(winrt::Microsoft::Terminal::Control::SelectionColor, Background, "background", false, nullptr) \
X(winrt::Microsoft::Terminal::Core::MatchMode, MatchMode, "matchMode", false, winrt::Microsoft::Terminal::Core::MatchMode::None)
#define COLOR_SELECTION_ARGS(X) \
X(winrt::Microsoft::Terminal::Control::SelectionColor, Foreground, "foreground", false, ArgTypeHint::None, nullptr) \
X(winrt::Microsoft::Terminal::Control::SelectionColor, Background, "background", false, ArgTypeHint::None, nullptr) \
X(winrt::Microsoft::Terminal::Core::MatchMode, MatchMode, "matchMode", false, ArgTypeHint::None, winrt::Microsoft::Terminal::Core::MatchMode::None)
////////////////////////////////////////////////////////////////////////////////
#define NEW_TERMINAL_ARGS(X) \
X(winrt::hstring, Commandline, "commandline", false, ArgTypeHint::None, L"") \
X(winrt::hstring, StartingDirectory, "startingDirectory", false, ArgTypeHint::FolderPath, L"") \
X(winrt::hstring, TabTitle, "tabTitle", false, ArgTypeHint::None, L"") \
X(Windows::Foundation::IReference<Windows::UI::Color>, TabColor, "tabColor", false, ArgTypeHint::None, nullptr) \
X(Windows::Foundation::IReference<int32_t>, ProfileIndex, "index", false, ArgTypeHint::None, nullptr) \
X(winrt::hstring, Profile, "profile", false, ArgTypeHint::None, L"") \
X(Windows::Foundation::IReference<bool>, SuppressApplicationTitle, "suppressApplicationTitle", false, ArgTypeHint::None, nullptr) \
X(winrt::hstring, ColorScheme, "colorScheme", args->SchemeName().empty(), ArgTypeHint::ColorScheme, L"") \
X(Windows::Foundation::IReference<bool>, Elevate, "elevate", false, ArgTypeHint::None, nullptr) \
X(Windows::Foundation::IReference<bool>, ReloadEnvironmentVariables, "reloadEnvironmentVariables", false, ArgTypeHint::None, nullptr)
////////////////////////////////////////////////////////////////////////////////
#define SPLIT_PANE_ARGS(X) \
X(Model::SplitDirection, SplitDirection, "split", false, ArgTypeHint::None, SplitDirection::Automatic) \
X(SplitType, SplitMode, "splitMode", false, ArgTypeHint::None, SplitType::Manual) \
X(float, SplitSize, "size", false, ArgTypeHint::None, 0.5f)
////////////////////////////////////////////////////////////////////////////////
@@ -362,41 +382,19 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// assumptions made in the macro.
struct NewTerminalArgs : public NewTerminalArgsT<NewTerminalArgs>
{
NewTerminalArgs() = default;
NewTerminalArgs(int32_t& profileIndex) :
_ProfileIndex{ profileIndex } {};
PARTIAL_ACTION_ARG_BODY(NewTerminalArgs, NEW_TERMINAL_ARGS);
ACTION_ARG(winrt::hstring, Type, L"");
ACTION_ARG(winrt::hstring, Commandline, L"");
ACTION_ARG(winrt::hstring, StartingDirectory, L"");
ACTION_ARG(winrt::hstring, TabTitle, L"");
ACTION_ARG(Windows::Foundation::IReference<Windows::UI::Color>, TabColor, nullptr);
ACTION_ARG(Windows::Foundation::IReference<int32_t>, ProfileIndex, nullptr);
ACTION_ARG(winrt::hstring, Profile, L"");
ACTION_ARG(winrt::guid, SessionId, winrt::guid{});
ACTION_ARG(bool, AppendCommandLine, false);
ACTION_ARG(Windows::Foundation::IReference<bool>, SuppressApplicationTitle, nullptr);
ACTION_ARG(winrt::hstring, ColorScheme);
ACTION_ARG(Windows::Foundation::IReference<bool>, Elevate, nullptr);
ACTION_ARG(Windows::Foundation::IReference<bool>, ReloadEnvironmentVariables, nullptr);
ACTION_ARG(uint64_t, ContentId);
static constexpr std::string_view CommandlineKey{ "commandline" };
static constexpr std::string_view StartingDirectoryKey{ "startingDirectory" };
static constexpr std::string_view TabTitleKey{ "tabTitle" };
static constexpr std::string_view TabColorKey{ "tabColor" };
static constexpr std::string_view ProfileIndexKey{ "index" };
static constexpr std::string_view ProfileKey{ "profile" };
static constexpr std::string_view SessionIdKey{ "sessionId" };
static constexpr std::string_view AppendCommandLineKey{ "appendCommandLine" };
static constexpr std::string_view SuppressApplicationTitleKey{ "suppressApplicationTitle" };
static constexpr std::string_view ColorSchemeKey{ "colorScheme" };
static constexpr std::string_view ElevateKey{ "elevate" };
static constexpr std::string_view ReloadEnvironmentVariablesKey{ "reloadEnvironmentVariables" };
static constexpr std::string_view ContentKey{ "__content" };
public:
NewTerminalArgs(int32_t& profileIndex) :
_ProfileIndex{ profileIndex } {};
hstring GenerateName() const { return GenerateName(GetLibraryResourceLoader().ResourceContext()); }
hstring GenerateName(const winrt::Windows::ApplicationModel::Resources::Core::ResourceContext&) const;
hstring ToCommandline() const;
@@ -638,6 +636,38 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
h.write(ContentArgs());
return h.finalize();
}
winrt::Windows::Foundation::Collections::IVectorView<ArgDescriptor> GetArgDescriptors()
{
if (_ContentArgs)
{
if (const auto contentArgs = _ContentArgs.try_as<IActionArgsDescriptorAccess>())
{
return contentArgs.GetArgDescriptors();
}
}
return {};
}
IInspectable GetArgAt(uint32_t index) const
{
if (_ContentArgs)
{
if (const auto contentArgs = _ContentArgs.try_as<IActionArgsDescriptorAccess>())
{
return contentArgs.GetArgAt(index);
}
}
return nullptr;
}
void SetArgAt(uint32_t index, IInspectable value)
{
if (_ContentArgs)
{
if (const auto contentArgs = _ContentArgs.try_as<IActionArgsDescriptorAccess>())
{
contentArgs.SetArgAt(index, value);
}
}
}
};
struct SplitPaneArgs : public SplitPaneArgsT<SplitPaneArgs>
@@ -658,14 +688,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
SplitPaneArgs(SplitType splitMode) :
_SplitMode{ splitMode } {};
ACTION_ARG(Model::SplitDirection, SplitDirection, SplitDirection::Automatic);
SPLIT_PANE_ARGS(DECLARE_ARGS);
WINRT_PROPERTY(Model::INewContentArgs, ContentArgs, nullptr);
ACTION_ARG(SplitType, SplitMode, SplitType::Manual);
ACTION_ARG(float, SplitSize, 0.5f);
static constexpr std::string_view SplitKey{ "split" };
static constexpr std::string_view SplitModeKey{ "splitMode" };
static constexpr std::string_view SplitSizeKey{ "size" };
public:
hstring GenerateName() const { return GenerateName(GetLibraryResourceLoader().ResourceContext()); }
@@ -688,7 +712,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
// LOAD BEARING: Not using make_self here _will_ break you in the future!
auto args = winrt::make_self<SplitPaneArgs>();
JsonUtils::GetValueForKey(json, SplitKey, args->_SplitDirection);
JsonUtils::GetValueForKey(json, SplitDirectionKey, args->_SplitDirection);
JsonUtils::GetValueForKey(json, SplitModeKey, args->_SplitMode);
JsonUtils::GetValueForKey(json, SplitSizeKey, args->_SplitSize);
if (args->SplitSize() >= 1 || args->SplitSize() <= 0)
@@ -708,7 +732,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
const auto args{ get_self<SplitPaneArgs>(val) };
auto json{ ContentArgsToJson(args->_ContentArgs) };
JsonUtils::SetValueForKey(json, SplitKey, args->_SplitDirection);
JsonUtils::SetValueForKey(json, SplitDirectionKey, args->_SplitDirection);
JsonUtils::SetValueForKey(json, SplitModeKey, args->_SplitMode);
JsonUtils::SetValueForKey(json, SplitSizeKey, args->_SplitSize);
return json;
@@ -731,6 +755,65 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
h.write(SplitSize());
return h.finalize();
}
winrt::Windows::Foundation::Collections::IVectorView<Model::ArgDescriptor> GetArgDescriptors()
{
// Base args for SplitPane
static const auto baseArgs = INIT_ARG_DESCRIPTORS(SPLIT_PANE_ARGS);
// Cached merged variant: SplitPane + NewTerminalArgs
static const auto mergedArgs = [] {
std::vector<Model::ArgDescriptor> temp;
// copy baseArgs
for (const auto& desc : baseArgs)
{
temp.push_back(desc);
}
// append NewTerminalArgs args
const auto newTerminalArgsDesc{ Model::NewTerminalArgs{}.GetArgDescriptors() };
for (const auto& desc : newTerminalArgsDesc)
{
temp.push_back(desc);
}
return winrt::single_threaded_vector(std::move(temp)).GetView();
}();
// Pick which cached vector to return
if (_ContentArgs && _ContentArgs.try_as<NewTerminalArgs>())
{
return mergedArgs;
}
return baseArgs;
}
IInspectable GetArgAt(uint32_t index)
{
const auto additionalArgCount = ARG_COUNT(SPLIT_PANE_ARGS);
if (index < additionalArgCount)
{
X_MACRO_INDEX_BASE();
SPLIT_PANE_ARGS(GET_ARG_BY_INDEX);
}
else
{
return _ContentArgs.as<IActionArgsDescriptorAccess>().GetArgAt(index - additionalArgCount);
}
return nullptr;
}
void SetArgAt(uint32_t index, IInspectable value)
{
const auto additionalArgCount = ARG_COUNT(SPLIT_PANE_ARGS);
if (index < additionalArgCount)
{
X_MACRO_INDEX_BASE();
SPLIT_PANE_ARGS(SET_ARG_BY_INDEX);
}
else
{
_ContentArgs.as<IActionArgsDescriptorAccess>().SetArgAt(index - additionalArgCount, value);
}
}
};
struct NewWindowArgs : public NewWindowArgsT<NewWindowArgs>
@@ -782,6 +865,18 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
h.write(ContentArgs());
return h.finalize();
}
winrt::Windows::Foundation::Collections::IVectorView<Model::ArgDescriptor> GetArgDescriptors()
{
return _ContentArgs.as<IActionArgsDescriptorAccess>().GetArgDescriptors();
}
IInspectable GetArgAt(uint32_t index) const
{
return _ContentArgs.as<IActionArgsDescriptorAccess>().GetArgAt(index);
}
void SetArgAt(uint32_t index, IInspectable value)
{
_ContentArgs.as<IActionArgsDescriptorAccess>().SetArgAt(index, value);
}
};
ACTION_ARGS_STRUCT(CopyTextArgs, COPY_TEXT_ARGS);
@@ -922,6 +1017,18 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
h.write(winrt::get_abi(_Actions));
return h.finalize();
}
winrt::Windows::Foundation::Collections::IVectorView<Model::ArgDescriptor> GetArgDescriptors()
{
return {};
}
IInspectable GetArgAt(uint32_t /*index*/) const
{
return nullptr;
}
void SetArgAt(uint32_t /*index*/, IInspectable /*value*/)
{
throw winrt::hresult_not_implemented();
}
};
ACTION_ARGS_STRUCT(AdjustOpacityArgs, ADJUST_OPACITY_ARGS);

View File

@@ -5,6 +5,29 @@ import "Command.idl";
namespace Microsoft.Terminal.Settings.Model
{
enum ArgTypeHint
{
None = 0,
FilePath,
FolderPath,
ColorScheme
};
struct ArgDescriptor
{
String Name;
String Type;
Boolean Required;
ArgTypeHint TypeHint;
};
interface IActionArgsDescriptorAccess
{
Windows.Foundation.Collections.IVectorView<ArgDescriptor> GetArgDescriptors();
IInspectable GetArgAt(UInt32 index);
void SetArgAt(UInt32 index, Object value);
};
interface IActionArgs
{
Boolean Equals(IActionArgs other);
@@ -139,7 +162,7 @@ namespace Microsoft.Terminal.Settings.Model
BaseContentArgs(String type);
};
runtimeclass NewTerminalArgs : INewContentArgs {
runtimeclass NewTerminalArgs : INewContentArgs, IActionArgsDescriptorAccess {
NewTerminalArgs();
NewTerminalArgs(Int32 profileIndex);
@@ -178,7 +201,7 @@ namespace Microsoft.Terminal.Settings.Model
ActionEventArgs(IActionArgs args);
};
[default_interface] runtimeclass CopyTextArgs : IActionArgs
[default_interface] runtimeclass CopyTextArgs : IActionArgs, IActionArgsDescriptorAccess
{
CopyTextArgs();
Boolean DismissSelection { get; };
@@ -187,55 +210,55 @@ namespace Microsoft.Terminal.Settings.Model
Windows.Foundation.IReference<Microsoft.Terminal.Control.CopyFormat> CopyFormatting { get; };
};
[default_interface] runtimeclass NewTabArgs : IActionArgs
[default_interface] runtimeclass NewTabArgs : IActionArgs, IActionArgsDescriptorAccess
{
NewTabArgs(INewContentArgs contentArgs);
INewContentArgs ContentArgs { get; };
};
[default_interface] runtimeclass MovePaneArgs : IActionArgs
[default_interface] runtimeclass MovePaneArgs : IActionArgs, IActionArgsDescriptorAccess
{
MovePaneArgs(UInt32 tabIndex, String Window);
UInt32 TabIndex;
String Window;
};
[default_interface] runtimeclass SwitchToTabArgs : IActionArgs
[default_interface] runtimeclass SwitchToTabArgs : IActionArgs, IActionArgsDescriptorAccess
{
SwitchToTabArgs(UInt32 tabIndex);
UInt32 TabIndex;
};
[default_interface] runtimeclass ResizePaneArgs : IActionArgs
[default_interface] runtimeclass ResizePaneArgs : IActionArgs, IActionArgsDescriptorAccess
{
ResizeDirection ResizeDirection { get; };
};
[default_interface] runtimeclass MoveFocusArgs : IActionArgs
[default_interface] runtimeclass MoveFocusArgs : IActionArgs, IActionArgsDescriptorAccess
{
MoveFocusArgs(FocusDirection direction);
FocusDirection FocusDirection { get; };
};
[default_interface] runtimeclass SwapPaneArgs : IActionArgs
[default_interface] runtimeclass SwapPaneArgs : IActionArgs, IActionArgsDescriptorAccess
{
SwapPaneArgs(FocusDirection direction);
FocusDirection Direction { get; };
};
[default_interface] runtimeclass AdjustFontSizeArgs : IActionArgs
[default_interface] runtimeclass AdjustFontSizeArgs : IActionArgs, IActionArgsDescriptorAccess
{
Single Delta { get; };
};
[default_interface] runtimeclass SendInputArgs : IActionArgs
[default_interface] runtimeclass SendInputArgs : IActionArgs, IActionArgsDescriptorAccess
{
SendInputArgs(String input);
String Input { get; };
};
[default_interface] runtimeclass SplitPaneArgs : IActionArgs
[default_interface] runtimeclass SplitPaneArgs : IActionArgs, IActionArgsDescriptorAccess
{
SplitPaneArgs(SplitType splitMode, SplitDirection split, Single size, INewContentArgs contentArgs);
SplitPaneArgs(SplitDirection split, Single size, INewContentArgs contentArgs);
@@ -248,106 +271,106 @@ namespace Microsoft.Terminal.Settings.Model
Single SplitSize { get; };
};
[default_interface] runtimeclass OpenSettingsArgs : IActionArgs
[default_interface] runtimeclass OpenSettingsArgs : IActionArgs, IActionArgsDescriptorAccess
{
OpenSettingsArgs(SettingsTarget target);
SettingsTarget Target { get; };
};
[default_interface] runtimeclass SetFocusModeArgs : IActionArgs
[default_interface] runtimeclass SetFocusModeArgs : IActionArgs, IActionArgsDescriptorAccess
{
SetFocusModeArgs(Boolean isFocusMode);
Boolean IsFocusMode { get; };
};
[default_interface] runtimeclass SetFullScreenArgs : IActionArgs
[default_interface] runtimeclass SetFullScreenArgs : IActionArgs, IActionArgsDescriptorAccess
{
SetFullScreenArgs(Boolean isFullScreen);
Boolean IsFullScreen { get; };
};
[default_interface] runtimeclass SetMaximizedArgs : IActionArgs
[default_interface] runtimeclass SetMaximizedArgs : IActionArgs, IActionArgsDescriptorAccess
{
SetMaximizedArgs(Boolean isMaximized);
Boolean IsMaximized { get; };
};
[default_interface] runtimeclass SetColorSchemeArgs : IActionArgs
[default_interface] runtimeclass SetColorSchemeArgs : IActionArgs, IActionArgsDescriptorAccess
{
SetColorSchemeArgs(String name);
String SchemeName { get; };
};
[default_interface] runtimeclass SetTabColorArgs : IActionArgs
[default_interface] runtimeclass SetTabColorArgs : IActionArgs, IActionArgsDescriptorAccess
{
SetTabColorArgs(Windows.UI.Color tabColor);
Windows.Foundation.IReference<Windows.UI.Color> TabColor { get; };
};
[default_interface] runtimeclass RenameTabArgs : IActionArgs
[default_interface] runtimeclass RenameTabArgs : IActionArgs, IActionArgsDescriptorAccess
{
RenameTabArgs(String title);
String Title { get; };
};
[default_interface] runtimeclass ExecuteCommandlineArgs : IActionArgs
[default_interface] runtimeclass ExecuteCommandlineArgs : IActionArgs, IActionArgsDescriptorAccess
{
ExecuteCommandlineArgs(String commandline);
String Commandline;
};
[default_interface] runtimeclass CloseOtherTabsArgs : IActionArgs
[default_interface] runtimeclass CloseOtherTabsArgs : IActionArgs, IActionArgsDescriptorAccess
{
CloseOtherTabsArgs(UInt32 tabIndex);
Windows.Foundation.IReference<UInt32> Index { get; };
};
[default_interface] runtimeclass CloseTabsAfterArgs : IActionArgs
[default_interface] runtimeclass CloseTabsAfterArgs : IActionArgs, IActionArgsDescriptorAccess
{
CloseTabsAfterArgs(UInt32 tabIndex);
Windows.Foundation.IReference<UInt32> Index { get; };
};
[default_interface] runtimeclass CloseTabArgs : IActionArgs
[default_interface] runtimeclass CloseTabArgs : IActionArgs, IActionArgsDescriptorAccess
{
CloseTabArgs(UInt32 tabIndex);
Windows.Foundation.IReference<UInt32> Index { get; };
};
[default_interface] runtimeclass MoveTabArgs : IActionArgs
[default_interface] runtimeclass MoveTabArgs : IActionArgs, IActionArgsDescriptorAccess
{
MoveTabArgs(String window, MoveTabDirection direction);
MoveTabDirection Direction { get; };
String Window { get; };
};
[default_interface] runtimeclass ScrollUpArgs : IActionArgs
[default_interface] runtimeclass ScrollUpArgs : IActionArgs, IActionArgsDescriptorAccess
{
Windows.Foundation.IReference<UInt32> RowsToScroll { get; };
};
[default_interface] runtimeclass ScrollDownArgs : IActionArgs
[default_interface] runtimeclass ScrollDownArgs : IActionArgs, IActionArgsDescriptorAccess
{
Windows.Foundation.IReference<UInt32> RowsToScroll { get; };
};
[default_interface] runtimeclass ScrollToMarkArgs : IActionArgs
[default_interface] runtimeclass ScrollToMarkArgs : IActionArgs, IActionArgsDescriptorAccess
{
Microsoft.Terminal.Control.ScrollToMarkDirection Direction { get; };
};
[default_interface] runtimeclass AddMarkArgs : IActionArgs
[default_interface] runtimeclass AddMarkArgs : IActionArgs, IActionArgsDescriptorAccess
{
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> Color { get; };
};
[default_interface] runtimeclass ToggleCommandPaletteArgs : IActionArgs
[default_interface] runtimeclass ToggleCommandPaletteArgs : IActionArgs, IActionArgsDescriptorAccess
{
CommandPaletteLaunchMode LaunchMode { get; };
};
[default_interface] runtimeclass SuggestionsArgs : IActionArgs
[default_interface] runtimeclass SuggestionsArgs : IActionArgs, IActionArgsDescriptorAccess
{
SuggestionsArgs();
SuggestionsArgs(SuggestionsSource source, Boolean useCommandline);
@@ -355,13 +378,13 @@ namespace Microsoft.Terminal.Settings.Model
Boolean UseCommandline { get; };
};
[default_interface] runtimeclass FindMatchArgs : IActionArgs
[default_interface] runtimeclass FindMatchArgs : IActionArgs, IActionArgsDescriptorAccess
{
FindMatchArgs(FindMatchDirection direction);
FindMatchDirection Direction { get; };
};
[default_interface] runtimeclass SaveSnippetArgs : IActionArgs
[default_interface] runtimeclass SaveSnippetArgs : IActionArgs, IActionArgsDescriptorAccess
{
SaveSnippetArgs();
SaveSnippetArgs(String Name, String Commandline, String KeyChord);
@@ -370,38 +393,38 @@ namespace Microsoft.Terminal.Settings.Model
String KeyChord;
};
[default_interface] runtimeclass NewWindowArgs : IActionArgs
[default_interface] runtimeclass NewWindowArgs : IActionArgs, IActionArgsDescriptorAccess
{
NewWindowArgs(INewContentArgs contentArgs);
INewContentArgs ContentArgs { get; };
};
[default_interface] runtimeclass PrevTabArgs : IActionArgs
[default_interface] runtimeclass PrevTabArgs : IActionArgs, IActionArgsDescriptorAccess
{
PrevTabArgs();
PrevTabArgs(TabSwitcherMode SwitcherMode);
Windows.Foundation.IReference<TabSwitcherMode> SwitcherMode;
};
[default_interface] runtimeclass NextTabArgs : IActionArgs
[default_interface] runtimeclass NextTabArgs : IActionArgs, IActionArgsDescriptorAccess
{
NextTabArgs();
NextTabArgs(TabSwitcherMode SwitcherMode);
Windows.Foundation.IReference<TabSwitcherMode> SwitcherMode;
};
[default_interface] runtimeclass RenameWindowArgs : IActionArgs
[default_interface] runtimeclass RenameWindowArgs : IActionArgs, IActionArgsDescriptorAccess
{
RenameWindowArgs(String name);
String Name { get; };
};
[default_interface] runtimeclass SearchForTextArgs : IActionArgs
[default_interface] runtimeclass SearchForTextArgs : IActionArgs, IActionArgsDescriptorAccess
{
String QueryUrl { get; };
};
[default_interface] runtimeclass GlobalSummonArgs : IActionArgs
[default_interface] runtimeclass GlobalSummonArgs : IActionArgs, IActionArgsDescriptorAccess
{
String Name { get; };
DesktopBehavior Desktop { get; };
@@ -410,50 +433,50 @@ namespace Microsoft.Terminal.Settings.Model
UInt32 DropdownDuration { get; };
};
[default_interface] runtimeclass FocusPaneArgs : IActionArgs
[default_interface] runtimeclass FocusPaneArgs : IActionArgs, IActionArgsDescriptorAccess
{
FocusPaneArgs(UInt32 Id);
UInt32 Id { get; };
};
[default_interface] runtimeclass ExportBufferArgs : IActionArgs
[default_interface] runtimeclass ExportBufferArgs : IActionArgs, IActionArgsDescriptorAccess
{
ExportBufferArgs(String path);
String Path { get; };
};
[default_interface] runtimeclass ClearBufferArgs : IActionArgs
[default_interface] runtimeclass ClearBufferArgs : IActionArgs, IActionArgsDescriptorAccess
{
ClearBufferArgs(Microsoft.Terminal.Control.ClearBufferType clear);
Microsoft.Terminal.Control.ClearBufferType Clear { get; };
};
[default_interface] runtimeclass MultipleActionsArgs : IActionArgs
[default_interface] runtimeclass MultipleActionsArgs : IActionArgs, IActionArgsDescriptorAccess
{
MultipleActionsArgs();
Windows.Foundation.Collections.IVector<ActionAndArgs> Actions;
};
[default_interface] runtimeclass AdjustOpacityArgs : IActionArgs
[default_interface] runtimeclass AdjustOpacityArgs : IActionArgs, IActionArgsDescriptorAccess
{
AdjustOpacityArgs();
Int32 Opacity { get; };
Boolean Relative { get; };
};
[default_interface] runtimeclass ColorSelectionArgs : IActionArgs
[default_interface] runtimeclass ColorSelectionArgs : IActionArgs, IActionArgsDescriptorAccess
{
Microsoft.Terminal.Control.SelectionColor Foreground;
Microsoft.Terminal.Control.SelectionColor Background;
Microsoft.Terminal.Core.MatchMode MatchMode { get; };
};
[default_interface] runtimeclass SelectCommandArgs : IActionArgs
[default_interface] runtimeclass SelectCommandArgs : IActionArgs, IActionArgsDescriptorAccess
{
SelectCommandArgs(SelectOutputDirection direction);
SelectOutputDirection Direction { get; };
}
[default_interface] runtimeclass SelectOutputArgs : IActionArgs
[default_interface] runtimeclass SelectOutputArgs : IActionArgs, IActionArgsDescriptorAccess
{
SelectOutputArgs(SelectOutputDirection direction);
SelectOutputDirection Direction { get; };

View File

@@ -54,24 +54,79 @@ struct InitListPlaceholder
// expanded. Pretty critical for tracking down extraneous commas, etc.
// Property definitions, and JSON keys
#define DECLARE_ARGS(type, name, jsonKey, required, ...) \
static constexpr std::string_view name##Key{ jsonKey }; \
#define DECLARE_ARGS(type, name, jsonKey, required, typeHint, ...) \
static constexpr std::string_view name##Key{ jsonKey }; \
ACTION_ARG(type, name, ##__VA_ARGS__);
// Parameters to the non-default ctor
#define CTOR_PARAMS(type, name, jsonKey, required, ...) \
#define CTOR_PARAMS(type, name, jsonKey, required, typeHint, ...) \
const type &name##Param,
// initializers in the ctor
#define CTOR_INIT(type, name, jsonKey, required, ...) \
#define CTOR_INIT(type, name, jsonKey, required, typeHint, ...) \
_##name{ name##Param },
// Expands to `+1` for every arg in the list
#define COUNT_ONE(type, name, jsonKey, required, typeHint, ...) +1
// Arg count macro
#define ARG_COUNT(argsMacro) (0 argsMacro(COUNT_ONE))
#define ARG_DESC_STRINGIFY2(x) #x
#define ARG_DESC_STRINGIFY(x) ARG_DESC_STRINGIFY2(x)
#define ARG_DESC_WIDEN2(x) L##x
#define ARG_DESC_WIDEN(x) ARG_DESC_WIDEN2(x)
#define LOCALIZED_NAME(name) ARG_DESC_WIDEN(ARG_DESC_STRINGIFY(name##ActionArgumentLocalized))
// append this argument's description to the internal vector
#define APPEND_ARG_DESCRIPTION(type, name, jsonKey, required, typeHint, ...) \
temp.push_back({ RS_(LOCALIZED_NAME(name)), L## #type, std::wstring_view(L## #required) != L"false", typeHint });
#define INIT_ARG_DESCRIPTORS(argsMacro) \
([]() -> winrt::Windows::Foundation::Collections::IVectorView<ArgDescriptor> { \
std::vector<ArgDescriptor> temp; \
argsMacro(APPEND_ARG_DESCRIPTION) return winrt::single_threaded_vector(std::move(temp)).GetView(); \
}())
// check each property in the Equals() method. You'll note there's a stray
// `true` in the definition of Equals() below, that's to deal with trailing
// commas
#define EQUALS_ARGS(type, name, jsonKey, required, ...) \
#define EQUALS_ARGS(type, name, jsonKey, required, typeHint, ...) \
&&(otherAsUs->_##name == _##name)
#define X_MACRO_INDEX_BASE() \
constexpr auto X_MACRO_INDEXED_BASE__ = __COUNTER__
#define X_MACRO_INDEX() \
(__COUNTER__ - X_MACRO_INDEXED_BASE__ - 1)
// getter and setter for each property by index
#define GET_ARG_BY_INDEX(type, name, jsonKey, required, typeHint, ...) \
if (index == X_MACRO_INDEX()) \
{ \
if (_##name.has_value()) \
{ \
return winrt::box_value(_##name.value()); \
} \
else \
{ \
return winrt::box_value(static_cast<type>(__VA_ARGS__)); \
} \
}
#define SET_ARG_BY_INDEX(type, name, jsonKey, required, typeHint, ...) \
if (index == X_MACRO_INDEX()) \
{ \
if (value) \
{ \
_##name = winrt::unbox_value<type>(value); \
} \
else \
{ \
_##name = std::nullopt; \
} \
}
// JSON deserialization. If the parameter is required to pass any validation,
// add that as the `required` parameter here, as the body of a conditional
// EX: For the RESIZE_PANE_ARGS
@@ -79,7 +134,7 @@ struct InitListPlaceholder
// the bit
// args->ResizeDirection() == ResizeDirection::None
// is used as the conditional for the validation here.
#define FROM_JSON_ARGS(type, name, jsonKey, required, ...) \
#define FROM_JSON_ARGS(type, name, jsonKey, required, typeHint, ...) \
JsonUtils::GetValueForKey(json, jsonKey, args->_##name); \
if (required) \
{ \
@@ -87,17 +142,17 @@ struct InitListPlaceholder
}
// JSON serialization
#define TO_JSON_ARGS(type, name, jsonKey, required, ...) \
#define TO_JSON_ARGS(type, name, jsonKey, required, typeHint, ...) \
JsonUtils::SetValueForKey(json, jsonKey, args->_##name);
// Copy each property in the Copy() method
#define COPY_ARGS(type, name, jsonKey, required, ...) \
#define COPY_ARGS(type, name, jsonKey, required, typeHint, ...) \
copy->_##name = _##name;
// hash each property in Hash(). You'll note there's a stray `0` in the
// definition of Hash() below, that's to deal with trailing commas (or in this
// case, leading.)
#define HASH_ARGS(type, name, jsonKey, required, ...) \
#define HASH_ARGS(type, name, jsonKey, required, typeHint, ...) \
h.write(name());
// Use ACTION_ARGS_STRUCT when you've got no other customizing to do.
@@ -112,14 +167,7 @@ struct InitListPlaceholder
// * GlobalSummonArgs has the QuakeModeFromJson helper
#define ACTION_ARG_BODY(className, argsMacro) \
className() = default; \
className( \
argsMacro(CTOR_PARAMS) InitListPlaceholder = {}) : \
argsMacro(CTOR_INIT) _placeholder{} {}; \
argsMacro(DECLARE_ARGS); \
\
private: \
InitListPlaceholder _placeholder; \
PARTIAL_ACTION_ARG_BODY(className, argsMacro) \
\
public: \
hstring GenerateName() const \
@@ -167,3 +215,31 @@ public:
argsMacro(HASH_ARGS); \
return h.finalize(); \
}
#define PARTIAL_ACTION_ARG_BODY(className, argsMacro) \
className() = default; \
className( \
argsMacro(CTOR_PARAMS) InitListPlaceholder = {}) : \
argsMacro(CTOR_INIT) \
_placeholder{} {}; \
argsMacro(DECLARE_ARGS); \
\
private: \
InitListPlaceholder _placeholder; \
\
public: \
winrt::Windows::Foundation::Collections::IVectorView<ArgDescriptor> GetArgDescriptors() \
{ \
static const auto descriptors = INIT_ARG_DESCRIPTORS(argsMacro); \
return descriptors; \
} \
IInspectable GetArgAt(uint32_t index) const \
{ \
X_MACRO_INDEX_BASE(); \
argsMacro(GET_ARG_BY_INDEX) return nullptr; \
} \
void SetArgAt(uint32_t index, IInspectable value) \
{ \
X_MACRO_INDEX_BASE(); \
argsMacro(SET_ARG_BY_INDEX) \
}

View File

@@ -5,11 +5,11 @@
#include "AllShortcutActions.h"
#include "ActionMap.h"
#include "Command.h"
#include "AllShortcutActions.h"
#include <LibraryResources.h>
#include <til/io.h>
#include "ActionMap.g.cpp"
#include "ActionArgFactory.g.cpp"
using namespace winrt::Microsoft::Terminal::Settings::Model;
using namespace winrt::Microsoft::Terminal::Control;
@@ -61,6 +61,228 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return hasher.finalize();
}
winrt::hstring ActionArgFactory::GetNameForAction(Model::ShortcutAction action)
{
return GetNameForAction(action, GetLibraryResourceLoader().ResourceContext());
}
winrt::hstring ActionArgFactory::GetNameForAction(Model::ShortcutAction action, Windows::ApplicationModel::Resources::Core::ResourceContext context)
{
// Use a magic static to initialize this map, because we won't be able
// to load the resources at _init_, only at runtime.
static auto actionNames = []() {
return std::unordered_map<ShortcutAction, wil::zwstring_view>{
{ ShortcutAction::AddMark, USES_RESOURCE(L"AddMarkCommandKey") },
{ ShortcutAction::AdjustFontSize, USES_RESOURCE(L"AdjustFontSizeCommandKey") },
{ ShortcutAction::AdjustOpacity, USES_RESOURCE(L"AdjustOpacity") },
{ ShortcutAction::BreakIntoDebugger, USES_RESOURCE(L"BreakIntoDebuggerCommandKey") },
{ ShortcutAction::ClearAllMarks, USES_RESOURCE(L"ClearAllMarksCommandKey") },
{ ShortcutAction::ClearBuffer, USES_RESOURCE(L"ClearBuffer") },
{ ShortcutAction::ClearMark, USES_RESOURCE(L"ClearMarkCommandKey") },
{ ShortcutAction::CloseOtherPanes, USES_RESOURCE(L"CloseOtherPanesCommandKey") },
{ ShortcutAction::CloseOtherTabs, USES_RESOURCE(L"CloseOtherTabs") },
{ ShortcutAction::ClosePane, USES_RESOURCE(L"ClosePaneCommandKey") },
{ ShortcutAction::CloseTab, USES_RESOURCE(L"CloseTab") },
{ ShortcutAction::CloseTabsAfter, USES_RESOURCE(L"CloseTabsAfter") },
{ ShortcutAction::CloseWindow, USES_RESOURCE(L"CloseWindowCommandKey") },
{ ShortcutAction::ColorSelection, USES_RESOURCE(L"ColorSelection") },
{ ShortcutAction::CopyText, USES_RESOURCE(L"CopyTextCommandKey") },
{ ShortcutAction::DisplayWorkingDirectory, USES_RESOURCE(L"DisplayWorkingDirectoryCommandKey") },
{ ShortcutAction::DisablePaneReadOnly, USES_RESOURCE(L"DisablePaneReadOnlyCommandKey") },
{ ShortcutAction::DuplicateTab, USES_RESOURCE(L"DuplicateTabCommandKey") },
{ ShortcutAction::EnablePaneReadOnly, USES_RESOURCE(L"EnablePaneReadOnlyCommandKey") },
{ ShortcutAction::ExecuteCommandline, USES_RESOURCE(L"ExecuteCommandlineCommandKey") },
{ ShortcutAction::ExportBuffer, USES_RESOURCE(L"ExportBuffer") },
{ ShortcutAction::ExpandSelectionToWord, USES_RESOURCE(L"ExpandSelectionToWordCommandKey") },
{ ShortcutAction::Find, USES_RESOURCE(L"FindCommandKey") },
{ ShortcutAction::FindMatch, USES_RESOURCE(L"FindMatch") },
{ ShortcutAction::FocusPane, USES_RESOURCE(L"FocusPane") },
{ ShortcutAction::GlobalSummon, USES_RESOURCE(L"GlobalSummonCommandKey") },
{ ShortcutAction::IdentifyWindow, USES_RESOURCE(L"IdentifyWindowCommandKey") },
{ ShortcutAction::IdentifyWindows, USES_RESOURCE(L"IdentifyWindowsCommandKey") },
{ ShortcutAction::MarkMode, USES_RESOURCE(L"MarkModeCommandKey") },
{ ShortcutAction::MoveFocus, USES_RESOURCE(L"MoveFocusCommandKey") },
{ ShortcutAction::MovePane, USES_RESOURCE(L"MovePaneCommandKey") },
{ ShortcutAction::MoveTab, USES_RESOURCE(L"MoveTab") },
{ ShortcutAction::MultipleActions, USES_RESOURCE(L"MultipleActions") },
{ ShortcutAction::NewTab, USES_RESOURCE(L"NewTabCommandKey") },
{ ShortcutAction::NewWindow, USES_RESOURCE(L"NewWindowCommandKey") },
{ ShortcutAction::NextTab, USES_RESOURCE(L"NextTabCommandKey") },
{ ShortcutAction::OpenAbout, USES_RESOURCE(L"OpenAboutCommandKey") },
{ ShortcutAction::OpenCWD, USES_RESOURCE(L"OpenCWDCommandKey") },
{ ShortcutAction::OpenNewTabDropdown, USES_RESOURCE(L"OpenNewTabDropdownCommandKey") },
{ ShortcutAction::OpenScratchpad, USES_RESOURCE(L"OpenScratchpadKey") },
{ ShortcutAction::OpenSettings, USES_RESOURCE(L"OpenSettingsUICommandKey") },
{ ShortcutAction::OpenSystemMenu, USES_RESOURCE(L"OpenSystemMenuCommandKey") },
{ ShortcutAction::OpenTabColorPicker, USES_RESOURCE(L"OpenTabColorPickerCommandKey") },
{ ShortcutAction::OpenTabRenamer, USES_RESOURCE(L"OpenTabRenamerCommandKey") },
{ ShortcutAction::OpenWindowRenamer, USES_RESOURCE(L"OpenWindowRenamerCommandKey") },
{ ShortcutAction::PasteText, USES_RESOURCE(L"PasteTextCommandKey") },
{ ShortcutAction::PrevTab, USES_RESOURCE(L"PrevTabCommandKey") },
{ ShortcutAction::QuickFix, USES_RESOURCE(L"QuickFixCommandKey") },
{ ShortcutAction::QuakeMode, USES_RESOURCE(L"QuakeModeCommandKey") },
{ ShortcutAction::Quit, USES_RESOURCE(L"QuitCommandKey") },
{ ShortcutAction::RenameTab, USES_RESOURCE(L"ResetTabNameCommandKey") },
{ ShortcutAction::RenameWindow, USES_RESOURCE(L"ResetWindowNameCommandKey") },
{ ShortcutAction::ResetFontSize, USES_RESOURCE(L"ResetFontSizeCommandKey") },
{ ShortcutAction::RestartConnection, USES_RESOURCE(L"RestartConnectionKey") },
{ ShortcutAction::ResizePane, USES_RESOURCE(L"ResizePaneCommandKey") },
{ ShortcutAction::RestoreLastClosed, USES_RESOURCE(L"RestoreLastClosedCommandKey") },
{ ShortcutAction::SaveSnippet, USES_RESOURCE(L"SaveSnippetNamePrefix") },
{ ShortcutAction::ScrollDown, USES_RESOURCE(L"ScrollDownCommandKey") },
{ ShortcutAction::ScrollDownPage, USES_RESOURCE(L"ScrollDownPageCommandKey") },
{ ShortcutAction::ScrollToBottom, USES_RESOURCE(L"ScrollToBottomCommandKey") },
{ ShortcutAction::ScrollToMark, USES_RESOURCE(L"ScrollToPreviousMarkCommandKey") },
{ ShortcutAction::ScrollToTop, USES_RESOURCE(L"ScrollToTopCommandKey") },
{ ShortcutAction::ScrollUp, USES_RESOURCE(L"ScrollUpCommandKey") },
{ ShortcutAction::ScrollUpPage, USES_RESOURCE(L"ScrollUpPageCommandKey") },
{ ShortcutAction::SearchForText, USES_RESOURCE(L"SearchForText") },
{ ShortcutAction::SelectAll, USES_RESOURCE(L"SelectAllCommandKey") },
{ ShortcutAction::SelectCommand, USES_RESOURCE(L"SelectCommand") },
{ ShortcutAction::SelectOutput, USES_RESOURCE(L"SelectOutput") },
{ ShortcutAction::SendInput, USES_RESOURCE(L"SendInput") },
{ ShortcutAction::SetColorScheme, USES_RESOURCE(L"SetColorScheme") },
{ ShortcutAction::SetFocusMode, USES_RESOURCE(L"SetFocusMode") },
{ ShortcutAction::SetFullScreen, USES_RESOURCE(L"SetFullScreen") },
{ ShortcutAction::SetMaximized, USES_RESOURCE(L"SetMaximized") },
{ ShortcutAction::SetTabColor, USES_RESOURCE(L"ResetTabColorCommandKey") },
{ ShortcutAction::ShowContextMenu, USES_RESOURCE(L"ShowContextMenuCommandKey") },
{ ShortcutAction::SplitPane, USES_RESOURCE(L"SplitPaneCommandKey") },
{ ShortcutAction::Suggestions, USES_RESOURCE(L"Suggestions") },
{ ShortcutAction::SwapPane, USES_RESOURCE(L"SwapPaneCommandKey") },
{ ShortcutAction::SwitchSelectionEndpoint, USES_RESOURCE(L"SwitchSelectionEndpointCommandKey") },
{ ShortcutAction::SwitchToTab, USES_RESOURCE(L"SwitchToTabCommandKey") },
{ ShortcutAction::TabSearch, USES_RESOURCE(L"TabSearchCommandKey") },
{ ShortcutAction::ToggleAlwaysOnTop, USES_RESOURCE(L"ToggleAlwaysOnTopCommandKey") },
{ ShortcutAction::ToggleBlockSelection, USES_RESOURCE(L"ToggleBlockSelectionCommandKey") },
{ ShortcutAction::ToggleBroadcastInput, USES_RESOURCE(L"ToggleBroadcastInputCommandKey") },
{ ShortcutAction::ToggleCommandPalette, USES_RESOURCE(L"ToggleCommandPaletteCommandKey") },
{ ShortcutAction::ToggleFocusMode, USES_RESOURCE(L"ToggleFocusModeCommandKey") },
{ ShortcutAction::ToggleFullscreen, USES_RESOURCE(L"ToggleFullscreenCommandKey") },
{ ShortcutAction::TogglePaneReadOnly, USES_RESOURCE(L"TogglePaneReadOnlyCommandKey") },
{ ShortcutAction::TogglePaneZoom, USES_RESOURCE(L"TogglePaneZoomCommandKey") },
{ ShortcutAction::ToggleShaderEffects, USES_RESOURCE(L"ToggleShaderEffectsCommandKey") },
{ ShortcutAction::ToggleSplitOrientation, USES_RESOURCE(L"ToggleSplitOrientationCommandKey") },
};
}();
const auto found = actionNames.find(action);
if (found != actionNames.end() && !found->second.empty())
{
return GetLibraryResourceLoader().ResourceMap().GetValue(found->second, context).ValueAsString();
}
return winrt::hstring{};
}
winrt::Windows::Foundation::Collections::IMap<Model::ShortcutAction, winrt::hstring> ActionArgFactory::AvailableShortcutActionsAndNames()
{
std::unordered_map<ShortcutAction, winrt::hstring> actionNames;
#define ON_ALL_ACTIONS(action) actionNames.emplace(ShortcutAction::action, GetNameForAction(ShortcutAction::action));
ALL_SHORTCUT_ACTIONS
#undef ON_ALL_ACTIONS
return winrt::single_threaded_map(std::move(actionNames));
}
Model::IActionArgs ActionArgFactory::GetEmptyArgsForAction(Model::ShortcutAction shortcutAction)
{
// TODO: GH 19056 - we cannot cleanly macro this because of some special cases (SplitPaneArgs, NewTabArgs, NewWindowArgs)
// where we initialize a NewTerminalArgs object to pass in to them because the settings UI cannot currently handle
// a ContentArgs object that is not a NewTerminalArgs
switch (shortcutAction)
{
case Model::ShortcutAction::AdjustFontSize:
return winrt::make<AdjustFontSizeArgs>();
case Model::ShortcutAction::CloseOtherTabs:
return winrt::make<CloseOtherTabsArgs>();
case Model::ShortcutAction::CloseTabsAfter:
return winrt::make<CloseTabsAfterArgs>();
case Model::ShortcutAction::CloseTab:
return winrt::make<CloseTabArgs>();
case Model::ShortcutAction::CopyText:
return winrt::make<CopyTextArgs>();
case Model::ShortcutAction::ExecuteCommandline:
return winrt::make<ExecuteCommandlineArgs>();
case Model::ShortcutAction::FindMatch:
return winrt::make<FindMatchArgs>();
case Model::ShortcutAction::SearchForText:
return winrt::make<SearchForTextArgs>();
case Model::ShortcutAction::GlobalSummon:
return winrt::make<GlobalSummonArgs>();
case Model::ShortcutAction::MoveFocus:
return winrt::make<MoveFocusArgs>();
case Model::ShortcutAction::MovePane:
return winrt::make<MovePaneArgs>();
case Model::ShortcutAction::SwapPane:
return winrt::make<SwapPaneArgs>();
case Model::ShortcutAction::MoveTab:
return winrt::make<MoveTabArgs>();
case Model::ShortcutAction::NewTab:
return winrt::make<NewTabArgs>(Model::NewTerminalArgs{});
case Model::ShortcutAction::NewWindow:
return winrt::make<NewWindowArgs>(Model::NewTerminalArgs{});
case Model::ShortcutAction::NextTab:
return winrt::make<NextTabArgs>();
case Model::ShortcutAction::OpenSettings:
return winrt::make<OpenSettingsArgs>();
case Model::ShortcutAction::SetFocusMode:
return winrt::make<SetFocusModeArgs>();
case Model::ShortcutAction::SetFullScreen:
return winrt::make<SetFullScreenArgs>();
case Model::ShortcutAction::SetMaximized:
return winrt::make<SetMaximizedArgs>();
case Model::ShortcutAction::PrevTab:
return winrt::make<PrevTabArgs>();
case Model::ShortcutAction::RenameTab:
return winrt::make<RenameTabArgs>();
case Model::ShortcutAction::RenameWindow:
return winrt::make<RenameWindowArgs>();
case Model::ShortcutAction::ResizePane:
return winrt::make<ResizePaneArgs>();
case Model::ShortcutAction::ScrollDown:
return winrt::make<ScrollDownArgs>();
case Model::ShortcutAction::ScrollUp:
return winrt::make<ScrollUpArgs>();
case Model::ShortcutAction::ScrollToMark:
return winrt::make<ScrollToMarkArgs>();
case Model::ShortcutAction::AddMark:
return winrt::make<AddMarkArgs>();
case Model::ShortcutAction::SendInput:
return winrt::make<SendInputArgs>();
case Model::ShortcutAction::SetColorScheme:
return winrt::make<SetColorSchemeArgs>();
case Model::ShortcutAction::SetTabColor:
return winrt::make<SetTabColorArgs>();
case Model::ShortcutAction::SplitPane:
return winrt::make<SplitPaneArgs>(SplitDirection::Automatic, Model::NewTerminalArgs{});
case Model::ShortcutAction::SwitchToTab:
return winrt::make<SwitchToTabArgs>();
case Model::ShortcutAction::ToggleCommandPalette:
return winrt::make<ToggleCommandPaletteArgs>();
case Model::ShortcutAction::FocusPane:
return winrt::make<FocusPaneArgs>();
case Model::ShortcutAction::ExportBuffer:
return winrt::make<ExportBufferArgs>();
case Model::ShortcutAction::ClearBuffer:
return winrt::make<ClearBufferArgs>();
case Model::ShortcutAction::MultipleActions:
return winrt::make<MultipleActionsArgs>();
case Model::ShortcutAction::AdjustOpacity:
return winrt::make<AdjustOpacityArgs>();
case Model::ShortcutAction::Suggestions:
return winrt::make<SuggestionsArgs>();
case Model::ShortcutAction::SelectCommand:
return winrt::make<SelectCommandArgs>();
case Model::ShortcutAction::SelectOutput:
return winrt::make<SelectOutputArgs>();
case Model::ShortcutAction::ColorSelection:
return winrt::make<ColorSelectionArgs>();
default:
return nullptr;
}
}
// Method Description:
// - Detects if any of the user's actions are identical to the inbox actions,
// and if so, deletes them and redirects their keybindings to the inbox actions
@@ -380,6 +602,15 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return _ResolvedKeyToActionMapCache.GetView();
}
IVectorView<Model::Command> ActionMap::AllCommands()
{
if (!_ResolvedKeyToActionMapCache)
{
_RefreshKeyBindingCaches();
}
return _AllCommandsCache.GetView();
}
void ActionMap::_RefreshKeyBindingCaches()
{
_CumulativeKeyToActionMapCache.clear();
@@ -387,6 +618,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
_CumulativeActionToKeyMapCache.clear();
std::unordered_map<KeyChord, Model::Command, KeyChordHash, KeyChordEquality> globalHotkeys;
std::unordered_map<KeyChord, Model::Command, KeyChordHash, KeyChordEquality> resolvedKeyToActionMap;
std::vector<Model::Command> allCommandsVector;
_PopulateCumulativeKeyMaps(_CumulativeKeyToActionMapCache, _CumulativeActionToKeyMapCache);
_PopulateCumulativeActionMap(_CumulativeIDToActionMapCache);
@@ -406,8 +638,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
}
for (const auto& [_, cmd] : _CumulativeIDToActionMapCache)
{
allCommandsVector.emplace_back(cmd);
}
_ResolvedKeyToActionMapCache = single_threaded_map(std::move(resolvedKeyToActionMap));
_GlobalHotkeysCache = single_threaded_map(std::move(globalHotkeys));
_AllCommandsCache = single_threaded_vector(std::move(allCommandsVector));
}
com_ptr<ActionMap> ActionMap::Copy() const
@@ -421,7 +659,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
actionMap->_ActionMap.reserve(_ActionMap.size());
for (const auto& [actionID, cmd] : _ActionMap)
{
actionMap->_ActionMap.emplace(actionID, *winrt::get_self<Command>(cmd)->Copy());
const auto copiedCmd = winrt::get_self<Command>(cmd)->Copy();
actionMap->_ActionMap.emplace(actionID, *copiedCmd);
}
// Name --> Command
@@ -686,6 +925,24 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return nullptr;
}
IVector<Control::KeyChord> ActionMap::AllKeyBindingsForAction(const winrt::hstring& cmdID)
{
if (!_ResolvedKeyToActionMapCache)
{
_RefreshKeyBindingCaches();
}
std::vector<Control::KeyChord> keybindingsList;
for (const auto& [key, ID] : _CumulativeKeyToActionMapCache)
{
if (ID == cmdID)
{
keybindingsList.emplace_back(key);
}
}
return single_threaded_vector(std::move(keybindingsList));
}
// Method Description:
// - Rebinds a key binding to a new key chord
// Arguments:
@@ -741,6 +998,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
}
void ActionMap::AddKeyBinding(Control::KeyChord keys, const winrt::hstring& cmdID)
{
_KeyMap.insert_or_assign(keys, cmdID);
_changeLog.emplace(KeysKey);
_RefreshKeyBindingCaches();
}
// Method Description:
// - Add a new key binding
// - If the key chord is already in use, the conflicting command is overwritten.
@@ -757,6 +1021,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
AddAction(*cmd, keys);
}
void ActionMap::DeleteUserCommand(const winrt::hstring& cmdID)
{
_ActionMap.erase(cmdID);
_RefreshKeyBindingCaches();
}
// This is a helper to aid in sorting commands by their `Name`s, alphabetically.
static bool _compareSchemeNames(const ColorScheme& lhs, const ColorScheme& rhs)
{
@@ -936,6 +1206,52 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
AddAction(*cmd, keys);
}
void ActionMap::UpdateCommandID(const Model::Command& cmd, winrt::hstring newID)
{
const auto oldID = cmd.ID();
if (newID.empty())
{
// if the new ID is empty, that means we need to generate a new one
newID = winrt::get_self<implementation::ActionAndArgs>(cmd.ActionAndArgs())->GenerateID();
}
if (newID != oldID)
{
if (const auto foundCmd{ _GetActionByID(newID) })
{
const auto foundCmdActionAndArgs = foundCmd.ActionAndArgs();
if (foundCmdActionAndArgs != cmd.ActionAndArgs())
{
// we found a command that has the same ID as this one, but that command has different ActionAndArgs
// this means that foundCommand's action and/or args have been changed since its ID was generated,
// generate a new one for it
// Note: this is recursive! We're calling UpdateCommandID again wich lands us back in here to resolve any cascading collisions
auto foundCmdNewID = winrt::get_self<implementation::ActionAndArgs>(foundCmdActionAndArgs)->GenerateID();
UpdateCommandID(foundCmd, foundCmdNewID);
}
}
winrt::get_self<implementation::Command>(cmd)->ID(newID);
// update _ActionMap with the ID change
_ActionMap.erase(oldID);
_ActionMap.emplace(newID, cmd);
// update _KeyMap so that all keys that pointed to the old ID now point to the new ID
std::vector<KeyChord> keysToRemap;
for (const auto& [keys, cmdID] : _KeyMap)
{
if (cmdID == oldID)
{
keysToRemap.push_back(keys);
}
}
for (const auto& keys : keysToRemap)
{
_KeyMap.erase(keys);
_KeyMap.emplace(keys, newID);
}
}
_RefreshKeyBindingCaches();
}
// Look for a .wt.json file in the given directory. If it exists,
// read it, parse it's JSON, and retrieve all the sendInput actions.
std::unordered_map<hstring, Model::Command> ActionMap::_loadLocalSnippets(const std::filesystem::path& currentWorkingDirectory)

View File

@@ -16,6 +16,7 @@ Author(s):
#pragma once
#include "ActionMap.g.h"
#include "ActionArgFactory.g.h"
#include "IInheritable.h"
#include "Command.h"
@@ -47,6 +48,16 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}
};
struct ActionArgFactory
{
ActionArgFactory() = default;
static winrt::hstring GetNameForAction(ShortcutAction action);
static winrt::hstring GetNameForAction(ShortcutAction action, Windows::ApplicationModel::Resources::Core::ResourceContext context);
static Windows::Foundation::Collections::IMap<Model::ShortcutAction, winrt::hstring> AvailableShortcutActionsAndNames();
static Model::IActionArgs GetEmptyArgsForAction(Model::ShortcutAction shortcutAction);
};
struct ActionMap : ActionMapT<ActionMap>, IInheritable<ActionMap>
{
void _FinalizeInheritance() override;
@@ -56,6 +67,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
Windows::Foundation::Collections::IMapView<hstring, Model::Command> NameMap();
Windows::Foundation::Collections::IMapView<Control::KeyChord, Model::Command> GlobalHotkeys();
Windows::Foundation::Collections::IMapView<Control::KeyChord, Model::Command> KeyBindings();
Windows::Foundation::Collections::IVectorView<Model::Command> AllCommands();
com_ptr<ActionMap> Copy() const;
// queries
@@ -63,6 +75,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
Model::Command GetActionByID(const winrt::hstring& cmdID) const;
bool IsKeyChordExplicitlyUnbound(const Control::KeyChord& keys) const;
Control::KeyChord GetKeyBindingForAction(const winrt::hstring& cmdID);
Windows::Foundation::Collections::IVector<Control::KeyChord> AllKeyBindingsForAction(const winrt::hstring& cmdID);
// population
void AddAction(const Model::Command& cmd, const Control::KeyChord& keys);
@@ -78,8 +91,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// modification
bool RebindKeys(const Control::KeyChord& oldKeys, const Control::KeyChord& newKeys);
void DeleteKeyBinding(const Control::KeyChord& keys);
void AddKeyBinding(Control::KeyChord keys, const winrt::hstring& cmdID);
void RegisterKeyBinding(Control::KeyChord keys, Model::ActionAndArgs action);
void DeleteUserCommand(const winrt::hstring& cmdID);
void AddSendInputAction(winrt::hstring name, winrt::hstring input, const Control::KeyChord keys);
void UpdateCommandID(const Model::Command& cmd, winrt::hstring newID);
Windows::Foundation::Collections::IVector<Model::Command> ExpandedCommands();
void ExpandCommands(const Windows::Foundation::Collections::IVectorView<Model::Profile>& profiles,
@@ -138,6 +154,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// This is effectively a combination of _CumulativeKeyMapCache and _CumulativeActionMapCache and its purpose is so that
// we can give the SUI a view of the key chords and the commands they map to
Windows::Foundation::Collections::IMap<Control::KeyChord, Model::Command> _ResolvedKeyToActionMapCache{ nullptr };
Windows::Foundation::Collections::IVector<Model::Command> _AllCommandsCache{ nullptr };
til::shared_mutex<std::unordered_map<std::filesystem::path, std::unordered_map<hstring, Model::Command>>> _cwdLocalSnippetsCache{};
@@ -148,3 +165,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
friend class SettingsModelUnitTests::TerminalSettingsTests;
};
}
namespace winrt::Microsoft::Terminal::Settings::Model::factory_implementation
{
BASIC_FACTORY(ActionArgFactory);
}

View File

@@ -6,6 +6,14 @@ import "ISettingsModelObject.idl";
namespace Microsoft.Terminal.Settings.Model
{
static runtimeclass ActionArgFactory
{
static String GetNameForAction(Microsoft.Terminal.Settings.Model.ShortcutAction action);
static String GetNameForAction(Microsoft.Terminal.Settings.Model.ShortcutAction action, Windows.ApplicationModel.Resources.Core.ResourceContext context);
static Windows.Foundation.Collections.IMap<Microsoft.Terminal.Settings.Model.ShortcutAction, String> AvailableShortcutActionsAndNames { get; };
static IActionArgs GetEmptyArgsForAction(Microsoft.Terminal.Settings.Model.ShortcutAction shortcutAction);
}
// This interface ensures that no changes are made to ActionMap
interface IActionMapView
{
@@ -14,12 +22,14 @@ namespace Microsoft.Terminal.Settings.Model
Command GetActionByKeyChord(Microsoft.Terminal.Control.KeyChord keys);
Command GetActionByID(String cmdID);
Microsoft.Terminal.Control.KeyChord GetKeyBindingForAction(String cmdID);
IVector<Microsoft.Terminal.Control.KeyChord> AllKeyBindingsForAction(String cmdID);
Windows.Foundation.Collections.IMapView<String, ActionAndArgs> AvailableActions { get; };
Windows.Foundation.Collections.IMapView<String, Command> NameMap { get; };
Windows.Foundation.Collections.IMapView<Microsoft.Terminal.Control.KeyChord, Command> KeyBindings { get; };
Windows.Foundation.Collections.IMapView<Microsoft.Terminal.Control.KeyChord, Command> GlobalHotkeys { get; };
Windows.Foundation.Collections.IVectorView<Command> AllCommands { get; };
IVector<Command> ExpandedCommands { get; };
@@ -28,9 +38,11 @@ namespace Microsoft.Terminal.Settings.Model
runtimeclass ActionMap : IActionMapView
{
void AddAction(Command cmd, Microsoft.Terminal.Control.KeyChord keys);
void RebindKeys(Microsoft.Terminal.Control.KeyChord oldKeys, Microsoft.Terminal.Control.KeyChord newKeys);
void DeleteKeyBinding(Microsoft.Terminal.Control.KeyChord keys);
void DeleteUserCommand(String cmdID);
void AddKeyBinding(Microsoft.Terminal.Control.KeyChord keys, String cmdID);
void RegisterKeyBinding(Microsoft.Terminal.Control.KeyChord keys, ActionAndArgs action);
void AddSendInputAction(String name, String input, Microsoft.Terminal.Control.KeyChord keys);
}

View File

@@ -1258,3 +1258,8 @@ void CascadiaSettings::ExpandCommands()
{
_globals->ExpandCommands(ActiveProfiles().GetView(), GlobalSettings().ColorSchemes());
}
void CascadiaSettings::UpdateCommandID(const Model::Command& cmd, winrt::hstring newID)
{
_globals->UpdateCommandID(cmd, newID);
}

View File

@@ -193,6 +193,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
void CurrentDefaultTerminal(const Model::DefaultTerminal& terminal);
void ExpandCommands();
void UpdateCommandID(const Model::Command& cmd, winrt::hstring newID);
void ResolveMediaResources() { _validateMediaResources(); }
void LogSettingChanges(bool isJsonLoad) const;

View File

@@ -64,6 +64,7 @@ namespace Microsoft.Terminal.Settings.Model
DefaultTerminal CurrentDefaultTerminal;
void ExpandCommands();
void UpdateCommandID(Command cmd, String newID);
void ResolveMediaResources();
}

View File

@@ -164,33 +164,6 @@ void ColorScheme::SetColorTableEntry(uint8_t index, const Core::Color& value) no
_table[index] = value;
}
winrt::Microsoft::Terminal::Core::Scheme ColorScheme::ToCoreScheme() const noexcept
{
winrt::Microsoft::Terminal::Core::Scheme coreScheme{};
coreScheme.Foreground = Foreground();
coreScheme.Background = Background();
coreScheme.CursorColor = CursorColor();
coreScheme.SelectionBackground = SelectionBackground();
coreScheme.Black = Table()[0];
coreScheme.Red = Table()[1];
coreScheme.Green = Table()[2];
coreScheme.Yellow = Table()[3];
coreScheme.Blue = Table()[4];
coreScheme.Purple = Table()[5];
coreScheme.Cyan = Table()[6];
coreScheme.White = Table()[7];
coreScheme.BrightBlack = Table()[8];
coreScheme.BrightRed = Table()[9];
coreScheme.BrightGreen = Table()[10];
coreScheme.BrightYellow = Table()[11];
coreScheme.BrightBlue = Table()[12];
coreScheme.BrightPurple = Table()[13];
coreScheme.BrightCyan = Table()[14];
coreScheme.BrightWhite = Table()[15];
return coreScheme;
}
bool ColorScheme::IsEquivalentForSettingsMergePurposes(const winrt::com_ptr<ColorScheme>& other) noexcept
{
// The caller likely only got here if the names were the same, so skip checking that one.

View File

@@ -46,8 +46,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
static com_ptr<ColorScheme> FromJson(const Json::Value& json);
Json::Value ToJson() const;
winrt::Microsoft::Terminal::Core::Scheme ToCoreScheme() const noexcept;
com_array<Core::Color> Table() const noexcept;
void SetColorTableEntry(uint8_t index, const Core::Color& value) noexcept;

View File

@@ -21,7 +21,5 @@ namespace Microsoft.Terminal.Settings.Model
// we expose the getter as a function.
Microsoft.Terminal.Core.Color[] Table();
void SetColorTableEntry(UInt8 index, Microsoft.Terminal.Core.Color value);
Microsoft.Terminal.Core.Scheme ToCoreScheme();
}
}

View File

@@ -84,6 +84,21 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
Command::Command() = default;
Model::Command Command::NewUserCommand()
{
auto newCmd{ winrt::make_self<Command>() };
newCmd->_Origin = OriginTag::User;
return *newCmd;
}
Model::Command Command::CopyAsUserCommand(const Model::Command& originalCmd)
{
auto command{ winrt::get_self<Command>(originalCmd) };
auto copy{ command->Copy() };
copy->_Origin = OriginTag::User;
return *copy;
}
com_ptr<Command> Command::Copy() const
{
auto command{ winrt::make_self<Command>() };
@@ -197,6 +212,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
return hstring{ _ID };
}
void Command::ID(const hstring& ID) noexcept
{
_ID = ID;
}
void Command::GenerateID()
{
if (_ActionAndArgs)
@@ -204,8 +224,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
auto actionAndArgsImpl{ winrt::get_self<implementation::ActionAndArgs>(_ActionAndArgs) };
if (const auto generatedID = actionAndArgsImpl->GenerateID(); !generatedID.empty())
{
_ID = generatedID;
_IDWasGenerated = true;
ID(generatedID);
}
}
}

View File

@@ -51,6 +51,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
};
Command();
static Model::Command NewUserCommand();
static Model::Command CopyAsUserCommand(const Model::Command& originalCmd);
com_ptr<Command> Copy() const;
static winrt::com_ptr<Command> FromJson(const Json::Value& json,
@@ -80,6 +82,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
hstring LanguageNeutralName() const noexcept;
hstring ID() const noexcept;
void ID(const hstring& ID) noexcept;
void GenerateID();
bool IDWasGenerated();
@@ -94,8 +97,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
bool directories,
hstring iconPath);
WINRT_PROPERTY(Model::ActionAndArgs, ActionAndArgs, Model::ActionAndArgs{});
WINRT_PROPERTY(ExpandCommandType, IterateOn, ExpandCommandType::None);
WINRT_PROPERTY(Model::ActionAndArgs, ActionAndArgs);
WINRT_PROPERTY(OriginTag, Origin);
WINRT_PROPERTY(winrt::hstring, Description, L"");

View File

@@ -35,14 +35,18 @@ namespace Microsoft.Terminal.Settings.Model
runtimeclass Command : ISettingsModelObject
{
Command();
static Command NewUserCommand();
static Command CopyAsUserCommand(Command originalCmd);
String Name { get; };
String Name;
Boolean HasName();
String LanguageNeutralName { get; };
String ID { get; };
void GenerateID();
String Description { get; };
ActionAndArgs ActionAndArgs { get; };
ActionAndArgs ActionAndArgs;
IMediaResource Icon;
@@ -51,6 +55,5 @@ namespace Microsoft.Terminal.Settings.Model
static IVector<Command> ParsePowerShellMenuComplete(String json, Int32 replaceLength);
static IVector<Command> HistoryToCommands(IVector<String> commandHistory, String commandline, Boolean directories, String iconPath);
}
}

View File

@@ -54,6 +54,22 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
DEFINE_ENUM_MAP(Microsoft::Terminal::Core::AdjustTextMode, AdjustIndistinguishableColors);
DEFINE_ENUM_MAP(Microsoft::Terminal::Control::PathTranslationStyle, PathTranslationStyle);
// Actions
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::ResizeDirection, ResizeDirection);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::FocusDirection, FocusDirection);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::SplitDirection, SplitDirection);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::SplitType, SplitType);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::SettingsTarget, SettingsTarget);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::MoveTabDirection, MoveTabDirection);
DEFINE_ENUM_MAP(Microsoft::Terminal::Control::ScrollToMarkDirection, ScrollToMarkDirection);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::CommandPaletteLaunchMode, CommandPaletteLaunchMode);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::SuggestionsSource, SuggestionsSource);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::FindMatchDirection, FindMatchDirection);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::DesktopBehavior, DesktopBehavior);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::MonitorBehavior, MonitorBehavior);
DEFINE_ENUM_MAP(Microsoft::Terminal::Control::ClearBufferType, ClearBufferType);
DEFINE_ENUM_MAP(Microsoft::Terminal::Settings::Model::SelectOutputDirection, SelectOutputDirection);
// FontWeight is special because the JsonUtils::ConversionTrait for it
// creates a FontWeight object, but we need to use the uint16_t value.
winrt::Windows::Foundation::Collections::IMap<winrt::hstring, uint16_t> EnumMappings::FontWeight()

View File

@@ -50,6 +50,22 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::IntenseStyle> IntenseTextStyle();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Core::AdjustTextMode> AdjustIndistinguishableColors();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Control::PathTranslationStyle> PathTranslationStyle();
// Actions
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::ResizeDirection> ResizeDirection();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::FocusDirection> FocusDirection();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::SplitDirection> SplitDirection();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::SplitType> SplitType();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::SettingsTarget> SettingsTarget();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::MoveTabDirection> MoveTabDirection();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Control::ScrollToMarkDirection> ScrollToMarkDirection();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::CommandPaletteLaunchMode> CommandPaletteLaunchMode();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::SuggestionsSource> SuggestionsSource();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::FindMatchDirection> FindMatchDirection();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::DesktopBehavior> DesktopBehavior();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::MonitorBehavior> MonitorBehavior();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Control::ClearBufferType> ClearBufferType();
static winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Microsoft::Terminal::Settings::Model::SelectOutputDirection> SelectOutputDirection();
};
}

View File

@@ -32,5 +32,21 @@ namespace Microsoft.Terminal.Settings.Model
static Windows.Foundation.Collections.IMap<String, UInt16> FontWeight { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.IntenseStyle> IntenseTextStyle { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Control.PathTranslationStyle> PathTranslationStyle { get; };
// Actions
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.ResizeDirection> ResizeDirection { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.FocusDirection> FocusDirection { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.SplitDirection> SplitDirection { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.SplitType> SplitType { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.SettingsTarget> SettingsTarget { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.MoveTabDirection> MoveTabDirection { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Control.ScrollToMarkDirection> ScrollToMarkDirection { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.CommandPaletteLaunchMode> CommandPaletteLaunchMode { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.SuggestionsSource> SuggestionsSource { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.FindMatchDirection> FindMatchDirection { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.DesktopBehavior> DesktopBehavior { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.MonitorBehavior> MonitorBehavior { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Control.ClearBufferType> ClearBufferType { get; };
static Windows.Foundation.Collections.IMap<String, Microsoft.Terminal.Settings.Model.SelectOutputDirection> SelectOutputDirection { get; };
}
}

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