4c53c595e7
This PR adds support for the VT line rendition attributes, which allow for double-width and double-height line renditions. These renditions are enabled with the `DECDWL` (double-width line) and `DECDHL` (double-height line) escape sequences. Both reset to the default rendition with the `DECSWL` (single-width line) escape sequence. For now this functionality is only supported by the GDI renderer in conhost. There are a lot of changes, so this is just a general overview of the main areas affected. Previously it was safe to assume that the screen had a fixed width, at least for a given point in time. But now we need to deal with the possibility of different lines have different widths, so all the functions that are constrained by the right border (text wrapping, cursor movement operations, and sequences like `EL` and `ICH`) now need to lookup the width of the active line in order to behave correctly. Similarly it used to be safe to assume that buffer and screen coordinates were the same thing, but that is no longer true. Lots of places now need to translate back and forth between coordinate systems dependent on the line rendition. This includes clipboard handling, the conhost color selection and search, accessibility location tracking and screen reading, IME editor positioning, "snapping" the viewport, and of course all the rendering calculations. For the rendering itself, I've had to introduce a new `PrepareLineTransform` method that the render engines can use to setup the necessary transform matrix for a given line rendition. This is also now used to handle the horizontal viewport offset, since that could no longer be achieved just by changing the target coordinates (on a double width line, the viewport offset may be halfway through a character). I've also had to change the renderer's existing `InvalidateCursor` method to take a `SMALL_RECT` rather than a `COORD`, to allow for the cursor being a variable width. Technically this was already a problem, because the cursor could occupy two screen cells when over a double-width character, but now it can be anything between one and four screen cells (e.g. a double-width character on the double-width line). In terms of architectural changes, there is now a new `lineRendition` field in the `ROW` class that keeps track of the line rendition for each row, and several new methods in the `ROW` and `TextBuffer` classes for manipulating that state. This includes a few helper methods for handling the various issues discussed above, e.g. position clamping and translating between coordinate systems. ## Validation Steps Performed I've manually confirmed all the double-width and double-height tests in _Vttest_ are now working as expected, and the _VT100 Torture Test_ now renders correctly (at least the line rendition aspects). I've also got my own test scripts that check many of the line rendition boundary cases and have confirmed that those are now passing. I've manually tested as many areas of the conhost UI that I could think of, that might be affected by line rendition, including things like searching, selection, copying, and color highlighting. For accessibility, I've confirmed that the _Magnifier_ and _Narrator_ correctly handle double-width lines. And I've also tested the Japanese IME, which while not perfect, is at least useable. Closes #7865 |
||
---|---|---|
.. | ||
inc | ||
lib | ||
ut_types | ||
CodepointWidthDetector.cpp | ||
colorTable.cpp | ||
convert.cpp | ||
dirs | ||
Environment.cpp | ||
FocusEvent.cpp | ||
GlyphWidth.cpp | ||
IBaseData.h | ||
IControlAccessibilityInfo.h | ||
IInputEvent.cpp | ||
IInputEventStreams.cpp | ||
IUiaData.h | ||
IUiaEventDispatcher.h | ||
IUiaTraceable.h | ||
KeyEvent.cpp | ||
MenuEvent.cpp | ||
ModifierKeyState.cpp | ||
MouseEvent.cpp | ||
precomp.cpp | ||
precomp.h | ||
ScreenInfoUiaProviderBase.cpp | ||
ScreenInfoUiaProviderBase.h | ||
sgrStack.cpp | ||
sources.inc | ||
TermControlUiaProvider.cpp | ||
TermControlUiaProvider.hpp | ||
TermControlUiaTextRange.cpp | ||
TermControlUiaTextRange.hpp | ||
ThemeUtils.cpp | ||
UiaTextRangeBase.cpp | ||
UiaTextRangeBase.hpp | ||
UiaTracing.cpp | ||
UiaTracing.h | ||
unicode_width_overrides.xml | ||
Utf16Parser.cpp | ||
utils.cpp | ||
viewport.cpp | ||
WindowBufferSizeEvent.cpp |