WIP: Expose current TextAttributes from the underlying console API.#2032
Closed
jazzdelightsme wants to merge 1 commit intomicrosoft:masterfrom
Closed
WIP: Expose current TextAttributes from the underlying console API.#2032jazzdelightsme wants to merge 1 commit intomicrosoft:masterfrom
jazzdelightsme wants to merge 1 commit intomicrosoft:masterfrom
Conversation
This is not a polished PR that is ready to merge; it demonstrates a direction for which I need to get buy-off from the team before pursuing further. I'm currently working on implementing the XTPUSHSGR/XTPOPSGR control sequences (WIP PR [here](microsoft#1978), which requires saving a [stack of] text attributes, and not just the legacy attributes, but full RGB colors, etc. My first instinct was to implement the "business logic" (the stack) in the `AdaptDispatch` layer, but that will require getting the [full] text attributes from the underlying console API. This is not a *terribly* "invasive" change, but it is exposing new stuff at a layer boundary. Put another way, this means pound-including the "../buffer/out/TextAttribute.hpp" header in a few places outside of "buffer/out", and is that okay, or does that header need to be kept private and isolated? So there are a few ways this could go: 1. You folks might say "ugh, no!", and: 1. I could push (haha) the business logic of pushing and popping text attributes down another layer (so `AdaptDispatch` just forwards on the [PushGraphicsRendition](https://github.com/microsoft/terminal/blob/0af275b9cb68da14f38f05b2cdcbb35da99cb17c/src/terminal/adapter/adaptDispatchGraphics.cpp#L452) call to the lower layer, OR 2. You suggest a different, cleaner way of exposing the text attributes. OR 2. Maybe you think this general direction is fine, but maybe you have some particular requests that I do certain things differently (I totally understand being picky about stuff that cuts across API layers). What do you think? Related: PR microsoft#1978 Related: Issue microsoft#1796
zadjii-msft
requested changes
Jul 25, 2019
Member
zadjii-msft
left a comment
There was a problem hiding this comment.
Largely, this is exactly what I would have done. I am worried though that the implementation as it is leaves the opportunity for a caller to accidentally modify the buffer's state.
Member
Author
|
This has been fleshed out and incorporated as part of my main PR (#1978). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
This is not a polished PR that is ready to merge; it demonstrates a
direction for which I need to get buy-off from the team before pursuing
further.
I'm currently working on implementing the XTPUSHSGR/XTPOPSGR control
sequences (WIP PR here, which requires saving a [stack of] text
attributes, and not just the legacy attributes, but full RGB colors,
etc.
My first instinct was to implement the "business logic" (the stack) in
the
AdaptDispatchlayer, but that will require getting the [full] textattributes from the underlying console API. This is not a terribly
"invasive" change, but it is exposing new stuff at a layer boundary.
Put another way, this means pound-including the
"../buffer/out/TextAttribute.hpp" header in a few places outside of
"buffer/out", and is that okay, or does that header need to be kept
private and isolated?
So there are a few ways this could go:
attributes down another layer (so
AdaptDispatchjust forwards onthe PushGraphicsRendition call to the lower layer, OR
attributes.
OR
some particular requests that I do certain things differently (I
totally understand being picky about stuff that cuts across API
layers).
What do you think?
References
Related: PR #1978
Related: Issue #1796
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
none