Skip to content

fixes background reset - #2900

Merged
archseer merged 4 commits into
helix-editor:masterfrom
sbromberger:sbromberger/refix-2856-2861
Jun 28, 2022
Merged

fixes background reset#2900
archseer merged 4 commits into
helix-editor:masterfrom
sbromberger:sbromberger/refix-2856-2861

Conversation

@sbromberger

Copy link
Copy Markdown
Contributor

Fixes #2856 (comment). Another set of eyes on this would be good, but here's how it looks (before / after; backgrounds deliberately garish):

Before:
IMG_0606

After:
IMG_0605

Comment thread helix-term/src/ui/editor.rs Outdated
Some(Severity::Info) => info,
Some(Severity::Hint) => hint,
});
let style = Style::default().remove_modifier(Modifier::all()).patch(

@pickfire pickfire Jun 27, 2022

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Member

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 🤔?

Copy link
Copy Markdown
Contributor Author

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.

@archseer archseer Jun 28, 2022

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Member

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 👍

Copy link
Copy Markdown
Contributor Author

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.

@the-mikedavis the-mikedavis left a comment

Copy link
Copy Markdown
Member

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 👍

@pickfire pickfire left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Italics not reset for diagnostics text

4 participants