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 margin #105

Merged
merged 4 commits into from
Mar 15, 2024
Merged

Fix margin #105

merged 4 commits into from
Mar 15, 2024

Conversation

Muscraft
Copy link
Member

@Muscraft Muscraft commented Mar 15, 2024

Margin was being utilized for a whole Message when it really should be per Snippet, since that is what is displayed together. Margin should also be calculated by annotate-snippets and not passed in, as we know how to figure everything out.

To fix these problems, this PR does the following:

  • Grouped a Snippet's DisplayLines together into a DisplaySet so all lines to be rendered for a Snippet are kept together
  • Made annotations be a field in DisplayLine, so they can reference information about the line. This will also help us in the future to be able to fold annotations into one line where possible, as well as other future rendering improvements
  • Made it so that the Margin for each DisplaySet is created internally, allowing for better formatting
  • Replaced the ability to pass in Margin with the ability to pass in only column_width, so users can easily specify it without setting all of Margin

Breaking changes:

  • Margin is now private
  • You can only pass in column_width and not all of Margin as we now handle it internally

src/renderer/display_list.rs Outdated Show resolved Hide resolved
src/renderer/mod.rs Outdated Show resolved Hide resolved
@epage epage merged commit b216321 into rust-lang:master Mar 15, 2024
13 checks passed
@Muscraft Muscraft deleted the fix-margin branch March 15, 2024 19:59
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.

2 participants