Handling CAN and SUB controls
Hello all!
I recently began writing a terminal sequence parser with the intention of mimicking a VT-xxx terminal as closely as possible. However, after reading the discussions here (and here), I've been convinced that I may not actually want to carry historical baggage forward for the sole reason of "that's the way VT-xxx terminals did it."
With this in mind, I'm trying to use ECMA-48 as my guide, and fill in the gaps by perusing the current terminal + application landscape.
Both CAN
and SUB
controls are defined in ECMA-48, but I'm having some trouble interpreting them exactly:
CAN is used to indicate that the data preceding it in the data stream is in error. As a result, this data shall be ignored. The specific meaning of this control function shall be defined for each application and/or between sender and recipient.
SUB is used in the place of a character that has been found to be invalid or in error. SUB is intended to be introduced by automatic means.
According to Paul's wonderful VT state machine diagram, VT-compatible emulators should interpret both controls as "cancel any sequence immediately and return to ground state."
Based on the ECMA-48 definitions, I think the above interpretation of CAN
is reasonable, but SUB
seems like it may be intended to operate on the character-level, rather than the sequence-level.
Do modern applications make use of these controls? Should a "minimal terminal parser" be expected to handle these? Is there any difference between the two controls, or are they functionally identical?