terminal/src
James Holderness 2559ed6efa
Introduce a mechanism for passing through DCS data strings (#9307)
This PR introduces a mechanism via which DCS data strings can be passed
through directly to the dispatch method that will be handling them, so
the data can be processed as it is received, rather than being buffered
in the state machine. This also simplifies the way string termination is
handled, so it now more closely matches the behaviour of the original
DEC terminals.

* Initial support for DCS sequences was introduced in PR #6328.
* Handling of DCS (and other) C1 controls was added in PR #7340.
* This is a prerequisite for Sixel (#448) and Soft Font (#9164) support.

The way this now works, a `DCS` sequence is dispatched as soon as the
final character of the `VTID` is received. Based on that ID, the
`OutputStateMachineEngine` should forward the call to the corresponding
dispatch method, and its the responsibility of that method to return an
appropriate handler function for the sequence.

From then on, the `StateMachine` will pass on all of the remaining bytes
in the data string to the handler function. When a data string is
terminated (with `CAN`, `SUB`, or `ESC`), the `StateMachine` will pass
on one final `ESC` character to let the handler know that the sequence
is finished. The handler can also end a sequence prematurely by
returning false, and then all remaining data bytes will be ignored.

Note that once a `DCS` sequence has been dispatched, it's not possible
to abort the data string. Both `CAN` and `SUB` are considered valid
forms of termination, and an `ESC` doesn't necessarily have to be
followed by a `\` for the string terminator. This is because the data
string is typically processed as it's received. For example, when
outputting a Sixel image, you wouldn't erase the parts that had already
been displayed if the data string is terminated early.

With this new way of handling the string termination, I was also able to
simplify some of the `StateMachine` processing, and get rid of a few
states that are no longer necessary. These changes don't apply to the
`OSC` sequences, though, since we're more likely to want to match the
XTerm behavior for those cases (which requires a valid `ST` control for
the sequence to be accepted).

## Validation Steps Performed

For the unit tests, I've had to make a few changes to some of the
`OutputEngineTests` to account for the updated `StateMachine`
processing. I've also added a new `StateMachineTest` to confirm that the
data strings are correctly passed through to the string handler under
all forms of termination.

To test whether the framework is actually usable, I've been working on
DRCS Soft Font support branched off of this PR, and haven't encountered
any problems. To test the throughput speed, I also hacked together a
basic Sixel parser, and that seemed to perform reasonably well.

Closes #7316
2021-04-30 19:17:30 +00:00
..
buffer Fix implicitly narrowing conversion in textBuffer (#9972) 2021-04-28 11:45:29 -05:00
cascadia When the window is summoned and is already active, minimize it. (#9963) 2021-04-28 18:57:14 -05:00
dep Move all wildcards into targets or expand them (#6406) 2020-06-08 14:01:47 -07:00
host Revert "Prevent the virtual viewport bottom being moved up unintentionally (#9770)" 2021-04-28 12:45:09 -05:00
inc Make the window name _quake special (#9785) 2021-04-26 19:36:23 +00:00
interactivity Merged PR 5984262: [Git2Git] Merged PR 5982901: Reintroduce GetQuickCharWidth for numpad event synthesis 2021-04-27 23:17:53 +00:00
internal Implement Default Terminal (#7489) 2021-03-26 17:09:49 -05:00
propsheet Merged PR 5770253: [Git2Git] Merged PR 5760120: Add propsheet chooser to Windows 2021-03-10 01:19:04 +00:00
propslib Implement UI for choosing default terminal inside Settings page (#9907) 2021-04-28 10:43:30 +00:00
renderer Initial implementation of fine-grained text analysis (#9202) 2021-04-28 18:10:08 +00:00
server Add -ForceNoHandoff for compatibility; stop handoff for double-click launches (#9802) 2021-04-15 16:54:04 +00:00
terminal Introduce a mechanism for passing through DCS data strings (#9307) 2021-04-30 19:17:30 +00:00
testlist Reflect testlist change from OS 2021-03-29 15:24:43 -05:00
til Merged PR 5676675: Reflect OS build fixes on top of ae8347f33 2021-02-11 18:19:33 +00:00
tools Add a Monarch/Peasant sample app (#8171) 2021-01-19 21:55:30 +00:00
tsf Fix Korean IME to display a character being composed in conhost (#8632) 2021-01-04 21:05:24 +00:00
types Add support for double-width/double-height lines in conhost (#8664) 2021-02-18 05:44:50 +00:00
winconpty winconpty: close the pty host handle after terminating it (#8707) 2021-01-08 10:18:27 +00:00
common.build.post.props Move CI and audit build to the WinDev scale set pool (#8080) 2020-10-28 20:49:13 +00:00
common.build.pre.props Move Branding into common props (#9668) 2021-03-30 18:08:53 -05:00
common.build.tests.props Change TAEF nuget package to use new Microsoft.Taef name; Update to 10.58 release build version. (#9656) 2021-03-30 10:58:11 +00:00
ConsolePerf.regions.xml Tab to spaces (#578) 2019-05-13 18:06:36 -07:00
ConsolePerf.wprp Fix the WPR profile (#4007) 2019-12-17 17:14:15 -08:00
cppwinrt.build.post.props Update C++/WinRT to 2.0.210309.3 (#9437) 2021-03-10 16:04:59 -06:00
cppwinrt.build.pre.props Update C++/WinRT to 2.0.210309.3 (#9437) 2021-03-10 16:04:59 -06:00
dirs build: move oss required to build conhost out of dep/ (#5451) 2020-04-21 14:43:09 -07:00
project.inc Merged PR 5598201: Reflect OS build changes atop a8b404463 2021-01-22 04:57:26 +00:00
project.unittest.inc Merged PR 4915530: Reflect OS Build fixes on top of 58f5d7c7 2020-07-13 23:00:53 +00:00
StaticAnalysis.ruleset Fix SA for Visual Studio 16.8 (#8551) 2020-12-11 05:04:30 +00:00
Terminal.wprp Add a WPR profile containing all of Terminal's ETW providers (#9630) 2021-03-26 11:46:14 -05:00
unit.tests.x64.runsettings Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
unit.tests.x86.runsettings Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
wap-common.build.post.props Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00
wap-common.build.pre.props Initial release of the Windows Terminal source code 2019-05-02 15:29:04 -07:00