Add support for colon separated sub-parameters#15648
Add support for colon separated sub-parameters#15648DHowett merged 32 commits intomicrosoft:mainfrom
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
as a general FYI, @j4james is pretty much the owner of this whole section of the codebase at this point, so I'd appreciate their S/O |
zadjii-msft
left a comment
There was a problem hiding this comment.
I'm generally cool with this, though I'll hold my ✅ to make sure that @j4james gets eyes on this.
|
I have some issues with the standards compliance of this implementation. Per STD 070, section 3.5.3.1, "The bit combination 3/10 is reserved for future standardization. If 3/10 is received within a parameter string, the entire sequence up to and including the final character shall be ignored." If we accept the ODA documentation as the "future standardization", that only defines 3/10 usage in the So something like It's arguable that colons could now be accepted in controls with selective parameters, but even then, any parameter substring that we don't yet support is the equivalent of an unimplemented parameter. And section 3.5.1.3 says "unimplemented selective parameter values of control sequences shall be ignored as if that parameter were not received." So something like The only thing up for debate is whether something like Then within So something like Footnotes
|
|
@j4james, what is ODA? |
Sorry, I should have been clearer about that. By ODA, I meant the Open Document Architecture format, ITU-T recommendation T.416 or ISO/IEC 8613-6. That's where modern terminals got the idea for the colon-based 256-color and RGB extensions, although it's not actually a terminal standard as such. |
|
@j4james I don't want to pretend that I understood everything what you said there, because I'm too new to all the inner workings of terminal. But I guess what you mean is, incase we don't know if a parameter accepts sub parameters or not, then we should better enter into Let me see how we can achieve it on this PR. Should that address all your concerns? |
@tusharsnn That's exactly right, yes. But note that the My initial idea was you could have a check at the start of the What I'm not sure about is how we'd handle |
This comment was marked as outdated.
This comment was marked as outdated.
@j4james Can you share a reference, so that I can have a look on which parameters support sub parameters. |
But you can't tell whether a given parameter accepts sub parameters at this point. For example, if the parameter is a
See https://vt100.net/docs/vt510-rm/DECCARA.html and https://vt100.net/docs/vt510-rm/DECRARA.html. The first four parameters are numeric parameters, which can't have sub parameters. The remaining parameters are rendition attributes, which are selective parameters, and should theoretically support the same values that we allow in an |
yeah, you're right. I realised that after I made the reply. right now, I think we should guard against both parameter and sequence to never allow parameter when we don't accept them. So, something like I've updated the validation steps to test for two new scenarios. |
|
I don't think the state machine should have any idea of what 38 means or whether it should have subparameters in SGR. |
This comment has been minimized.
This comment has been minimized.
|
I wanna work a little bit on ergonomics for accessing sub parameters. As it is, to get sub parameter at index I'm thinking of introducing |
79c86bd to
2fdc975
Compare
j4james
left a comment
There was a problem hiding this comment.
I've tried all the edge cases I can think of and it all looks good to me. Just a couple of nits, but you're welcome to ignore those. I appreciate you putting up with all my little technical complaints.
zadjii-msft
left a comment
There was a problem hiding this comment.
Looks great to me. Thanks for working together on this on - really excited to see what comes next 😉
I do agree about the TestOption = 12345, thing - can we yank that if it's unused?
15b2c6e to
237e62a
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
237e62a to
adaa841
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
| bool _parameterLimitReached; | ||
| bool _parameterLimitOverflowed; | ||
| std::vector<VTParameter> _subParameters; | ||
| std::vector<std::pair<BYTE /*range start*/, BYTE /*range end*/>> _subParameterRanges; |
There was a problem hiding this comment.
I've tested this PR and it works great. Thank you for your hard work! I have just one question before I approve it:
Why don't we just store the subparameter range right inside the VTParameter struct? That way we don't need this extra vector and the parameter slicing would be a bit simpler.
There was a problem hiding this comment.
VTParameter is base for both the _parameter and _subParameter. Storing subparameter range within VTParameter might make sense for _parameter but its should be illegal for _subParameter. But it's totally possible to implement that with an extra class based on VTParameter.
There was a problem hiding this comment.
I personally think it's fine to store the range for both and leave it unused for sub-parameters, because I suspect that it'll not cause serious bugs. For instance, incorrectly asking a sub-param for its sub-params in turn (= illegal) could just say that there are no sub-params available (+ abort() in debug builds). I'm not sure if that's better than your current approach, however. It was an idea that I had when I saw the VTParameters::subspan function and wondered if storing the range right inside VTParameters would make it simpler.
For me it's a ✅ anyways and I'll leave it up to you what you personally like best. We can still tune this code however we want in the future after all. 🙂
I'll ask @DHowett to give this just a quick look, maybe he got anything else in mind.
There was a problem hiding this comment.
We can still tune this code however we want in the future after all. 🙂
That's exactly what I feel like right now.
There's a lot we can improve here, but I'm gonna hold myself until I actually implement something that uses sub parameters. (Spoiler alert, ITU's colour sequence support incoming! 😅 )
|
It was a great experience working on Windows Terminal for the first time ❤️, feels like an achievement to me. @j4james @zadjii-msft @DHowett @lhecker @carlos-zamora Thank you all for reviewing the PR. |
Adds support for colon
:separated sub parameters in parser. Technically, after this PR, nothing should change except, now sub parameters are parsed, stored safely and we don't invalidate the whole sequence when a:is received within a parameter substring.In this PR:
adaptDispatch.6sub parameters for each parameter, extra sub parameters are ignored.VTSubParametersfor easy access to underlying sub parameters.Validation Steps Performed
References #4321
References #7228
References #15599
References xtermjs/xterm.js#2751
Closes #4321