4265 Commits

Author SHA1 Message Date
Leonard Hecker
ae8c868a1c
AtlasEngine: Fix a buffer overrun (#17536)
The strided `memcpy` between buffers failed to account for situations
where the destination stride is smaller than the source stride.
The solution is to only copy as many bytes as are in each row.

## Validation Steps Performed
Even with AppVerifier the issue could not be reproduced.
Adding an `assert(srcStride <= mapped.RowPitch)`, however, did trap
the bug when WARP is used while BackendD3D is force-enabled.
2024-07-09 22:07:01 +00:00
Mike Griese
678432ac6c
Dismiss a action preview when the next action isn't previewable (#17533)
This became much more obvious with the sendInput previewing. We would
only dismiss previews if the following action was also previewable.

related: #15845
2024-07-09 21:12:32 +00:00
Mike Griese
6c01d736fa
Add a close button to the Snippets pane (#17528)
As discussed in the bug bash. It should be closable with a button. 

This also changes the tab color to match the Settings tabs.

This also fixes a crash where dragging just a snippets pane out to it's
own window would crash.
2024-07-09 16:25:17 +00:00
Dustin L. Howett
67d2636c81 Revert "nuget: move to shine-oss tenant rather than ms tenant (#17451)"
This reverts commit e9212e43a36cbe59d645894b7200e23b6d6e2c5d.
2024-07-09 11:29:25 -05:00
Windows Console Service Bot
53841f7dd5
Localization Updates - main - 07/08/2024 20:47:05 (#17511) 2024-07-08 16:45:04 -07:00
Leonard Hecker
a2d7121489
Fix more PDP ploc related issues (#17530)
This fixes some more issues not properly covered by #17526:
* Fixed `_locComment_text` comments being effectively ignored.
* Fixed line splitting of comments (CRLF vs LF).
* Fixed BOM suppression.
* Fixed support for having multiple `{Locked=...}` comments.
2024-07-08 16:33:54 -07:00
Leonard Hecker
5bbd905ded
Fix qps-ploc generation for store translations (#17526)
* Modified `Generate-PseudoLocalizations.ps1` to find the .xml files.
  (As opposed to .resw for the other translations.)
* Added support for the new format by adding new XPath expressions,
  and stripping comments/attributes as needed.
* Fixed `PreserveWhitespace` during XML loading.
* Fixed compliance with PowerShell's strict mode.

## Validation Steps Performed
Ran it locally and compared the results. 
2024-07-08 17:26:16 -05:00
Dustin L. Howett
bc20225b08
onebranch: allow publish/package to run in :latest container (#17514)
We have to run in an older OneBranch Windows container image due to
compiler bugs.

This change prevents us from having to wait for the container image to
download for build legs that _aren't_ using the compiler.
2024-07-08 15:37:50 -05:00
Mike Griese
02a7c02548
Add a snippets pane (#17330)
This adds a snippets pane, which can be a static pane with all your
snippets (`sendInput` actions) in it. (See #17329)

This pane has a treeview with these actions in it, that we can filter
with a textbox at the top.

Play buttons next to entries make it quick to run the command you found.

Bound in the default actions with

```json
        { "command": { "action": "splitPane", "type": "snippets" }, "id": "Terminal.OpenSnippetsPane", "name": { "key": "SnippetsPaneCommandName" } },
```

re: #1595

----

TODO, from 06-04 bug bash

* [x] Snippets pane doesn't display some "no snippets found" text if
there aren't any yet
* [x] open snippets pane; find a "send input"; click the play button on
it; input is sent to active pane; begin typing
* [x] I can open an infinite amount of suggestions panes
* ~I'm closing this as by-design for now at least. Nothing stopping
anyone from opening infinite of any kind of pane.~
* ~This would require kind of a lot of refactoring in this PR to mark a
kind of pane as being a singleton or singleton-per-tab~
  * Okay everyone hates infinite suggestions panes, so I got rid of that
* [x] Ctrl+Shift+W should still work in the snippets pane even if focus
isn't in textbox
* [ ] open snippets pane; click on text box; press TAB key;
  * [ ] If you press TAB again, I have no idea where focus went
* [x] some previews don't work. Like `^c` (`"input": "\u0003"`)
* [x] nested items just give you a bit of extra space for no reason and
it looks a little awkward
* [x] UI Suggestion: add padding on the right side
* [ ] [Accessibility] Narrator says "Clear buffer; Suggestions found
132" when you open the snippets pane
- Note: this is probably Narrator reading out the command palette (since
that's where I opened it from)
- We should probably expect something like "Snippets", then (assuming
focus is thrown into text box) "Type to filter snippets" or something
like that
2024-07-08 18:26:07 +00:00
PankajBhojwani
ec9289288e
Fix schema and user defaults from Action ID change (#17509)
- Remove the `deprecated` flag for the `keybindings` array now that we
have re-added that
- Update `userDefaults` to use the correct ID for the `Copy` command
2024-07-03 13:56:30 +00:00
Dustin L. Howett
e932d63a70
build: update the loc pipeline with the final locations of the PDPs (#17507)
This allows us to remove the dependency on the `Terminal.Internal`
repository.

I have also added some parameters to the build pipeline to ease testing.
2024-07-02 21:04:54 +00:00
Leonard Hecker
7f2249c810
AtlasEngine: Curly line redux (#17508)
See #17501.
2024-07-02 18:16:09 +00:00
James Holderness
61ee7b0ef6
Add support for querying the character cell size (#17504)
This PR add supports for two query sequences that are used to determine
the pixel size of a character cell:

* `CSI 16 t` reports the pixel size of a character cell directly.
* `CSI 14 t` reports the pixel size of the text area, and when divided
  by the character size of the text area, you can get the character cell
  size indirectly (this method predates the introduction of `CSI 16 t`).

These queries are used by Sixel applications that want to fit an image
within specific text boundaries, so need to know how many cells would be
covered by a particular pixel size, or vice versa. Our implementation of
Sixel uses a virtual cell size that is always 10x20 (in order to emulate
the VT340 more accurately), so these queries shouldn't really be needed,
but some applications will fail to work without them.

## References and Relevant Issues

Sixel support was added to conhost in PR #17421.

## Validation Steps Performed

I've added some unit tests to verify that these queries are producing
the expected responses, and I've manually tested on [XtermDOOM] (which
uses `CSI 16 t`), and the [Notcurses] library (which uses `CSI 14 t`).

[XtermDOOM]: https://gitlab.com/AutumnMeowMeow/xtermdoom
[Notcurses]: https://github.com/dankamongmen/notcurses

## PR Checklist
- [x] Tests added/passed
2024-07-02 17:42:37 +00:00
Windows Console Service Bot
ee40166799
Check in all localized PDPs (#17500) 2024-07-02 12:18:35 -05:00
Leonard Hecker
ad3797ace9
AtlasEngine: Improve appearance of curly underlines (#17501)
We'd previously subtract one underline-height from the curly line
offset, even though we already had subtracted its complete height.

Additionally, the pixel shader received some fine tuning:
* Shrink the stroke width so that the anti-aliasing can be seen
  all the way up to the horizontal edges of the bounding box.
* Add a phase shift to break apart the symmetry of the curve.

Closes #17482

Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
2024-07-02 15:54:03 +00:00
Leonard Hecker
c9e200734e
Improve Viewport and Viewport::WalkInBounds (#17143)
This removes all of the 2D iteration machinery. Imagine the text buffer
as a `Cell[w][h]` grid. Clearly, this is identical to a `Cell[w*h]`
array, which shows that copying between overlapping ranges only needs
either forward or backward copying, and not left/right/top/down.

With `WalkDir` removed, `WalkInBounds` can be rewritten with basic
arithmetic which allows `pos` to be an exclusive end coordinate.
2024-07-02 15:48:56 +00:00
e82eric
d051f7047d
Add ability to save input action from command line (#16513)
Hi wanted to make an attempt at
[12857](https://github.com/microsoft/terminal/issues/12857). This still
needs work but I think the initial version is ready to be reviewed.

## Summary of the Pull Request

Mostly copied from:
6f5b9fb...1cde67ac46

- Save to disk
- If command line is empty use selection
- Show toast
- No UI.  Trying out the different options now.

## PR Checklist
- [ ] Closes #12857
- [ ] Tests added/passed
- [ ] Documentation updated
- If checked, please file a pull request on [our docs
repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
- [ ] Schema updated (if necessary)

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
2024-07-02 11:27:20 +00:00
Dustin L. Howett
8009b53819
Check the PDPs and StoreBroker configs into the repo (#17476)
This also updates the localization pipeline to check in translations for
the PDPs.

Right now, the primary source for PDPs is the Terminal.Internal
repository. They are submitted from there, and pulled back in as though
they were destined for the internal repo. We rename them on disk prior
to loc check-in to pretend they live in this repo.

Once I submit a change request to the Touchdown team to update the paths
in their backend, I will follow up with another pull request that
updates the remaining build steps to account for that.
2024-07-01 12:23:05 -05:00
Windows Console Service Bot
14e2c4254a
Localization Updates - main - 07/01/2024 17:19:15 (#17499) 2024-07-01 12:20:47 -05:00
Leonard Hecker
9cc0ebad83
Initialize all SixelParser members (#17497)
Assuming we do have a bug somewhere, initializing these members
will allow us to consistently reproduce the bug, whereas without
the initialization the member values will all be random and so
they may result in random behavior which would make finding the
root cause more difficult (or at least less consistent).
2024-07-01 16:28:58 +00:00
™️
1f47de37fe
Theme for settings (#16479)
Adds support for a new `settings` object in the theme settings. This
includes a single property, `theme`. This allows users to set a
different theme from the app's requested theme, if they so choose.

Closes #9231

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
2024-07-01 14:38:14 +00:00
Windows Console Service Bot
2fa7445b00
Localization Updates - main - 06/29/2024 03:05:30 (#17485) 2024-07-01 12:31:17 +00:00
Dustin L. Howett
e9212e43a3
nuget: move to shine-oss tenant rather than ms tenant (#17451) 2024-07-01 11:28:56 +00:00
James Holderness
236c0030f1
Add support for Sixel images in conhost (#17421)
## Summary of the Pull Request

This PR introduces basic support for the Sixel graphics protocol in
conhost, limited to the GDI renderer.

## References and Relevant Issues

This is a first step towards supporting Sixel graphics in Windows
Terminal (#448), but that will first require us to have some form of
ConPTY passthrough (#1173).

## Detailed Description of the Pull Request / Additional comments

There are three main parts to the architecture:

* The `SixelParser` class takes care of parsing the incoming Sixel `DCS`
  sequence.
* The resulting image content is stored in the text buffer in a series
  of `ImageSlice` objects, which represent per-row image content.
* The renderer then takes care of painting those image slices for each
  affected row.

The parser is designed to support multiple conformance levels so we can
one day provide strict compatibility with the original DEC hardware. But
for now the default behavior is intended to work with more modern Sixel
applications. This is essentially the equivalent of a VT340 with 256
colors, so it should still work reasonably well as a VT340 emulator too.

## Validation Steps Performed

Thanks to the work of @hackerb9, who has done extensive testing on a
real VT340, we now have a fairly good understanding of how the original
Sixel hardware terminals worked, and I've tried to make sure that our
implementation matches that behavior as closely as possible.

I've also done some testing with modern Sixel libraries like notcurses
and jexer, but those typically rely on the terminal implementing certain
proprietary Xterm query sequences which I haven't included in this PR.

---------

Co-authored-by: Dustin L. Howett <dustin@howett.net>
2024-07-01 10:57:49 +00:00
Carlos Zamora
6589957d4d
Add Quick Fix UI and support for custom CommandNotFound OSC (#16848)
### `OSC 9001; CmdNotFound; <missingCmd>`
Adds support for custom OSC "command not found" sequence `OSC 9001;
CmdNotFound; <missingCmd>`. Upon receiving the "CmdNotFound" variant
with the missing command payload, we send the missing command up to the
Quick Fix menu and add it in as `winget install <missingCmd>`.

### Quick Fix UI
The Quick Fix UI is a new UI surface that lives in the gutter (left
padding) of your terminal. The button appears if quick fixes are
available. When clicked, a list of suggestions appears in a flyout. If
there is not enough space in the gutter, the button will be presented in
a collapsed version that expands to a normal size upon hovering over it.

The Quick Fix UI was implemented similar to the context menu. The UI
itself lives in TermControl, but it can be populated by other layers
(i.e. TermApp layer).

Quick Fix suggestions are also automatically loaded into the Suggestions
UI.

If a quick fix is available and a screen reader is attached, we dispatch
an announcement that quick fixes are available to notify the user that
that's the case.

Spec: #17005
#16599

### Follow-ups
- #17377: Add a key binding for quick fix
- #17378: Use winget to search for packages using `missingCmd`

---------

Co-authored-by: Dustin L. Howett <duhowett@microsoft.com>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
2024-06-28 23:27:31 +00:00
Windows Console Service Bot
024837c50f
Localization Updates for #16916 (Grapheme Clusters) (#17474) 2024-06-28 15:19:58 -05:00
Leonard Hecker
cb48babe9d
Implement grapheme clusters (#16916)
First, this adds `GraphemeTableGen` which
* parses `ucd.nounihan.grouped.xml`
* computes the cluster break property for each codepoint
* computes the East Asian Width property for each codepoint
* compresses everything into a 4-stage trie
* computes a LUT of cluster break rules between 2 codepoints
* and serializes everything to C++ tables and helper functions

Next, this adds `GraphemeTestTableGen` which
* parses `GraphemeBreakTest.txt`
* splits each test into graphemes and break opportunities
* and serializes everything to a C++ table for use as unit tests

`CodepointWidthDetector.cpp` was rewritten from scratch to
* use an iterator struct (`GraphemeState`) to maintain state
* accumulate codepoints until a break opportunity arises
* accumulate the total width of a grapheme
* support 3 different measurement modes: Grapheme clusters,
  `wcswidth`-style, and a mode identical to the old conhost

With this in place the following changes were made:
* `ROW::WriteHelper::_replaceTextUnicode` now uses the new
  grapheme cluster text iterators
* The same function was modified to join new text with existing
  contents of the current cell if they join to form a cluster
* Otherwise, a ton of places were modified to funnel the selection
  of the measurement mode over from WT's settings to ConPTY

This is part of #1472

## Validation Steps Performed
* So many tests 
* https://github.com/apparebit/demicode works fantastic 
* UTF8-torture-test.txt works fantastic 
2024-06-26 18:40:27 +00:00
Mike Griese
174dcb9091
Add an experimental setting for making suggestions RGB (#17416)
Adds `$profile:experimental.rainbowSuggestions`, which makes the
suggestion text all RGB. This sparks joy.
2024-06-25 17:44:56 -05:00
Windows Console Service Bot
9f7032afd8
Localization Updates - builtin glyphs/shader compilation (#17458) 2024-06-24 13:03:25 -07:00
Leonard Hecker
8c14a34263
Fix builtin glyph corruption in the D2D renderer (#17464)
The initial contents of a texture are undefined. That's not good.
Now they are. That's good.
2024-06-23 10:09:42 +00:00
Leonard Hecker
bb4981caae
Add more ConsoleBench tests (#17441)
This now covers all major Console APIs.
In the future we could add tests that cover VT sequences as well.
2024-06-22 11:30:18 +00:00
Mike Griese
8511f3d737
Add a spec for "Snippets" (#17329)
This specs out a lot of plans for snippets. We've already got these in
the sxnui as "tasks", but we can do so very much more.

This spec is a few years old now, but it's time for it to get promoted
out of my draft branch.

References: 
* #1595
* #7039
* #3121
* #10436
* #12927
* #12857
* #5790
* #15845

---------

Co-authored-by: Dustin L. Howett <duhowett@microsoft.com>
2024-06-22 11:03:04 +00:00
blitzRahul
fa407332a5
Display useful pixel shader compilation errors (#17436)
More descriptive warnings are triggered when custom pixel shader
compilation fails.

If D3DCompileFromFile fails and the compiler generates an error message-
the message is converted to a wstring and is sent as a parameter when
calling p.warningCallback.
Changes were made to resources.resw and TermControl.cpp to accommodate
this.

## Validation Steps Performed
I tested the following errors that may be encountered while developing a
custom pixel shader:
1. Compile time errors
2. File not found error
3. Path not found error
4. Access denied error

Fixes #17435

TAEF tests passed:
Summary: Total=294, Passed=294, Failed=0, Blocked=0, Not Run=0,
Skipped=0
2024-06-21 21:25:49 +00:00
Dustin L. Howett
34d4dc5a5f
Remove the D2D warning from the Builtin Glyphs setting (#17454) 2024-06-20 14:03:27 -07:00
David Federman
613a539613
Add Microsoft.MSBuildCache (#17393)
Add Microsoft.MSBuildCache

This change adds a new pipeline which enables caching in the build. This
is added as a separate pipeline for now with the eventual goal of
enabling for PR and/or CI builds.

Documentation for Microsoft.MSBuildCache can be found in the GitHub
repo: https://github.com/microsoft/MSBuildCache

Preliminary numbers below.

*
[Baseline](https://dev.azure.com/ms/terminal/_build/results?buildId=579399&view=results):
12 min
* [0% Cache
hits](https://dev.azure.com/ms/terminal/_build/results?buildId=579419&view=results):
16 mins
* [100% cache
hits](https://dev.azure.com/ms/terminal/_build/results?buildId=579427&view=results):
3 mins
2024-06-20 14:02:26 -07:00
Leonard Hecker
bd116e35b2
Make the renderer optional (#17442)
If `VtEngine` gets removed from conhost, we need to be able to run
without any renderer present whatsoever. To make this possible,
I've turned all `Renderer&` into `Renderer*`.

Part of #14000
2024-06-20 18:26:58 +00:00
Leonard Hecker
e0686fa6f3
Remove some unused TextBuffer methods (#17443)
This is simply some unused code from the days before the big
text buffer rewrite in #13626.
2024-06-20 16:55:22 +00:00
Leonard Hecker
324e0f425a
Move colorbrewer into its own proper header (#17444)
I'm planning to use the `dark2` color palette in the upcoming
cooked read rewrite as a debug aid to paint dirty regions.
Now that it's going to be used in more than one place I figured
it may be time to properly add it to the NOTICE file even if
it still won't be shipped with the final product.
2024-06-20 16:55:13 +00:00
PankajBhojwani
5d46e317b2
Fix crash when closing panes very quickly (#17450)
#17358 introduced a bug where if you open/close panes very rapidly
Terminal will crash. This was because `_content` was being set to `null`
and then a `Close` event was being emitted, but several functions
attempt to access the pane's `_content` as part of the close routine.
For example, `TerminalTab` tries to update the `TaskbarProgress` every
time a pane is closed and as part of that update sequence it queries the
pane - which has `null` content now - for the taskbar progress,
resulting in a crash. This PR fixes that crash.

Refs #17358
2024-06-20 16:07:40 +00:00
Dustin L. Howett
a80539c2f7
build: make the agent pool selection more robust (#17440) 2024-06-19 10:13:52 -05:00
Dustin L. Howett
f1079be854
ci: Remove GitHub Rich Code Nav Indexer (#17438)
It's been throwing deprecation warnings for a while, and now I can't
install the task on our new Azure Organization
2024-06-18 08:40:15 -07:00
Windows Console Service Bot
227cfdefac
Localization Updates - main - 06/12/2024 03:05:48 (#17423) 2024-06-13 15:36:59 -05:00
Tushar Singh
7c1e2298f8
Fix some search highlights scenarios (#17352)
Fixes:
- Snapping the current match to the current selection doesn't work.
- Fast closing and re-opening SearchBox would leave search highlights in
an inconsistent state. The highlights would be active even when SB is
not on the screen, and results are not updated as more text is added to
the buffer.
- Search highlights scroll marks are not cleared when the search box is
closed.
2024-06-13 18:29:12 +00:00
Mike Griese
a7e2b46e20
Add descriptions to commands (namely, snippets) (#17376)
This adds a `"description"` property to actions. Notably, the shell
completion protocol (#3121) will now also populate that.

The suggestions UI can then use those descriptions to display an
additional tooltip with that information.

TeachingTip was kinda an abject disaster last time I tried this, so this
_isn't_ a TeachingTip. It's literally a text block.

xlinks:
* #13000
* #15845 
* #14939 - the last abandoned attempt at this
2024-06-12 20:03:22 +00:00
Mike Griese
86ba98607f
Re-implement previewing, with the new TSF (#17386)
This adds support for previewing snippets, again. This time, with the
new TSF implementation. Leonard pointed me in the right direction with
this - he's the one who suggested to have a second `Composition` just
for previews like this.

Then we do some tricky magic to make it work when we're using
commandlines from shell integration, or you've got the ghost text from
powershell, etc. Then we visualize the control codes, just so they
aren't just U+FFFE diamonds.

Closes #12861
2024-06-11 23:18:18 +00:00
Carlos Zamora
125738b63e
Add Spec for Quick Fix (#17005)
Quick Fix will be a new UI surface that allows the user to interact with
the terminal and leverage the context of a specific command being
executed. This new UI surface will be a home for features like WinGet
Command Not Found.

#16599
2024-06-11 13:37:09 -05:00
flyingcat
c52ba7dec6
Make subsequent windows open in the foreground (#17368)
Sometimes subsequent WT windows open in the background behind other
applications. This PR tries to fix it.

Refs #15895
Refs #15479

Mysterious bug (and annoying). There are even some discussions about
happening to the first startup, not just subsequent ones. Sometimes the
window may show up without animation too. So I don't think this is the
final solution, but it did get solved on my computer, for now.

## Validation Steps Performed
0. Quit all WT windows if some.
1. Open File Explorer, click "Open in Terminal" in context menu.
2. Move the newly opened window and minimize it.
3. Back to step 1 and repeat several times.
4. All the windows should open in the foreground correctly (yet possibly
without animation).

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
2024-06-10 21:19:07 +00:00
Mike Griese
e49afb3ccd
Mark the AdaptDispatch ctor as noexcept (#17417)
CI is complaining about this on all new builds, in audit mode. But I
don't think anything changed here recently. Maybe just new audit rules
rolled out?
2024-06-10 20:52:29 +00:00
Windows Console Service Bot
5359e71ca1
Localization Updates for #17369 (#17380) 2024-06-10 14:49:08 -05:00
Dustin L. Howett
523af87e34
build: add a caching copy of the CI pipeline (#17392)
This is a place for @dfederm to work, but I couldn't create the pipeline
definition without first creating the yml file _in main_. Thanks SFI.
2024-06-07 13:13:32 -05:00