-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
Description of the new feature/enhancement
I'd like to propose we refactor the SetGraphicsRendition implementation in the TerminalDispatch class to match the refactoring done for AdaptDispatch in PR #5758.
I've been looking at adding a few more of the SGR attributes, but I found that adding them to the TerminalDispatch was a bit of a pain, because every new attribute required a new method in the ITerminalApi interface. If we matched the AdaptDispatch implementation, it would just be one more entry in the switch statement.
Other benefits are that the AdaptDispatch implementation is a bit simpler, and easier to follow. It should be a little more efficient when dealing with multiple SGR options. And ultimately we're going to need these implementations to be identical anyway, so we can deduplicate them for issue #3849.
Proposed technical implementation details (optional)
- Add
GetTextAttributesandSetTextAttributesmethods to theITerminalApiinterface to match thePrivateGetTextAttributesandPrivateSetTextAttributesmethods in theConGetSetinterface. - Essentially just copy and paste the
AdaptDispatch::SetGraphicsRenditionimplementation intoTerminalDispatch. I think the only difference is we don't need the color index remapping, and the color index constants are different for the same reason (resolving that discrepancy is still on my TODO list). - Delete all the methods in the
ITerminalApiinterface that are no longer required.