Skip to content
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

Fix precedence of ui.virtual.whitespace #8750

Merged

Conversation

chtenb
Copy link
Contributor

@chtenb chtenb commented Nov 7, 2023

This fixes the first half of #5675, namely the whitespace case.
Based on the suggestions by @pascalkuthe in #8733
Is this along the lines of what you envisioned?

This allows for more control over the order (precedence) in which styles are patched in the rendering phase.
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Nov 16, 2023
Copy link
Member

@pascalkuthe pascalkuthe left a comment

Choose a reason for hiding this comment

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

this looks pretty good, this will also help with some other stuff in the future. I may be able to use this to finally fix a bunch of other highlight issues in the future

helix-term/src/ui/document.rs Outdated Show resolved Hide resolved
helix-term/src/ui/document.rs Outdated Show resolved Hide resolved
helix-term/src/ui/editor.rs Show resolved Hide resolved
@pascalkuthe pascalkuthe added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. E-easy Call for participation: Experience needed to fix: Easy / not much labels Nov 19, 2023
@chtenb
Copy link
Contributor Author

chtenb commented Nov 21, 2023

I pushed a commit addressing the points you made.

@chtenb
Copy link
Contributor Author

chtenb commented Nov 21, 2023

I think the label "waiting-on-author" can be removed.

@gabydd gabydd added S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 21, 2023
@archseer archseer merged commit 41b307b into helix-editor:master Nov 22, 2023
6 checks passed
@tanj
Copy link

tanj commented Nov 22, 2023

not sure if there is anything special about this, but when I built with this commit merged to master I lose all syntax highlighting. If I go back one commit to 47b6c4b and build syntax highlighting is back.

This is built on Windows 11 and running in Windows Terminal

theme,
};
let mut overlay_styles = StyleIter {
text_style: renderer.text_style,
Copy link
Member

Choose a reason for hiding this comment

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

using render.text_style is wrong here it will set the whole document to the text colour as the overlay is patched last, this should just be Style::default so if there is no style here we don't override the past text highlighting

Copy link
Member

Choose a reason for hiding this comment

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

see StyleIter for why it will highlight all the text the default text color:

.fold(self.text_style, |acc, span| {
acc.patch(self.theme.highlight(span.0))
});
as overlay_highlight_iter covers the whole viewport

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking into this more deeply, this text_style is set based on the given ui.text scope. The documentation about this says "Command prompts, popup text, etc.", but as this is really the default text style that is used, we should probably change that description.

@archseer
Copy link
Member

Reverting. I thought this PR was properly tested.

archseer added a commit that referenced this pull request Nov 22, 2023
@chtenb
Copy link
Contributor Author

chtenb commented Nov 22, 2023

My apologies for missing this. I had been using this patch for weeks without problems. It seems to be that the themes I was using did not expose this issue. But other themes, like the default theme, do expose this issue. I will fix the problem and make sure to test with a wider variety of themes.

EDIT: this is probably related to whether the theme sets the ui.text scope or not.

chtenb added a commit to chtenb/helix that referenced this pull request Nov 22, 2023
pascalkuthe pushed a commit that referenced this pull request Nov 25, 2023
* Revert "Revert "Fix precedence of ui.virtual.whitespace (#8750)""

This reverts commit 811d62d.

* Fix ui.text overwriting the syntax highlighting

Adjust ui.text description
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
dgkf pushed a commit to dgkf/helix that referenced this pull request Jan 30, 2024
* Revert "Revert "Fix precedence of ui.virtual.whitespace (helix-editor#8750)""

This reverts commit 811d62d.

* Fix ui.text overwriting the syntax highlighting

Adjust ui.text description
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
* Revert "Revert "Fix precedence of ui.virtual.whitespace (helix-editor#8750)""

This reverts commit 811d62d.

* Fix ui.text overwriting the syntax highlighting

Adjust ui.text description
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
* Revert "Revert "Fix precedence of ui.virtual.whitespace (helix-editor#8750)""

This reverts commit 811d62d.

* Fix ui.text overwriting the syntax highlighting

Adjust ui.text description
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
* Revert "Revert "Fix precedence of ui.virtual.whitespace (helix-editor#8750)""

This reverts commit 811d62d.

* Fix ui.text overwriting the syntax highlighting

Adjust ui.text description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements E-easy Call for participation: Experience needed to fix: Easy / not much S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants