-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes background reset #2900
fixes background reset #2900
Conversation
helix-term/src/ui/editor.rs
Outdated
Some(Severity::Info) => info, | ||
Some(Severity::Hint) => hint, | ||
}); | ||
let style = Style::default().remove_modifier(Modifier::all()).patch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better if we patch it twice after reset? First with normal text background, then with diagnostic style.
Or another approach is to just fix the styles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand. This is intended to fix the reported problem by removing the modifiers for the diagnostics (prior to applying the diagnostic style, which can include modifiers) while leaving the other style elements untouched.
What would patching twice buy us here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we could do
Style::reset().patch(background_style).patch(
match {
// ... that existing match expression ...
},
)
I'm pretty sure that would be correct - I don't think there are any odd scenarios where we would want inherit a background that isn't the regular background, right 🤔?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I understand. OK. One sec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reset.patch(background)
should be identical to just using background
though. It's just a completely blank style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at Style::reset
, it looks like it'll start out with a sub_modifier
of Modifier::all()
which I think is what we need to clear the italics. We could probably do:
background_style.remove_modifier(Modifier::all())
to be more clear that we only want to drop the modifiers from the background
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want me to follow up with this change, or are we all good at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it's working well for me now so I say no need for any more changes 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy. Thanks, and sorry for the original oversight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should do the trick 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Fixes #2856 (comment). Another set of eyes on this would be good, but here's how it looks (before / after; backgrounds deliberately garish):
Before:
After: