terminal/src/buffer/out
James Holderness bb71179a24
Consolidate the color palette APIs (#11784)
This PR merges the default colors and cursor color into the main color
table, enabling us to simplify the `ConGetSet` and `ITerminalApi`
interfaces, with just two methods required for getting and setting any
form of color palette entry.

The is a follow-up to the color table standardization in #11602, and a
another small step towards de-duplicating `AdaptDispatch` and
`TerminalDispatch` for issue #3849. It should also make it easier to
support color queries (#3718) and a configurable bold color (#5682) in
the future.

On the conhost side, default colors could originally be either indexed
positions in the 16-color table, or separate standalone RGB values. With
the new system, the default colors will always be in the color table, so
we just need to track their index positions.

To make this work, those positions need to be calculated at startup
based on the loaded registry/shortcut settings, and updated when
settings are changed (this is handled in
`CalculateDefaultColorIndices`). But the plus side is that it's now much
easier to lookup the default color values for rendering.

For now the default colors in Windows Terminal use hardcoded positions,
because it doesn't need indexed default colors like conhost. But in the
future I'd like to extend the index handling to both terminals, so we
can eventually support the VT525 indexed color operations.

As for the cursor color, that was previously stored in the `Cursor`
class, which meant that it needed to be copied around in various places
where cursors were being instantiated. Now that it's managed separately
in the color table, a lot of that code is no longer required.

## Validation
Some of the unit test initialization code needed to be updated to setup
the color table and default index values as required for the new system.
There were also some adjustments needed to account for API changes, in
particular for methods that now take index values for the default colors
in place of COLORREFs. But for the most part, the essential behavior of
the tests remains unchanged.

I've also run a variety of manual tests looking at the legacy console
APIs as well as the various VT color sequences, and checking that
everything works as expected when color schemes are changed, both in
Windows Terminal and conhost, and in the latter case with both indexed
colors and RGB values.

Closes #11768
2021-11-23 18:28:55 +00:00
..
lib Vectorize TextColor::GetColor (#10779) 2021-08-02 19:02:59 +00:00
ut_textbuffer Consolidate the color palette APIs (#11784) 2021-11-23 18:28:55 +00:00
AttrRow.cpp Introduce til::rle - a run length encoded vector (#10099) 2021-05-20 17:27:50 +00:00
AttrRow.hpp Introduce til::rle - a run length encoded vector (#10099) 2021-05-20 17:27:50 +00:00
CharRow.cpp ROW: clean up in preparation to hide CharRow & AttrRow (#8446) 2021-01-20 21:16:56 +00:00
CharRow.hpp ROW: clean up in preparation to hide CharRow & AttrRow (#8446) 2021-01-20 21:16:56 +00:00
CharRowCell.cpp Greatly reduce allocations in the conhost/OpenConsole startup path (#8489) 2020-12-16 10:40:30 -08:00
CharRowCell.hpp Greatly reduce allocations in the conhost/OpenConsole startup path (#8489) 2020-12-16 10:40:30 -08:00
CharRowCellReference.cpp Add GH issue IDs to all the suppress/disables that I left behind as they were a bit too challenging to solve with this giant PR 2019-09-05 11:14:43 -07:00
CharRowCellReference.hpp Greatly reduce allocations in the conhost/OpenConsole startup path (#8489) 2020-12-16 10:40:30 -08:00
cursor.cpp Consolidate the color palette APIs (#11784) 2021-11-23 18:28:55 +00:00
cursor.h Consolidate the color palette APIs (#11784) 2021-11-23 18:28:55 +00:00
DbcsAttribute.hpp C26447,C26440 - is noexcept but can throw or doesn't throw but not noexcept 2019-08-29 15:23:07 -07:00
dirs Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
LineRendition.hpp Add support for double-width/double-height lines in conhost (#8664) 2021-02-18 05:44:50 +00:00
OutputCell.cpp Refactor the SGR implementation in AdaptDispatch (#5758) 2020-05-08 16:04:16 -07:00
OutputCell.hpp Refactor the SGR implementation in AdaptDispatch (#5758) 2020-05-08 16:04:16 -07:00
OutputCellIterator.cpp Replace gsl::at with a new til::at(span) for pre-checked bounds (#6925) 2020-07-15 10:29:36 -07:00
OutputCellIterator.hpp Replace basic_string_view<T> with span<const T> (#6921) 2020-07-15 16:40:42 +00:00
OutputCellRect.cpp Replace basic_string_view<T> with span<const T> (#6921) 2020-07-15 16:40:42 +00:00
OutputCellRect.hpp C26455, default constructor may not throw. Mark noexcept. (Trivial cases.) 2019-09-03 14:57:14 -07:00
OutputCellView.cpp Some of the PR feedback. 2019-09-05 17:21:54 -07:00
OutputCellView.hpp Optimize hot path in textBufferCellIterator (#10621) 2021-07-27 15:09:56 +00:00
precomp.cpp Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
precomp.h Exclude more rarely-used stuff from Windows headers (#8513) 2020-12-11 19:35:23 +00:00
Row.cpp Introduce til::rle - a run length encoded vector (#10099) 2021-05-20 17:27:50 +00:00
Row.hpp Introduce til::rle - a run length encoded vector (#10099) 2021-05-20 17:27:50 +00:00
search.cpp Add support for double-width/double-height lines in conhost (#8664) 2021-02-18 05:44:50 +00:00
search.h Cache the size viewport structure inside TextBuffer (#6841) 2020-07-09 11:18:25 +00:00
sources.inc Merged PR 6142815: OS build fixes on top of 94d39b758 2021-06-10 15:52:14 +00:00
TextAttribute.cpp Consolidate the color palette APIs (#11784) 2021-11-23 18:28:55 +00:00
TextAttribute.hpp Consolidate the color palette APIs (#11784) 2021-11-23 18:28:55 +00:00
textBuffer.cpp Implement Keyboard Selection (#10824) 2021-09-23 12:24:32 -07:00
textBuffer.hpp Implement Keyboard Selection (#10824) 2021-09-23 12:24:32 -07:00
textBufferCellIterator.cpp Optimize hot path in textBufferCellIterator (#10621) 2021-07-27 15:09:56 +00:00
textBufferCellIterator.hpp Expose Text Attributes to UI Automation (#10336) 2021-07-09 23:21:35 +00:00
textBufferTextIterator.cpp Some of the PR feedback. 2019-09-05 17:21:54 -07:00
textBufferTextIterator.hpp C26447,C26440 - is noexcept but can throw or doesn't throw but not noexcept 2019-08-29 15:23:07 -07:00
TextColor.cpp Consolidate the color palette APIs (#11784) 2021-11-23 18:28:55 +00:00
TextColor.h Consolidate the color palette APIs (#11784) 2021-11-23 18:28:55 +00:00
UnicodeStorage.cpp Compensate for VS 16.7, part 2 (#7383) 2020-08-24 21:21:53 +00:00
UnicodeStorage.hpp Compensate for VS 16.7, part 2 (#7383) 2020-08-24 21:21:53 +00:00