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

Add wrapping behaviour to code labels #116

Merged
merged 3 commits into from
Dec 13, 2023
Merged

Add wrapping behaviour to code labels #116

merged 3 commits into from
Dec 13, 2023

Conversation

LukeMathWalker
Copy link
Owner

Our error reporter had no wrapping behaviour for code labels: they would happily go as far right as they wanted, often overflowing the assumed width of the terminal they are being printed on.

This PR changes that behaviour in two ways:

  • Labels are no longer forced to be right-positioned to the code span they refer to. If it helps to keep them on one line, we now position them to the left or centred (with this order of preference).
  • If they would necessarily overflow the maximum allowed width, we perform text wrapping.

Getting this right was... tricky. But we have a fairly extensive collection of error messages in our UI tests and the new version seems to work as expected.

@LukeMathWalker LukeMathWalker merged commit 44cad26 into main Dec 13, 2023
4 checks passed
@LukeMathWalker LukeMathWalker deleted the label-width branch December 13, 2023 09:50
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.

1 participant